如何关闭webrtc datachannel?

时间:2015-07-20 02:05:53

标签: webrtc rtcdatachannel peer-connection

我不能使用以下方法。

因为我只使用datachannel(不使用getUserMedia)

<script>
    peerConnection.removeStream(remoteStream)
    remoteVideo.onerror = null;
    remoteVideo.pause();
    remoteVideo.src = undefined;
    remoteStream.stop();
    remoteStream.onended = null;
    remoteStream = null;

    peerConnection.removeStream(localStream)

    localVideo.onerror = null;
    localVideo.pause();
    localVideo.src = undefined;
    localStream.stop();
    localStream.onended = null;
    localStream = null;
</script>

有办法关闭数据通道吗?

1 个答案:

答案 0 :(得分:5)

要关闭RTCDataChannel,请调用ReSharper - 这也可以在RTCPeerConnection上调用,这将关闭在对等连接上创建的所有数据通道。

close()