id X 的 QBWebRTC 目前正忙? QB.webrtc.onRemoteStreamListener 没有开火。 Quickblox Javascript SDK + angular + WebRTC

QBWebRTC with id X is busy at the moment? QB.webrtc.onRemoteStreamListener is not firing. Quickblox Javascript SDK + angular + WebRTC

我按照文档看了三遍了,还是不能接电话。这是代码:

$scope.occupants = [6184, 6186];
$scope.session = QB.webrtc.createNewSession($scope.occupants, QB.webrtc.CallType.VIDEO);
$scope.localMediaParams = {
    audio: true,
    video: true,
    options: {
        muted: true,
        mirror: true
    },
    elemId: 'localVideoEl',
    optional: {
        minWidth: 240,
        maxWidth: 320,
        minHeight: 160,
        maxHeight: 240
    }
};

$scope.startCall = function() {
    if (angular.equals($scope.recipients, {})) {
        alert('Please choose a person to call');
    }else {
        if (angular.equals($scope.session, {})) {
            console.log('session hasn\'t been started');
            $scope.session.stop({});
            $scope.session = {};
            return false;
        }else {
            $scope.session.getUserMedia($scope.localMediaParams, function(err, stream) {
                if (err){
                    console.log(err);
                }else{
                    console.log(stream);
                    $scope.session.call({}, function(error) {
                        console.log(error);
                    });
                }
            });
        }
    }
};
$scope.answerCall = function() {
    $scope.session.getUserMedia($scope.localMediaParams, function(err, stream) {
        if (err){
            console.log(err);
            $scope.session.stop({});
        }else{
            console.log(stream);
            $scope.session.accept({});
        }
    });
};
QB.webrtc.onRemoteStreamListener = function(session, userID, remoteStream) {
    // attach the remote stream to DOM element
    console.log('onRemoteStreamListener');
    console.log($scope.session);
    $scope.session.attachMediaStream('remoteVideoEl', remoteStream);
};

我有两个 ID 为 6184 和 6186 的用户。我正在从用户 6186 发起呼叫,控制台显示如下:

[QBWebRTC]: RTCPeerConnection init. userID: 6186, sessionID: 7e7ea17c-a207-4af0-82e1-744fbcce830e, type: offer
telemed.js:432 null
quickblox.min.js:86149 [QBWebRTC]: getAndSetLocalSessionDescription success
quickblox.min.js:86149 [QBWebRTC]: _startDialingTimer, dialingTimeInterval: 5000
quickblox.min.js:86149 [QBWebRTC]: _dialingCallback, answerTimeInterval: 0
quickblox.min.js:86149 [QBWebRTC]: getAndSetLocalSessionDescription success
quickblox.min.js:86149 [QBWebRTC]: _startDialingTimer, dialingTimeInterval: 5000
quickblox.min.js:86149 [QBWebRTC]: _dialingCallback, answerTimeInterval: 0
quickblox.min.js:86149 [QBWebRTC]: onCall. UserID:6186. SessionID: 7e7ea17c-a207-4af0-82e1-744fbcce830e
quickblox.min.js:86149 [QBWebRTC]: onReject. UserID:6184. SessionID: 7e7ea17c-a207-4af0-82e1-744fbcce830e
quickblox.min.js:86149 [QBWebRTC]: _clearDialingTimer
quickblox.min.js:86149 [QBWebRTC]: All peer connections closed: false
quickblox.min.js:86149 [QBWebRTC]: onIceConnectionStateCallback: closed
quickblox.min.js:86149 [QBWebRTC]: _dialingCallback, answerTimeInterval: 5000
quickblox.min.js:86149 [QBWebRTC]: onCall. UserID:6186. SessionID: 7e7ea17c-a207-4af0-82e1-744fbcce830e
quickblox.min.js:86149 [QBWebRTC]: Stop, extension: {}
quickblox.min.js:86149 [QBWebRTC]: _close
quickblox.min.js:86149 [QBWebRTC]: _clearDialingTimer
quickblox.min.js:86149 [QBWebRTC]: onIceConnectionStateCallback: closed

现在在应答端,我看到正在生成一个呼叫,但随后它说发起呼叫者正忙:

[QBWebRTC]: onCall. UserID:6186. SessionID: 7e7ea17c-a207-4af0-82e1-744fbcce830e
quickblox.min.js:86149 [QBWebRTC]: User with id 6186 is busy at the moment.
quickblox.min.js:86149 [QBWebRTC]: onStop. UserID:6186. SessionID: 7e7ea17c-a207-4af0-82e1-744fbcce830e

谁能告诉我这是怎么回事,为什么 QB.webrtc.onRemoteStreamListener 没有在应答端触发?

还有一件事:

在我点击结束通话后,我收到了这个错误,我也不明白,因为它的英语也很糟糕:

[QBWebRTC]: onStop. UserID:6186. SessionID: 7e7ea17c-a207-4af0-82e1-744fbcce830e
quickblox.min.js:86161 [QBWebRTC]: Ignore 'onStop', there is no information about session 7e7ea17c-a207-4af0-82e1-744fbcce830e by some reason.

I am initiating the call from User 6186 and the console

您不必在占用者中列出您当前用户的 ID:

所以而不是

$scope.occupants = [6184, 6186];

你应该使用

$scope.occupants = [6184];

我无法接听电话的原因是我没有附加来自 QB.webrtc.onCallListener 侦听器的流。

QB.webrtc.onCallListener = function(session, extension) {
            $scope.session = session;
            console.log('User '+session.currentUserID+' is calling');
        };

该文档未能解释占用者数组中需要包含哪些用户,以及当流到达该侦听器后您应该如何处理流。从 angular 的角度来看,如果您没有将 QB.webrtc.onCallListener 流附加到会话或 $scope.session 对象,您应该得到 $scope.session 或会话未定义。同样,正如 Igor 指出的那样,您不应将您的用户 ID 包含在 occupants 数组中。