2012-10-26 226 views
1

我使用的WebRTC嘗試了一個簡單的視頻聊天中的一個網頁,我收到以下錯誤 未捕獲的錯誤:SYNTAX_ERR:DOM異常12視頻聊天12

我的代碼是

<button id='btn2' onclick='call();'>call</button> 
    ...... 
    function call(){ 
     pc1 = new webkitPeerConnection00(null,icecallback1); 
     console.log('created local peer connection object pc1'); 
     pc2 = new webkitPeerConnection00(null,icecallback2); 
     console.log('created local peer connection object pc2'); 
     pc2.onaddstream = gotremotestream; 

     pc1.addstream = localstream; 
     console.log('loclastream added'); 
     var offer = pc1.createOffer(null); 
     pc1.setLocalDescription(pc1.SDP_OFFER,offer); 
     console.log('localdesc'); 
     pc2.setRemoteDescription(pc2.SDP_OFFER,offer); 
     console.log('pc2remotedesc'); 

     var answer = pc2.createAnswer(offer.toSdp(),{has_audio:true,has_video:true}); 

     pc2.setLocalDescription(pc2.SDP_ANSWER,answer); 
     pc1.setRemoteDescription(pc1.SDP_ANSWER,answer); 

     pc1.startIce(); 
     pc2.startIce(); 

}; 

function gotremotestream(e){ 
    video2.src = webkitURL.createObjectURL(e.stream); 
} 

function icecallback1(candidate,bmore){ 
    if(candidate){ 
     pc2.processIceMessage(candidate); 
     console.log("local ICE candidate: " + candidate.toSdp()); 
    } 

} 


function icecallback2(candidate,bmore){ 
    if(candidate){ 
     pc1.processIceMessage(candidate); 
     console.log("remote ICE candidate: " + candidate.toSdp()); 
    } 

} 

有人可以幫我解決我的問題,因爲我tottaly難住了嗎?

+0

只是改變瀏覽器鉻鉻金絲雀,它會工作 – vaibhav

回答

0

您使用的是哪個版本的Chrome?請注意www.webrtc.org/blog中描述的PeerConnection00棄用。

+0

我使用鉻22 ..但運行在金絲雀上的代碼解決了我的問題 – vaibhav