导入文件后直接调用一下代码即可,其中报错的代码和文件以及方法可以根据自己需要进行删除
__weak typeof(self) weakSelf = self;
SelPlayerConfiguration *configuration = [[SelPlayerConfiguration alloc]init];
configuration.shouldAutoPlay = YES; //自动播放
configuration.supportedDoubleTap = YES; //支持双击播放暂停
configuration.shouldAutorotate = YES; //自动旋转
configuration.repeatPlay = NO; //重复播放
configuration.statusBarHideState = SelStatusBarHideStateAlways; //设置状态栏隐藏
configuration.sourceUrl = self.url?self.url: (self.islocal?[NSURL fileURLWithPath:self.videoUrl]: [NSURL URLWithString:self.videoUrl]); //设置播放数据源
configuration.videoGravity = SelVideoGravityResizeAspect; //拉伸方式
configuration.defalutPlayTime = self.lastPlayTime;
_player = [[SelVideoPlayer alloc]initWithFrame:CGRectMake(0, 0, DR_SCREEN_WIDTH, DR_SCREEN_WIDTH*9/16) configuration:configuration];
_player.currentPlayTimeBlock = ^(NSInteger currentTime) {
if (weakSelf.currentPlayTimeBlock) {
weakSelf.currentPlayTimeBlock(currentTime);
}
};
[self.view addSubview:_player];