Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTCVideoSink on Frame #44

Open
remymatheus opened this issue Apr 28, 2021 · 1 comment
Open

RTCVideoSink on Frame #44

remymatheus opened this issue Apr 28, 2021 · 1 comment

Comments

@remymatheus
Copy link

remymatheus commented Apr 28, 2021

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 -----
    });
  };
});
@sagarchikhale
Copy link

I have same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants