序言: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];