新建⽇期: 2023-7-24 修改⽇期: 2023-7-24
IOS系统最低版本:IOS12
开发⼯具: Xcode
详细⻅GJDigitalSDKDemo⽬,关键代码样例:
//获取的token
[DigitalLiveConfig shareConfig].token=[ConfigManager manager].token;//从后端接口获取的token
[DigitalLiveConfig shareConfig].sessionId= sessionId;//会话ID //从后端接口获取
[DigitalLiveConfig shareConfig].userName=[ConfigManager manager].mqttUser;//MQTT连接用户名 //从后端接口获取
[DigitalLiveConfig shareConfig].userPassword=[ConfigManager manager].mqttPassword;//MQTT连接密钥 //从后端接口获取
[DigitalLiveConfig shareConfig].serverIP=MQTTURL;//MQTT连接地址
[DigitalLiveConfig shareConfig].auidoType=self.audioType;//0 录音模式 1 音频文件发送buffer
NSLog(@"self.audioType:%ld",self.audioType);
[DigitalLiveConfig shareConfig].topicPub=topicPub;//客户端发送topic //从后端接口获取
[DigitalLiveConfig shareConfig].topicSub=topicSub;////客户端接收topic //从后端接口获取
[DigitalLiveConfig shareConfig].sequence=self.scence_model.videoCoverUrl;;//数字人场景视频地址
[DigitalLiveConfig shareConfig].udCode= self.scence_model.sceneCode;//数字人场景code
[DigitalLiveConfig shareConfig].greenType=1;//绿幕背景
[DigitalLiveConfig shareConfig].liveId=self.listModel.Id;//直播间ID
[DigitalLiveManager manager].remote_view=self.remotView;//远程视频
[DigitalLiveManager manager].delegate=self;//代理
[[DigitalLiveManager manager] toStart];//开始MQTT通讯
/*
* 开始初始化通讯并且是否开启本地摄像头
*/
-(void)toStart;
/*
* 结束通讯
*/
-(void)toStop;
/*
*打开本地摄像头
*/
- (void)toOpenCamera;
/*
*关闭本地摄像头
*/
-(void)toStopCamera;
/*
*ES静音 NO非静音
*/
-(void)setMute:(BOOL)isEnabled;
/*
*开始推流
*/
-(void)toStartPushtoproxy;
/*
*发送本地音频或网络音频的buffer给webrtc
*/
-(void)deliverRecordedData:(CMSampleBufferRef)sampleBuffer;
@protocol DigitalLiveDelegate <NSObject>
@optional
/*
*错误信息返回码
*/
- (void)onError:(NSInteger)error_code;
/*
*远程视频通讯完成
*/
- (void)onRTCReomteSuccess;
/*
*中控获取不到渲染端信息后通知客户端繁忙
*/
- (void)onBusy;
/*
*中控结束通话,发送bye事件
*/
- (void)onByeBye;
/*
*是否成功加载数字人
*/
- (void)onVideoShow:(BOOL)isSuccess :(float)progress;
/*
*获取本地视频的视频流
*/
- (void)capturer:(RTCVideoCapturer *)capturer didCaptureVideoFrame:(RTCVideoFrame *)frame;
/*
*中控返回的所有json字典
*/
-(void)onMessageDic:(NSDictionary*)messageDic;
@end