'Is it possible to remote participant track.stop()

I tried by following codes

  // remove particaipant tracks
  vm.tc.currentVideoRoom.participants.forEach((remoteParticipant) => {
      remoteParticipant.tracks.forEach((track) => {
        console.log(track); //here i found the remote participant video and audio track. 

        track.stop() // but here i found "track.stop() is not a function" error
       
      })
  });

I check twilio video documentation. but don't found any solution in here.

and i also check GitHub issue here the link. the guy mention remote participants tracks stop is not possible.

then how can i stop remote participant tracks using Twilio?



Solution 1:[1]

You can't stop a remote track like that. The remote track object is a representation of the track as a stream from the remote participant as a stream. A local track is a representation of a track as a stream from the device's camera or microphone, so when you call stop, it stops interacting with the hardware.

So you cannot call stop on a remote track, because that would imply you're trying to stop the track coming from the remote participant's camera or microphone.

If you want to stop seeing or hearing a remote track, you can detach the track from the page. If you want to unsubscribe from the track so that you stop receiving the stream of it, you can use the track subscriptions API. And if you want to actually stop the remote participant's device, you would have to send a message to the remote participant (possibly via the DataTrack API) and have them execute the track.stop() locally.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 philnash