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

Implement removestream, removetrack events #304

Open
t-mullen opened this issue Apr 29, 2018 · 7 comments
Open

Implement removestream, removetrack events #304

t-mullen opened this issue Apr 29, 2018 · 7 comments

Comments

@t-mullen
Copy link
Collaborator

t-mullen commented Apr 29, 2018

These events were disabled due to a lack of a reliable way to detect media removals and correlate them with streams provided by the stream and track events.

They should be re-added to allow peers to observe remote stream removals.

peer.on('removestream', cb)
peer.on('removetrack', cb)

@nielsswinkels
Copy link

Any progress yet? Would be great to have indeed.

@sahiljain2497
Copy link

Yes this would be great!
Right now i have to fire an additional event to hide/remove track from ui of the receiver.
Any other better ideas as per current scenario?

@vbabenko
Copy link

Have the same problem.
I send an additional event when the stream removed. It would be great to have such events

@ted-piotrowski
Copy link

The mute event is a good workaround for the lack of a removetrack event.

link.on('track', (track) => {
    console.log('track added');
    track.addEventListener('mute', () => {
        console.log('track removed')
    });
});

@fictorial
Copy link

fictorial commented May 19, 2020

@ted-piotrowski isn't that only going to fire for the local stream?

localStream.getAudioTracks()[0].enabled = false

does not trigger this on a remote peer:

  peer.on('track', (track, stream) => {
    track.addEventListener('mute', () => {
      // TODO update UI
    });
  });

FWIW I'm sending the mute/unmute events out of band using the signaling server I have as a workaround.

@ted-piotrowski
Copy link

ted-piotrowski commented May 20, 2020

@fictorial The mute event fires on the remote peer for me (Latest Chrome/MacOS) 🤷 However, the mute event can't be used to infer if a track has ended because mute event gets periodically emitted when a peer can't stream data fast enough and unmute is emitted when data comes through again. I am also sending a trackRemoved event now, but using the simplepeer data channel instead of a signaling server. Would be a nice addition to have a removeTrack event.

@matallui
Copy link

Any traction on this yet? If not, any pointers on how this should be properly implemented? Happy to submit a PR.

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

No branches or pull requests

7 participants