MPMoviePlayerViewController Generating lots of errors

落爺英雄遲暮 提交于 2019-12-17 19:31:11

问题


I am having issues to get MPMoviePlayerViewController to work. I have a new project that after viewDidLoad I try to play the movie in a moviePlayerViewController as below. I get the movie to play put I get lots and lots of error messages as below. Can someone explain what I am doing wrong to get these errors

- (void)viewDidLoad
{
    [super viewDidLoad];
    [ self play ];
}

- (void) play {
    NSURL *filmURL = [ NSURL URLWithString:@"http://www.ud-ltd.com/ipmt/Film16.mp4" ];
    self.mvc = [[MPMoviePlayerViewController alloc] initWithContentURL:filmURL ];
    [ self presentMoviePlayerViewControllerAnimated:self.mvc ];
    [ self.view addSubview:self.mvc.view ];
    [ self.mvc.moviePlayer play];
}

The error messages

Jan  8 21:19:28 rezas-macbook.home MoviePlayer[30320] <Error>: CGContextSaveGState: invalid context 0x0
Jan  8 21:19:28 rezas-macbook.home MoviePlayer[30320] <Error>: CGContextClipToRect: invalid context 0x0
Jan  8 21:19:28 rezas-macbook.home MoviePlayer[30320] <Error>: CGContextTranslateCTM: invalid context 0x0
Jan  8 21:19:28 rezas-macbook.home MoviePlayer[30320] <Error>: CGContextDrawShading: invalid context 0x0
Jan  8 21:19:28 rezas-macbook.home MoviePlayer[30320] <Error>: CGContextRestoreGState: invalid context 0x0
2013-01-08 21:19:28.526 MoviePlayer[30320:c07] [MPAVController] Autoplay: Disabling autoplay for pause
2013-01-08 21:19:28.527 MoviePlayer[30320:c07] [MPAVController] Autoplay: Disabling autoplay
2013-01-08 21:19:28.528 MoviePlayer[30320:c07] Warning: Attempt to present <MPMoviePlayerViewController: 0x916ec10> on <ViewController: 0x916c9c0> whose view is not in the window hierarchy!
2013-01-08 21:19:28.536 MoviePlayer[30320:c07] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0)
2013-01-08 21:19:29.864 MoviePlayer[30320:c07] [MPAVController] Autoplay: Enabling autoplay
2013-01-08 21:19:29.868 MoviePlayer[30320:c07] [MPAVController] Autoplay: Likely to keep up or full buffer: 0
2013-01-08 21:19:29.868 MoviePlayer[30320:c07] [MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up.
2013-01-08 21:19:29.870 MoviePlayer[30320:c07] [MPAVController] Autoplay: Enabling autoplay
2013-01-08 21:19:29.871 MoviePlayer[30320:c07] [MPCloudAssetDownloadController] Prioritization requested for media item ID: 0
2013-01-08 21:19:30.964 MoviePlayer[30320:c07] [MPAVController] Autoplay: Likely to keep up or full buffer: 0
2013-01-08 21:19:30.964 MoviePlayer[30320:c07] [MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up.
2013-01-08 21:19:31.494 MoviePlayer[30320:c07] [MPAVController] Autoplay: _streamLikelyToKeepUp: 0 -> 1
2013-01-08 21:19:31.495 MoviePlayer[30320:c07] [MPAVController] Autoplay: Likely to keep up or full buffer: 1
2013-01-08 21:19:31.495 MoviePlayer[30320:c07] [MPAVController] Autoplay: Enabling autoplay

回答1:


I am also using MPMoviePlayerViewController to play live video in one of my App & I also

getting these errors but besides these errors my video is playing fine with this player.

I think there is no solution for it. If your video is working fine then ignore these warnings

or errors.




回答2:


(1) To solve the CGContextSaveGState, wrap your alloc-init in a fake graphics context, as I explain here:

iphone MPMoviePlayerViewController CGContext Errors

(2) The other messages are harmless, and are now resolved on iOS 6.1. They no longer appear.




回答3:


I also using the MPMoviePlayerViewController to live video on my app and getting same above list errors.And I found MPMoviePlayer not support larger data to show video but if you used smaller data of video is working fine its not give any error. In fact is not problem of prepare to play and play property of movie player.

If you need to show larger data then used webview on your app.



来源:https://stackoverflow.com/questions/14224476/mpmovieplayerviewcontroller-generating-lots-of-errors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!