JHLiveSDK集成
2017-04-27 本文已影响29人
Carden
SDK说明
1、SDK很大,767.3MB,客观条件限制
2、模拟器能编译SDK,但并不支持模拟器渲染直播,必须真机测试
3、编译超慢,通常把UI层和SDK逻辑层隔离开发,参照默认直播UI
4、版本支持8.0以上
5、Xcode8.1以上版本编译不通过,腾讯传输层SDK未升级导致
SDK架构

SDK集成
1、将SDK文件夹中的文件添加到Xcode工程文件中。

2、添加系统依赖库

3、确保Build Settings中’ENABLE_BITCODE’为"NO"

4、导入头文件到.pch文件

SDK使用
1、App启动时选择独立模式Or托管模式注册JHLiveSDK

2、到此为止,JHLiveSDK集成完毕,编译程序,查看控制台打印

3、如果使用自定义UI请无视下面👇的UI集成,当然要使用SDK的具体功能,需要调用登录SDK接口成功后方可进行。
* 实例单例
*/
+ (instancetype)share;
/**
* 注册九合直播
*/
-(void)registerJHLive:(AccountType)acountType;
/**
* 登录九合直播
*/
-(void)loginJHLiveAccount:(NSString*)jhLiveId TlsCode:(NSString*)jhLiveTls Response:(void(^)(BOOL success))loginBlcok;
/**
* 开始九合直播
*/
-(void)startJHLive:(JHLiveModel*)model RenderView:(UIView*)randerView Response:(void(^)(BOOL success))startBlock;
/**
* 结束九合直播
*/
-(void)stopJHLive:(void(^)(BOOL success))stopBlock;```
> # 默认UI集成
[默认直播DefaultUI下载](http://123.59.84.71:8000/weixinxian/JHLiveDefaultUI)
1、Cocodpods导入三方库,暂屏蔽表情富文本功能,如需要请确保工程已有三方库不会与YYKit冲突
platform:ios,'8.0'
target '你的应用' do
pod 'ReactiveCocoa','~>2.5'
pod 'SVProgressHUD'
pod 'MJExtension'
pod 'Masonry'
pod 'SDWebImage'
pod 'MJRefresh'
end```
2、Build Settings搜索weak设置Weak References·····为YES

2、将文件夹DefaultUI拖入工程

3、导入头文件到.pch文件

4、检查info.plist文件设置

5、present到以DefaultJHLiveController为根控制器的导航控制器
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:[DefaultJHLiveController new]];
[self presentViewController:nav animated:YES completion:nil];
}
6、以上就集成了一个无YYkit的单纯版直播Demo。如果需要完整版实现表情和富文本的版本请点击完整版本的直播Demo下载