mirror of
https://github.com/livekit/livekit.git
synced 2026-05-27 16:34:27 +00:00
Add a method to clear receiver. (#372)
With remote media track receiver starting/stopping/restarting possibly, receiver should be cleared when stopped and will be re-initialized when it is restarted.
This commit is contained in:
@@ -90,6 +90,14 @@ func (t *MediaTrackReceiver) SetupReceiver(receiver sfu.TrackReceiver) {
|
||||
t.MediaTrackSubscriptions.Start()
|
||||
}
|
||||
|
||||
func (t *MediaTrackReceiver) ClearReceiver() {
|
||||
t.lock.Lock()
|
||||
t.receiver = nil
|
||||
t.lock.Unlock()
|
||||
|
||||
t.MediaTrackSubscriptions.Close()
|
||||
}
|
||||
|
||||
func (t *MediaTrackReceiver) OnMediaLossUpdate(f func(fractionalLoss uint8)) {
|
||||
t.onMediaLossUpdate = f
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user