17

I'm having trouble on make my app(music and video stream player) running on iOS 6 simulator.

When I start a music ou video it crashes showing an error on this thread: com.apple.coremedia.networkbuffering

and this on log info:

2012-09-13 17:45:09.260 app[32563:c07] [MPAVController] Autoplay: Disabling autoplay for pause
2012-09-13 17:45:09.260 app[32563:c07] [MPAVController] Autoplay: Disabling autoplay
2012-09-13 17:45:09.305 app[32563:c07] [MPAVController] Autoplay: Enabling autoplay
2012-09-13 17:45:09.307 app[32563:c07] handlePlaybackNowPlayingNotification
2012-09-13 17:45:09.308 app[32563:c07] [MPAVController] Autoplay: Likely to keep up or full buffer: 0
2012-09-13 17:45:09.308 app[32563:c07] [MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up.
2012-09-13 17:45:09.318 app[32563:c07] [MPAVController] Autoplay: Enabling autoplay
2012-09-13 17:45:09.320 app[32563:c07] [MPCloudAssetDownloadController] Prioritization requested for media item ID: 0

I'm using MPMoviePlayerController with http based stream, and it works fine on iOS 4 or iOS 5

Any ideas on how to fix it?

jMelnik
  • 1,055
  • 2
  • 15
  • 26

9 Answers9

15

I was having the exact same problem...

try to do this just after you instantiate your player:

[player prepareToPlay];

It should be called automatically when you call play but apparently on iOS 6 something goes wrong if you don't call it explicitly.

In my case it solved the problem.

ortnec
  • 327
  • 2
  • 5
  • Solved the problem for me as well. Beforehand I wasn't getting the `moviePlayerLoadStateChanged` notifications, now I am. – eli Sep 24 '12 at 13:44
  • Yep, that seems to solve the problem, I added that line and until now no more errors like tha. Thank you – jMelnik Sep 24 '12 at 14:22
  • 10
    I added this line but am still getting errors similar to the ones in the OP's question. Any ideas? – WendiKidd Sep 27 '12 at 22:52
13

What you are observing is not a crash but an exception. You most likely have an exception breakpoint enabled and that leads you to the assumption that the app crashes.

That exception actually is properly handled (cought) by the SDK and does not cause an app crash.

Please note that this is only happening on the simulator, not on the device.

The issue is closely related to this issue what-does-this-gdb-output-mean. The difference is that you won't get those error messages anymore but the exception's still are thrown (but also cought).

Community
  • 1
  • 1
Till
  • 27,559
  • 13
  • 88
  • 122
  • 1
    I have a better solution that lets you keep the all exceptions! Right click and edit it, and then under Exception chose Objective-C. If you're trying to actually debug C++ then this isn't great, but if you're an ordinary iOS app Objective-C is all you need! The movie player is throwing a C++ exception so this annoyance goes away!! – Aaron Zinman Apr 08 '15 at 03:03
5

i have verified using xcode 4.5+SDK6.0 versus xcode 4.4.1+SDK5.1 combinations that there is an issue with ios 6 version of the MPMoviePlayerController. i have only worked with iPads though.

here are my observations:- - i have never seen the video play on ios 6.0 with my code that uses MPMoviePlayerController. - with xcode 4.4.1 and SDK 5.1, i have seen the code work on ios versions 5.1, 5.0 and 4.3. - with xcode 4.5 and SDK 6.0, the player always fails in the simulator, but most installations on ios 5.1 device work. i kept reinstalling the app on ios 5.1 device and trying out the player. it only failed once.

here are my observations when the player failed: - some times when the player failed, i saw the logs that you mentioned above. other times, i didnt even see the logs. - i put a breakpoint in the function that got the MPMoviePlayerPlaybackDidFinishNotification notification. then i looked for the errorLog in the player and there was none. i looked for MPMoviePlayerPlaybackDidFinishReasonUserInfoKey and it was 0 (MPMovieFinishReasonPlaybackEnded). so MPMoviePlayerController had no clue anything had gone wrong!

conclusion: ios6 and/or SDK 6 have got a bug.

vivandro
  • 51
  • 3
2
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"sample" ofType:@"mp4"]];
MPMoviePlayerViewController  *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:url];



moviePlayer.view.frame = self.view.frame;
moviePlayer.moviePlayer.shouldAutoplay=YES;
moviePlayer.moviePlayer.controlStyle = MPMovieControlStyleNone;
[moviePlayer.moviePlayer setFullscreen:YES animated:YES];
[self.view addSubview:moviePlayer.view];
[moviePlayer.moviePlayer play];

Note : Before iOS 6, no need to call [moviePlayer.moviePlayer play]; once you add player view to a view it will start to play but in iOS 6, you need to call play function explicitly

Noufal Kmc
  • 2,020
  • 3
  • 15
  • 20
1

i am having the same issue with MPMoviePlayerController for ios6. So i changed my code to fllowing and now it is working fine..

NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"sample" ofType:@"mp4"]];
MPMoviePlayerViewController  *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:url];



moviePlayer.view.frame = self.view.frame;
moviePlayer.moviePlayer.shouldAutoplay=YES;
moviePlayer.moviePlayer.controlStyle = MPMovieControlStyleNone;
[moviePlayer.moviePlayer setFullscreen:YES animated:YES];
[self.view addSubview:moviePlayer.view];
[moviePlayer.moviePlayer play];
Vikas S Singh
  • 1,748
  • 1
  • 14
  • 29
Hashim MH
  • 1,576
  • 1
  • 15
  • 29
0

I have not solved this problem yet, but it seems to be related in my particular case when MPMoviePlayerController is going to enter full screen, or when there is a potential lag for the controller.

I am not streaming content from the web, the content is on the device, so initially the content displays fine in the view.

My guess is that they have implemented a new feature into MPMoviePlayerController to prevent "dead time" during playback. I have seen some apps that just hang when the movie data goes offline or you happen to walk out of range of your wifi"

My attempt to resolve this issue will be to look at the notification message passed to -

(void)moviePlayBackDidFinish: (NSNotification*)notification

this is done by querying the user info dictionary

NSDictionary *userInfo = [notification userInfo];

the value for MPMoviePlayerPlaybackDidFinishReasonUserInfoKey is 0 in the case of this type of failure.

It's a starting point. My thought is to re-instate the movie at this point on this unique failure.

I will keep you posted on the results.

hol
  • 8,255
  • 5
  • 33
  • 59
0

first I had done something like below

[self.player.moviePlayer prepareToPlay];
[self.player.moviePlayer play];
self.player.moviePlayer.shouldAutoplay = YES;

and when i deleted the below line

self.player.moviePlayer.shouldAutoplay = YES;

problem was solved.

anuj arora
  • 831
  • 12
  • 22
mirror
  • 345
  • 3
  • 10
0

I'm having problem with the code below, the player goes on full screen, but right after that, it closes and doesn't play the video at all.

NSURL *url = [NSURL URLWithString:@"http://streaming.disponivel.uol.com.br/video360p2/288148-1192657.mp4"];

    _player = [[MPMoviePlayerViewController alloc] initWithContentURL:url];

    [_player.moviePlayer setMovieSourceType:MPMovieSourceTypeFile];

    [_player.moviePlayer setControlStyle:MPMovieControlStyleDefault];

    [_player.moviePlayer setFullscreen:YES animated:YES];      

    [self presentMoviePlayerViewControllerAnimated:_player];

    [_player.moviePlayer prepareToPlay];

    [_player.moviePlayer play];
Anderson Bressane
  • 378
  • 1
  • 5
  • 15
0

I am also using the MPMoviePlayerViewController to show live video on my app and I'm getting the same list of errors as above. I've found that MPMoviePlayer does not support larger data to show video but if you use smaller video data it works fine, throwing no errors. In fact it is not a problem of prepare to play and play properties of movie player.

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

Cezar
  • 55,636
  • 19
  • 86
  • 87
Gopal vaid
  • 376
  • 3
  • 7