fire TrackSubscribed event only when subscriber is visible (#3378)
TrackSubscribed is meant to give publishers an indication when the subscriber is ready to receive its audio. When there are hidden recorders in the room, we do not want them to trigger this event.
This commit is contained in:
@@ -434,6 +434,8 @@ func (t *MediaTrack) SetMuted(muted bool) {
|
||||
t.MediaTrackReceiver.SetMuted(muted)
|
||||
}
|
||||
|
||||
// OnTrackSubscribed is called when the track is subscribed by a non-hidden subscriber
|
||||
// this allows the publisher to know when they should start sending data
|
||||
func (t *MediaTrack) OnTrackSubscribed() {
|
||||
if !t.everSubscribed.Swap(true) && t.params.OnTrackEverSubscribed != nil {
|
||||
go t.params.OnTrackEverSubscribed(t.ID())
|
||||
|
||||
Reference in New Issue
Block a user