How to play a video file from the URL of type .3gp

前端 未结 2 974
慢半拍i
慢半拍i 2021-01-16 23:51

Thanks in advance. I want to implement the code to play a video in iphone programatically from URL. I have written the code like this .

 NSURL *url = [NSURL          


        
相关标签:
2条回答
  • 2021-01-16 23:58

    I have played successfully .3gp with iphone sdk and my code is :

    NSString *soundLocalPath  = [[NSBundle mainBundle] pathForResource:@"Demo_video" ofType:@"3gp"];
    
    NSURL *tempUrl   = [NSURL fileURLWithPath:soundLocalPath];
    
    self.soundUrlPath = tempUrl;
    
    MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL: self.soundUrlPath];
    
    self.mpMoviePlayer = player;
    
    [player release];
    
    [self.mpMoviePlayer prepareToPlay];
    [self.mpMoviePlayer.view setFrame: self.view.bounds];  // player's frame must match parent's
    
    [self.view addSubview: self.mpMoviePlayer.view];
    
    [self.mpMoviePlayer play];
    
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(movieFinishedCallback:)
                                                 name:MPMoviePlayerPlaybackDidFinishNotification
                                               object:player];
    
    
    -(void) movieFinishedCallback:(NSNotification*) aNotification
    {
        MPMoviePlayerController *player = [aNotification object];
    
        [[NSNotificationCenter defaultCenter] removeObserver:self
                                                        name:MPMoviePlayerPlaybackDidFinishNotification
                                                      object:player];
    
        [player autorelease];
    }
    
    0 讨论(0)
  • 2021-01-17 00:03

    We can also able to play files with .3gp extension, but to play we need some compression standards for that converted the file into all mobile supported formats means (3GPP - Mobile Balanced Quality [H.263 near 128 kbps, 10 fps, 128*96; AMR)). So it is playing now.

    0 讨论(0)
提交回复
热议问题