0

I am not sure what code to add, so let me know what you need to see. I am using MPMoviePlayer in conjunction with Widevine. I am having an issue where the movie stops playing. I check the MoviePlaybackStates and rarely, if ever does it catch. Most of the time it just stops. I want to believe it has something to do with buffering. I am streaming the video, and widevine callbacks gives me no errors. Any ideas how I can track this down or what the issue is?

linuxer
  • 523
  • 2
  • 4
  • 22

1 Answers1

0

You should follow loadState instead of playbackState. The way to do it is to observe MPMoviePlayerLoadStateDidChangeNotification notification, to see how's that buffering going.

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loadStateChanged:) name:MPMoviePlayerLoadStateDidChangeNotification object:nil];

somewhere before initializing your player.

and

-(void)loadStateChanged:(NSNotification *)notif
{

    NSString *loadState=@"";
    switch (self.player.loadState) {
        case MPMovieLoadStateUnknown: {
            loadState=@"MPMovieLoadStateUnknown";

            break;
        }
        case MPMovieLoadStatePlayable: {
            loadState=@"MPMovieLoadStatePlayable";

            break;
        }
        case MPMovieLoadStatePlaythroughOK: {
            loadState=@"MPMovieLoadStatePlaythroughOK";

            break;
        }
        case MPMovieLoadStateStalled: {

            loadState=@"MPMovieLoadStateStalled";
            break;
        }

    }
NSLog(@"%@", loadState);

}
M. Porooshani
  • 1,797
  • 5
  • 34
  • 42