WEBRTC对象#<rtcpeerconnection>没有方法&#39; processSignalingMessage&#39; </rtcpeerconnection>

时间:2013-04-03 13:48:15

标签: webrtc

我遇到WebRTC问题: 我在一个关于视频通话的例子中使用了这段代码。

 if (new_connection) {
       console.log('New Peer Connection');
       var peer_connection = {};
       peer_connection.connection_id = msg.from_connection_id;
       peer_connection.pc = createPeerConnection(peer_connection.connection_id,
       false);
       peer_connections.push(peer_connection);
       $('#remote').prepend(remoteVideoHtml.replace('remoteVideoId', 'peer' +
       peer_connection.connection_id));
 }

 //Now process the SDP JSON Blob received
 for (var i in peer_connections) {
       if (peer_connections[i].connection_id == msg.from_connection_id) {
             try {
                  peer_connections[i].pc.processSignalingMessage(msg.data);
             }catch (e) {
       console.log("Failed to create processSignalingMessage, exception: " +    e.message);                            
 }

我需要帮助,因为我有一个问题。

                      peer_connections[i].pc.processSignalingMessage(msg.data);

问题是:

 Object #<RTCPeerConnection> has no method 'processSignalingMessage' 

我不知道这些功能是如何工作的以及它们如何被激活:

pc.onconnecting = function (msg) {
    console.log('onSessionConnecting');
}
pc.onopen = function (msg) {
    console.log('onSessionOpened');
}
pc.onaddstream = function (event) {
    console.log('onRemoteStreamAdded add the remote peers video stream.');
    var url = webkitURL.createObjectURL(event.stream);
    $('#peer' + connection_id).attr({
        src: url
    });
}

我将不胜感激。

1 个答案:

答案 0 :(得分:1)

Chrome中的WebRTC初始版本基于ROAP,过去常常使用processSignallingMessage()方法。当前版本基于JSEP,它有setRometeDescription()setLocalDescription()等方法来注入本地SDP和从其他用户收到的SDP。

您仍然可以在旧版本的Chrome或Bowser中找到此实现。