我正在使用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];
}
答案 0 :(得分:0)
所以答案就是,我过早地创建了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;
}