序言:VLC是开源的多媒体播放器,也是基于FFmpeg,而且现行的大部分常用的视频格式都可以正常解码和播放。基于编译出来的MobileVLCKit.framework,我封装了一款在线视频播放器,托管的GitHub地址:基于VLC的在线视频播放器。
- 至于MobileVLCKit.framework的编译这里就不在累述,提供两个参考博文:1.iOS中VLC的集成与简单使用
2.iOS 使用 VLC - 先上一张播放器的外形图:
IMG_1003.PNG
IMG_1005.PNG
-
项目结构:
1.png
-
播放器的使用也是非常的简单,只要初始化后提供播放的URL即可开始播放。
NSURL *url = [NSURL URLWithString:@"http://v4ttyey-10001453.video.myqcloud.com/Microblog/288-4-1452304375video1466172731.mp4"];
NSURL *bundleUrl = [[NSBundle mainBundle]URLForResource:@"YTVLCMoivePlayer" withExtension:@"bundle"];
NSBundle *myBundle = [NSBundle bundleWithURL:bundleUrl];
YTVLCMoivePlayer *player = [[YTVLCMoivePlayer alloc]initWithNibName:@"YTVLCMoivePlayer" bundle:myBundle];
// YTVLCMoivePlayer *player = [[YTVLCMoivePlayer alloc]init];
player.url = url;
[self presentViewController:player animated:YES completion:nil];
网友评论