【发布时间】:2021-04-03 00:59:01
【问题描述】:
所以我一直在使用 PeerJS 制作一个 p2p 聊天应用程序,它在尝试聊天时可以工作,但是当我尝试使用以下功能呼叫某人时:
function callEm(id){
call = peer.call(id,
navigator.mediaDevices.getUserMedia({video: false, audio: true})
);
call.on('stream', function(stream) { // B
window.remoteAudio.srcObject = stream; // C
window.remoteAudio.autoplay = true; // D
window.peerStream = stream; //E
showConnectedContent(); //F });
})
}
我从 PeerJS 收到一个错误,说 e.getTracks is not a function
e.getTracks是peerJS库中的代码:https://unpkg.com/peerjs@1.3.1/dist/peerjs.min.js
我一直在尝试我在互联网上找到的所有内容,但仍然出现此错误。我希望有人能够帮助我。
编辑:我尝试了更简洁的库版本(https://unpkg.com/peerjs@1.3.1/dist/peerjs.js),但我得到了错误
stream.getTracks() is not a function
【问题讨论】: