"TalkfunLive.h"(直播间相关方法)
1.初始化大班sdk
self.liveManager = [TalkfunLive shareInstance];
self.liveManager.delegate = self;
TalkfunLiveInitParams *params = [[TalkfunLiveInitParams alloc]init];
params.courseID = self.model.course_id;
[self.liveManager enterRoom:params];
2.开始直播
[self.liveManager startLive:^(NSDictionary* data) {
if ([data[@"code"] intValue] == TalkfunCloudLiveCodeSuccess) {
}
else
{
if ([data[@"code"] intValue] == TalkfunCloudLiveCodeInTheLive) {
[weakSelf.view alert:@"不能进行直播" message:data[@"msg"]];
}
else{
[weakSelf createDismissTimerWithTitle:data[@"msg"]];
}
}
}];
其它事件使用同理 ....................
监听事件示例 (on:callback:)
- (void)on:(NSString *)event callback:(void (^)(id result))callback;
监听初始化房间信息事件示例 (on:callback:)
[self.liveManager on:TALKFUN_EVENT_ROOM_INIT callback:^(id result) {
NSLog(@"%@:%@",TALKFUN_EVENT_ROOM_INIT,result);
}];
聊天信息示例 (emit:params:callback:)
[self.liveManager emit:TALKFUN_EVENT_CHAT_SENT params:parameter callback:^(id result) {
if ([result[@"code"] intValue] == TalkfunCloudLiveCodeSuccess) {
[[NSNotificationCenter defaultCenter] postNotificationName:TALKFUN_NOTIFICATION_CHAT_SEND object:nil userInfo:result[@"data"]];
}
}];
监听违规直播时的回调示例 (on:callback:)
[self.liveManager on:TALKFUN_EVENT_ZHUBO_KICKED callback:^(id result) {
//结束直播
[weakSelf.liveManager stop:^(id result) {
//提示
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf presentViewController:weakSelf.caveat animated:YES completion:nil];
});
}];
}];
其它事件监听使用同理 ....................
```