Search code examples
xcodeios7mpmovieplayer

MPMoviePlayerController failed to play .m3u8 video file


i am trying to play some .m3u8 video file using the MPMoviePlayerController, i have this code:

NSURL *url = [NSURL URLWithString:
                       @"http://live.cdn.antel.net.uy/auth_0_u2anqw7k;vxttoken=cGF0aFVSST0lMkZhdXRoXzBfdTJhbnF3N2slMkZobHMlMkYlMkEmZXhwaXJ5PTEzOTkwOTc1OTImcmFuZG9tPThMRzVzYmlGRlgsMTRlN2FhMzVlOWM5ZDc0M2MyYmZiOWQ2OWU4ZGU1MDJkOTFhYjQwZWMxZmI1ZmUzNTg3OGMxMWQ4ZjU5YTllNg==/hls/auth_0_u2anqw7k.m3u8"];
MPMoviePlayerController *controller = [[MPMoviePlayerController alloc]
                                       initWithContentURL:url];

streamPlayer = controller; 

controller.view.frame = CGRectMake(0, 0, 320,568); //Set the size

[self.view addSubview:controller.view]; //Show the view
[controller play]; //Start playing

But when i run this i receive this console message:

_itemFailedToPlayToEnd: {
kind = 1;
new = 2;
old = 0;
}

I have run the url from the video in the VLC player and works fine so i supposed that the url is not the problem. If i change the url to "http://www.thumbafon.com/code_examples/video/segment_example/prog_index.m3u8" its works fine.

Please help me to resolve that, i am open to change my code using another video player or any changes that works.

Thanks!


Solution

  • I found the solution the ";" character made some conflict, it works if i replace the ";" in te url with a ",".