ios开发专题

MobileVLCKit的初探

2020-03-05  本文已影响0人  zl520k

MobileVLCKit是开源的第三方视频播放器,支持播放rtsp,MP4,wavm,rsp等格式,可以在https://wiki.videolan.org/Documentation:IOS/网站上找到ios开发的资料,不过,其他平台也有,请自己取。MobileVLCKit可以自己编译也可以使用现成的sdk,进行集成,本文主要主要介绍自己手动集成过程。我主要使用库版本是:MobileVLCKit-3.3.9,如需要其他版本,可以自行去MobileVLCKit-3.3.9网站下载。

1、将MobileVLCKit导入到工程中

2、添加MobileVLCKit所依赖的库,库如下:

AudioToolbox.framework、VideoToolbox.framework、CoreMedia.framework、CoreVideo.framework、CoreAudio.framework、AVFoundation.framework、MediaPlayer.framework

下面是依赖tbd库如下:

libstdc++.6.0.9.tbd、libiconv.2.tbd、libc++.1.tbd、libz.1.tbd、libbz2.1.0.tbd

集成过后,如果运行没有问题,就可以添加代码,进行简单的播放文件,我是播放简单的MP4文件,

导入头文件:<MobileVLCKit/MobileVLCKit.h>

@interface ViewController ()

@property (nonatomic, strong) VLCMediaPlayer *player;

@end

- (void)viewDidLoad {

    [super viewDidLoad];

    UIView*videoView = [[UIViewalloc]initWithFrame:CGRectMake(0,100,self.view.bounds.size.width,220)];

    [self.viewaddSubview:videoView];

    self.player = [[VLCMediaPlayer alloc] initWithOptions:nil];

    self.player.drawable= videoView;

    self.player.media = [VLCMedia mediaWithPath:[[NSBundle mainBundle] pathForResource:@"123" ofType:@"mp4"]];

    [self.player play];

    // Do any additional setup after loading the view, typically from a nib.

}

这样就可以播放MP4文件。其他功能后续在待续。

参考资料:

官网地址:http://www.videolan.org/

https://wiki.videolan.org/Documentation:IOS/

https://blog.csdn.net/chen_iven/article/details/72833236

上一篇下一篇

猜你喜欢

热点阅读