其实和视频播放类似。只不过我们需要放网络地址
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
AVPlayerViewController *avc = [[AVPlayerViewController alloc] init];
//把视频的uid添加到这个地址里面
NSString *path = [NSString stringWithFormat:@"http://hls.quanmin.tv/live/%@/playlist.m3u8", @"2064317"];
//方法1
// avc.player = [AVPlayer playerWithURL:[NSURL URLWithString:path]];
//方法2
avc.player = [[AVPlayer alloc]initWithURL:[NSURL URLWithString:path]];
[avc.player play];
[self presentViewController:avc animated:YES completion:nil];
}
效果如下: