【问题标题】: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];


}

【问题讨论】:

    标签: ios iphone objective-c cocoa-touch quickblox


    【解决方案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;
     }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多