我正在使用
MPMoviePlayerViewController
从服务器播放视频流,其他一切都很顺利。我的问题是,当我播放视频时,它会自动播放,如果没有可用的可播放内容,则会自动进入暂停状态,并且在加载内容后不会播放。
movieController = [[MPMoviePlayerViewController alloc] init];
movieController.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
[movieController.moviePlayer setContentURL:mediaURL];
[movieController.moviePlayer prepareToPlay];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
[movieController.moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
[movieController.moviePlayer setFullscreen:YES];
[movieController.moviePlayer setShouldAutoplay:YES];
[movieController.moviePlayer play];
[self presentMoviePlayerViewControllerAnimated:movieController];
这是我的代码,用于从给定的url播放视频
mediaURL
。我已尝试添加
MPMoviePlayerPlaybackStateDidChangeNotification
检查状态更改为
MPMoviePlaybackStatePaused
,它也很好。也已检查
MPMovieLoadState
具有
MPMovieLoadStatePlaythroughOK
使用
MPMoviePlayerLoadStateDidChangeNotification
问题是没有得到
MPMovie加载状态播放正常
自动暂停后。
This link
还有,有没有其他方法可以点击暂停按钮
MPMoviePlayerPlaybackStateDidChange通知
,因为通知也因为其他原因而被触发。