Skip to content

RTCVideoSink on Frame #44

@remymatheus

Description

@remymatheus

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions