Closed TravBradfield closed 4 years ago
Hi @TravBradfield ,
Thanks for writing in with your issue. In your snippet, you are attempting to stop RemoteParticipants' Tracks, which is not possible. You can only stop your own Tracks, which can be done as follows:
room.on('disconnected', room => {
console.log('You disconnected: ', room);
room.participants.forEach(participant => this.participantDisconnected(participant));
this.participantDisconnected(room.localParticipant);
});
participantDisconnected = participant => {
console.log('Participant "%s" disconnected', participant.identity);
document.getElementById(participant.sid).remove();
const track = [...participant.videoTracks.values()][0].track;
if (track.stop) {
track.stop();
track.detach(this.localVideoTrack.current);
}
this.disconnectCall();
}
Hope this helps. I'll close this issue since I've answered your question, but we can continue the conversation here if you need any more clarification.
Thanks,
Manjesh Malavalli JSDK Team
@manjeshbhargav Thanks for your response. I've tried your code snippet but it hasn't made any difference.. Here is a screen shot of my console.
Hi @TravBradfield ,
Thanks for writing in with your issue. In your snippet, you are attempting to stop RemoteParticipants' Tracks, which is not possible. You can only stop your own Tracks, which can be done as follows:
room.on('disconnected', room => { console.log('You disconnected: ', room); room.participants.forEach(participant => this.participantDisconnected(participant)); this.participantDisconnected(room.localParticipant); }); participantDisconnected = participant => { console.log('Participant "%s" disconnected', participant.identity); document.getElementById(participant.sid).remove(); const track = [...participant.videoTracks.values()][0].track; if (track.stop) { track.stop(); track.detach(this.localVideoTrack.current); } this.disconnectCall(); }
Hope this helps. I'll close this issue since I've answered your question, but we can continue the conversation here if you need any more clarification.
Thanks,
Manjesh Malavalli JSDK Team
const track = [...participant.videoTracks.values()][0].track;
this track is always undefined!! I'm really battling to understand why. There is no participant being passed in which is why it always fails.. But why!?!?!
(Tearing my hair out)
Code to reproduce the issue:
Expected behavior:
I expect the local video to be stopped by "track.stop()".
Actual behavior:
I'm getting an error saying track.stop() is not a function.
TODO
Software versions: