-
Notifications
You must be signed in to change notification settings - Fork 271
StaticDecalsStream
jiangdsuccess edited this page Mar 15, 2018
·
2 revisions
在直播过程中,主播可以使用贴纸功能,将选中的静态贴纸与摄像头画面合成后,一起推送给观众端,该功能从v2.5.1版本引入
- 先构造kit类的实例
KSYGPUStreamerKit *kit = [[KSYGPUStreamerKit alloc] initWithDefaultCfg];
//贴纸页面(贴纸列表view在贴纸页面创建的时候就会添加到这个图层上)
_colView = [[KSYCollectionView alloc] init];
_colView.frame = self.view.frame;
//贴纸组合view
_decalBGView = [[KSYDecalBGView alloc] init];
_decalBGView.frame = self.view.frame;
[_colView addSubview:_decalBGView];
//单个贴纸view
_decalView = [[KSYDecalView alloc] initWithImage:image];
[_decalBGView addSubview: _decalView];
用户在贴纸界面选定贴纸后,可通过回调函数对贴纸进行旋转、缩放和删除操作
@property (nonatomic, copy)void(^DEBlock)(NSString *imgName);
_kit.aePic = [[GPUImageUIElement alloc] initWithView:_decalBGView];
每次贴纸操作完成后,推流贴纸图层刷新一次
[_kit startPreview:self.view];
NSString *rtmpSrv = @"rtmp://test.uplive.ksyun.com/live/888";
NSURL* _hostURL = [[NSURL alloc] initWithString:rtmpSrv];
[_kit.streamerBase startStream:_hostURL];
[_kit.streamerBase stopStream];
[_kit stopPreview];