第二台设备无法进行视频通话
Posted
技术标签:
【中文标题】第二台设备无法进行视频通话【英文标题】:Second device doesn't get video call 【发布时间】:2014-03-28 23:23:33 【问题描述】:我正在使用 QuickBlox 从一台设备向另一台设备发起视频通话。 这是我在拨打电话的设备上的代码:
开启viewDidLoad
:
- (void)viewDidLoad
[super viewDidLoad];
self.videoChat = [[QBChat instance] createAndRegisterVideoChatInstance];
self.videoChat.viewToRenderOpponentVideoStream = self.otherUserView;
self.videoChat.viewToRenderOwnVideoStream = self.selfView;
QBASessionCreationRequest *extendedAuthRequest = [QBASessionCreationRequest request];
extendedAuthRequest.userLogin = USERNAME
extendedAuthRequest.userPassword = PASSWORD
[QBAuth createSessionWithExtendedRequest:extendedAuthRequest delegate:self];
已创建会话
#pragma mark - QBActionStatusDelegate
- (void)completedWithResult:(Result *)result
if(result.success && [result isKindOfClass:QBAAuthSessionCreationResult.class])
// Success, You have got User session
QBAAuthSessionCreationResult *res = (QBAAuthSessionCreationResult *)result;
QBUUser *currentUser = [QBUUser user];
currentUser.ID = res.session.userID;
currentUser.password = PASSWORD
// set Chat delegate
[QBChat instance].delegate = self;
// login to Chat
[[QBChat instance] loginWithUser:currentUser];
登录聊天
(void) chatDidLogin
// You have successfully signed in to QuickBlox Chat
[NSTimer scheduledTimerWithTimeInterval:30 target:[QBChat instance] selector:@selector(sendPresence) userInfo:nil repeats:YES];
拨打电话:
- (IBAction)callUser:(id)sender
[QBChat instance].delegate = self;
[self.videoChat callUser:USERID conferenceType:QBVideoChatConferenceTypeAudioAndVideo];
接听电话
我已经检查过了。用户已登录聊天,我尝试调用的 ID 是正确的,并且其他用户也已登录聊天,但这永远不会被调用:
-(void) chatDidReceiveCallRequestFromUser:(NSUInteger)userID withSessionID:(NSString *)_sessionID conferenceType:(enum QBVideoChatConferenceType)conferenceType
self.videoChat = [[QBChat instance] createAndRegisterVideoChatInstanceWithSessionID:_sessionID];
//
[self.videoChat acceptCallWithOpponentID:userID conferenceType:conferenceType];
【问题讨论】:
【参考方案1】:这就是答案,我太早地创建了QBVideoChat
对象。我在登录聊天后创建了它
-(void) chatDidLogin
// You have successfully signed in to QuickBlox Chat
[NSTimer scheduledTimerWithTimeInterval:30 target:[QBChat instance] selector:@selector(sendPresence) userInfo:nil repeats:YES];
self.videoChat = [[QBChat instance] createAndRegisterVideoChatInstance];
self.videoChat.viewToRenderOpponentVideoStream = self.otherUserView;
self.videoChat.viewToRenderOwnVideoStream = self.selfView;
【讨论】:
以上是关于第二台设备无法进行视频通话的主要内容,如果未能解决你的问题,请参考以下文章
如何将移动发起的视频通话与基于 Web 的 [node.js] 视频通话集成?
React 原生 firebase+webrtc 进行视频通话