在iOS上播放.m3u8文件
我有.m3u8
链接,我需要在支持HLS Protocol
iOS
上播放。
当我将URL直接分配给MPMoviePlayerController
并播放时,video不可见,但我可以听到audio。
NSURL *movieURL = [NSURL URLWithString:@"http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8"]; MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL]; [self.view addSubview:self.moviePlayer.view]; if (mp) { // save the movie player object self.moviePlayer = mp; [self.moviePlayer setFullscreen:YES]; // Play the movie! [self.moviePlayer play]; }
我需要做什么额外的东西在iOS
端?
NSURL *movieURL = [NSURL URLWithString:@"http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8"]; MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL]; if (mp) { mp.view.frame = self.view.bounds; [self.view addSubview:mp.view]; // save the movie player object [mp setFullscreen:YES]; // Play the movie! [mp play]; self.moviePlayer = mp; }