我有.m3u8
链接,我需要在支持iOS
的{{1}}上播放。
当我直接将网址分配给HLS Protocol
并播放时,视频不可见,但我可以听到音频。
MPMoviePlayerController
我需要在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];
}
方做些什么其他的事情?
答案 0 :(得分:10)
导入:
#import <MediaPlayer/MediaPlayer.h>
然后做:
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;
}