- Notifications
You must be signed in to change notification settings - Fork 167
Open
Description
Hi, thanks for your help, I have the following code, I make the connection correctly and receive the MediaStream, but when I want to use RTCVideoSink , it does not fire the event "addEventListener('frame')", I don't know if something is wrong. Thanks for your help.
socket.on("offer", (id, description) => { peerConnection = new wrtc.RTCPeerConnection(config); peerConnection .setRemoteDescription(description) .then(() => peerConnection.createAnswer()) .then(sdp => peerConnection.setLocalDescription(sdp)) .then(() => { socket.emit("answer", id, peerConnection.localDescription); }); peerConnection.onicecandidate = event => { if (event.candidate) { socket.emit("candidate", id, event.candidate); } }; peerConnection.ontrack = event => { // ON TRACK EVENT CREATE RTCVideoSink with MediaStreamTrack, This is wrong? const tracks = event.streams[0].getVideoTracks(); const transceiver = peerConnection.addTransceiver(tracks[0]); const sink = new RTCVideoSink(transceiver.receiver.track); sink.addEventListener('frame', ({ frame: { width, height, data }}) => { ----- CODE ----- }); }; });
Metadata
Metadata
Assignees
Labels
No labels