quickblox视频聊天用户列表未加载

时间:2017-06-06 10:03:35

标签: ios objective-c swift quickblox videochat

我正在使用IOS代码进行聊天 https://github.com/QuickBlox/quickblox-ios-sdkhttps://quickblox.com/developers/Sample-webrtc-ios) 我可以在https://admin.quickblox.com/的管理面板中看到已登录的用户,但无法在模拟器中检索用户 我已经给出了正确的身份验证密钥,

[[QBRTCAudioSession instance] initializeWithConfigurationBlock:^(QBRTCAudioSessionConfiguration *configuration) {
        // adding blutetooth support
        configuration.categoryOptions |= AVAudioSessionCategoryOptionAllowBluetooth;
        configuration.categoryOptions |= AVAudioSessionCategoryOptionAllowBluetoothA2DP;

        // adding airplay support
        configuration.categoryOptions |= AVAudioSessionCategoryOptionAllowAirPlay;

        if (_session.conferenceType == QBRTCConferenceTypeVideo) {
            // setting mode to video chat to enable airplay audio and speaker only
            configuration.mode = AVAudioSessionModeVideoChat;
        }
    }];

    [self configureGUI];

    Settings *settings = [Settings instance];

    if (self.session.opponentsIDs.count == 1
        && settings.recordSettings.isEnabled) {
        // recording calls for p2p 1 to 1
        if (self.session.conferenceType == QBRTCConferenceTypeVideo) {

            [self.session.recorder setVideoRecordingRotation:settings.recordSettings.videoRotation];
            [self.session.recorder setVideoRecordingWidth:settings.recordSettings.width
                                                   height:settings.recordSettings.height
                                                  bitrate:[settings.recordSettings estimatedBitrate]
                                                      fps:settings.recordSettings.fps];
        }
        NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *documentPath = [searchPaths firstObject];
        NSString *filePath = [NSString stringWithFormat:@"%@/file_%f.mp4", documentPath, [NSDate date].timeIntervalSince1970];
        [self.session.recorder startRecordWithFileURL:[NSURL fileURLWithPath:filePath]];
    }

    if (self.session.conferenceType == QBRTCConferenceTypeVideo) {

#if !(TARGET_IPHONE_SIMULATOR)
        self.cameraCapture = [[QBRTCCameraCapture alloc] initWithVideoFormat:settings.videoFormat
                                                                    position:settings.preferredCameraPostion];
        [self.cameraCapture startSession:nil];
        self.session.localMediaStream.videoTrack.videoCapture = self.cameraCapture;
#endif
    }

    self.view.backgroundColor = self.opponentsCollectionView.backgroundColor =
    [UIColor colorWithRed:0.1465 green:0.1465 blue:0.1465 alpha:1.0];

    NSMutableArray *users = [NSMutableArray arrayWithCapacity:self.session.opponentsIDs.count + 1];
    [users insertObject:Core.currentUser atIndex:0];

    for (NSNumber *uID in self.session.opponentsIDs) {

        if (Core.currentUser.ID == uID.integerValue) {

            QBUUser *initiator = [self.usersDatasource userWithID:self.session.initiatorID.unsignedIntegerValue];

            if (!initiator) {

                initiator = [QBUUser user];
                initiator.ID = self.session.initiatorID.integerValue;
            }

            [users insertObject:initiator atIndex:0];

            continue;
        }

        QBUUser *user = [self.usersDatasource userWithID:uID.integerValue];
        if (!user) {
            user = [QBUUser user];
            user.ID = uID.integerValue;
        }
        [users insertObject:user atIndex:0];
    }

    self.users = users;

    BOOL isInitiator = (Core.currentUser.ID == self.session.initiatorID.unsignedIntegerValue);
    isInitiator ? [self startCall] : [self acceptCall];

    self.title = @"Connecting...";

1 个答案:

答案 0 :(得分:0)

对不起,这是我的错。聊天室必须对所有用户都一样。现在它有效。