在Cordova Android上建立会话后,OpenTok无法添加订户视频

br0*_*at0 5 javascript android webrtc cordova

问题

建立OpenTok会话后,设备的订户视频未添加到dom元素。

预期行为

OpenTok session收到streamCreated事件后:

  • 将会话订阅到event.stream
  • 传入目标dom元素,
  • 提供订户的属性,以及
  • 提供回调

应该初始化订阅者流,并用视频流填充提供的dom元素;如果在订阅过程中发生错误,则失败。

this.session.on({
    streamCreated: event => {
        console.log('----- Event Stream: ', event.stream);

        let subscriberProperties = {
            width: '100%',
            height: '100%',
            insertMode: 'append'
        };

        this.subscriber = this.session.subscribe(event.stream, 'subscriberContainer', subscriberProperties, err => {
            if (err) {
                console.log('----- Subscriber subscribe error: ', err);
            }
            else {
                console.log('----- Subscriber added.....');
            }
        });
    }
});
Run Code Online (Sandbox Code Playgroud)

实际行为

streamCreated触发并创建流。OpenTok发出警告:

RTCIceServer.url is deprecated, please use RTCIceServer.urls instead.
Run Code Online (Sandbox Code Playgroud)

其次是这些错误:

Error while setting RemoteDescription
Run Code Online (Sandbox Code Playgroud)

-

DOMException: Failed to set remote offer sdp: Session error code: ERROR_CONTENT. Session error description: rtcpMuxPolicy is 'require', but media description does not contain 'a=rtcp-mux'..
Run Code Online (Sandbox Code Playgroud)

-

PeerConnection.offerProcessor Error while setting RemoteDescription: OperationError: Failed to set remote offer sdp: Session error code: ERROR_CONTENT. Session error description: rtcpMuxPolicy is 'require', but media description does not contain 'a=rtcp-mux'.. in state
{
     connectionState: undefined,
     iceConnectionState: "new",
     iceGatheringState: "new",
     signalingState: "have-remote-offer"
}
Run Code Online (Sandbox Code Playgroud)

-

OT.exception :: title: Connection Failed (1013) msg: OT.Subscriber PeerConnection Error: PeerConnection.offerProcessor Error while setting RemoteDescription: OperationError: Failed to set remote offer sdp: Session error code: ERROR_CONTENT. Session error description: rtcpMuxPolicy is 'require', but media description does not contain 'a=rtcp-mux'..
Run Code Online (Sandbox Code Playgroud)

-

Unhandled rejection null
Run Code Online (Sandbox Code Playgroud)

-

OT_SET_REMOTE_DESCRIPTION_FAILED: SetRemoteDescription: Subscriber PeerConnection with connection (not found) failed: PeerConnection.offerProcessor Error while setting RemoteDescription: OperationError: Failed to set remote offer sdp: Session error code: ERROR_CONTENT. Session error description: rtcpMuxPolicy is 'require', but media description does not contain 'a=rtcp-mux'..
Run Code Online (Sandbox Code Playgroud)

订阅错误返回为:

{
    code: 1501,
    message:"SetRemoteDescription: Subscriber PeerConnection with 
        connection (not found) failed: 
        PeerConnection.offerProcessor Error while setting 
        RemoteDescription: OperationError: Failed to set remote offer 
        sdp: Session error code: ERROR_CONTENT. Session error 
        description: rtcpMuxPolicy is 'require', but media description 
        does not contain 'a=rtcp-mux'.."
    name:"OT_SET_REMOTE_DESCRIPTION_FAILED"
    stack:"Error: SetRemoteDescription: Subscriber PeerConnection with 
        connection (not found) failed: PeerConnection.offerProcessor 
        Error while setting RemoteDescription: OperationError: Failed 
        to set remote offer sdp: Session error code: ERROR_CONTENT.                         
        Session error description: rtcpMuxPolicy is 'require', but                         
        media description does not contain 'a=rtcp-mux'..?    at 
        file:///android_asset/www/src/scripts/opentok.min.js:1:365616    
        at S.it 
        (file:///android_asset/www/src/scripts/opentok.min.js:1:545734)    
        at 
        file:///android_asset/www/src/scripts/opentok.min.js:1:252654
}
Run Code Online (Sandbox Code Playgroud)

网络和设备上的发布者都发送传出的流并正确建立。Web订户正确地从设备接收流并建立。设备订户不接收该流,错误并从未建立。

笔记

流出的流很好。建立两个发布者流,并建立Web门户端的订阅流。传入订阅流永远不会在设备上建立。