开发者

MediaPlayer won't play video

开发者 https://www.devze.com 2023-02-16 02:03 出处:网络
I\'m implementing a Media player in my iPad app, but the video won\'t play at all. It shows the video\'s first frame, but as soon as I press play, it pauses instantly after.

I'm implementing a Media player in my iPad app, but the video won't play at all. It shows the video's first frame, but as soon as I press play, it pauses instantly after.

Any idea why this is happening? I think it probably has to do with the iPad being version 3.2.

Below is my code. Thanks in advance!

- (void)viewDidLoad {

    NSString *urlStr = [[NSBundle mainBundle] pathForResource:@"Reel.m4v" ofType:nil];
    NS开发者_如何学CURL *url = [NSURL fileURLWithPath:urlStr];
    videoPlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
    [self.view addSubview:videoPlayer.view];
    videoPlayer.view.frame = CGRectMake(30, 180, 964, 493);  
    [videoPlayer stop];

    [super viewDidLoad];
}


I figured it out through this post: Ipad MPMovieplayerController video loads but automatically pauses when played

I had to set this videoPlayer.useApplicationAudioSession = NO;

0

精彩评论

暂无评论...
验证码 换一张
取 消