Vip*_*p's 7 video http-live-streaming ios m3u8
我有.m3u8链接,我需要发挥iOS支持HLS Protocol.
当我直接将URL分配给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];
}
Run Code Online (Sandbox Code Playgroud)
我还需要做些iOS什么?
iCo*_*der 10
进口:
#import <MediaPlayer/MediaPlayer.h>
Run Code Online (Sandbox Code Playgroud)
然后做:
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;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12515 次 |
| 最近记录: |