Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPMoviePlayer not playing video

MPMoviePlayer is not playing video. I'm running iOS 7 and getting the same error on the device and simulator:

2013-10-02 12:49:18.246 xxxx[688:60b] _itemFailedToPlayToEnd: {
kind = 1;
new = 2;
old = 0;

}

I've tried playing a video from the internet and file system, but no luck. My code is very straightforward:

    self.moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://stream.qtv.apple.com/events/mar/123pibhargjknawdconwecown/12oihbqeorvfhbpiubqnfv3_650_ref.mov"]];
    self.moviePlayer.view.frame = self.view.bounds;
    self.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
    [self.view addSubview:self.moviePlayer.view];
    [self.moviePlayer prepareToPlay];

The URL listed is a valid movie: http://stream.qtv.apple.com/events/mar/123pibhargjknawdconwecown/12oihbqeorvfhbpiubqnfv3_650_ref.mov

I've also tried using MPMoviePlayerViewController, but that didn't work either.

like image 614
backofthecup Avatar asked Oct 02 '13 18:10

backofthecup


1 Answers

MPMovieSourceTypeStreaming seems to be buggy on iOS 7. On my app, I'm streaming a video from the web (same as you), and the problem disappear with this source type :

self.moviePlayer.movieSourceType = MPMovieSourceTypeFile;

I know it's strange because we're streaming the video, but this is the only solution that works for me.

Hope it helps :)

like image 84
Rémy Virin Avatar answered Sep 28 '22 08:09

Rémy Virin