-
Notifications
You must be signed in to change notification settings - Fork 479
Use AriaContorlLayer
changsanjiang edited this page Nov 22, 2019
·
3 revisions
- 设置
Product Name
为工程名称 - 设置
Product Model Name
名称 - 创建
工程名-Swift.h
文件 - 创建
工程名-Bridging.h
文件 - 设置
Objective-C Generated Interface Header Name
- 设置
Defines Model
为YES
- 将
AriaVideoControlLayer
文件夹整个拖入工程
#import "SJVideoPlayer.h"
#import "SJUIKit.h"
#import "SJEdgeControlLayerAdapters.h"
#import "SJReachability.h"
#import "SJProgressSlider.h"
#import "UIView+SJAnimationAdded.h"
#import "SJEdgeControlLayerSettings.h"
#import "SJNetworkLoadingView.h"
#import "SJBarrageItem.h"
#import "SJVideoPlayerDraggingProgressView.h"
#import "SJTimerControl.h"
pod 'Then'
pod 'SnapKit'
pod 'RxSwift'
pod 'RxDataSources'
// 在需要使用控制层的地方引入该头文件
// ${Product Model Name}为第一步设置的名称
#import "${Product Model Name}-Swift.h"
// 添加控制层
[_player.switcher addControlLayerForIdentifier:${Identifier} lazyLoading:^id<SJControlLayer> _Nonnull(SJControlLayerIdentifier identifier) {
AriaVideoControlLayer *controlLayer = [[AriaVideoControlLayer alloc] init];
return controlLayer;
}];
// 切换控制层
// ${Identifier} 如果为 LONG_MAX - 1 则为直接替换默认控制层无需切换
[_player.switcher switchControlLayerForIdentitfier:${Identifier}];
- 将
AriaVideoControlLayer
文件夹整个拖入工程
// 添加控制层
player.switcher.addControlLayer(forIdentifier: ${Identifier}) { (id) -> SJControlLayer in
return AriaVideoControlLayer()
}
// 切换控制层
// ${Identifier} 如果为 LONG_MAX - 1 则为直接替换默认控制层无需切换
player.switcher.switchControlLayer(forIdentitfier: ${Identifier})
pod 'Then'
pod 'SnapKit'
pod 'RxSwift'
pod 'RxDataSources'
- currentPlayIndex: 当前播放索引,默认为0
- playListCount: 当前播放列表总数
- playTheIndexBlock: 点击选集控制层选择对应集数后的回调,返回Int索引
- shareBlock: 全屏时右上角分享按钮回调
当不设置playTheIndexBlock时设置currentPlayIndex与playListCount无任何意义 currentPlayIndex与playListCount设置后在播放下一集时需要手动更新一下currentPlayIndex