0
请看看我的代码,说我为什么不进入到功能gotDescription(DESC)为什么我不进入gotStream函数?
navigator.getUserMedia({audio:true, video:true}, success, error);
function success(stream) {
var video1 = document.querySelector("#video1");
video1.src = URL.createObjectURL(stream)
video1.play()
//rtcpeer
console.log("1")
var pc1 = new RTCPeerConnection()
pc1.addStream(stream)
pc1.createOffer(gotDescription)
console.log("2")
function gotDescription(desc) {
console.log("3")
pc1.setLocalDescription(desc)
console.log("aaa" + desc.sdp)
}
}
function error(err) {
console.log(err)
}
的是没有的console.log(“3”)。
在此先感谢
请反馈至https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createOffer回调,因为第一个和第二个参数已被弃用 –
我该怎么做才能使它工作? –
'pc1.createOffer(gotDescription)'gotDescription是successCallback,对不对?它根据MDN已被弃用。使用诺言代替 –