从Kurento的数据通道发送和接收消息

时间:2019-03-27 08:57:50

标签: javascript node.js webrtc kurento rtcdatachannel

我是Kurent的新手,通过改写从示例中找到的代码,我看不到消息的发送。这是我的一些代码:

peerConnection = new RTCPeerConnection(config);
dataChannel = peerConn.createDataChannel(participant.id, {reliable: false});
dataChannel.onmessage = channelMessage

 var options = {
        peerConnection : peerConnection,
        localVideo: video,
        mediaConstraints: constraints,
        onicecandidate: participant.onIceCandidate.bind(participant)
    }


participant.rtcPeer = new kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options, //WebRtcPeerSendonly
        function (error) {
            if(error) {
                return console.error(error);
            }
            this.generateOffer(participant.offerToReceiveVideo.bind(participant));


        });

function channelMessage(event){
    console.log(event)
}

0 个答案:

没有答案