Proper way of pause and resume a track #1163
-
I am struggling with pause and resume of a track. For pausing I tried something like removing a track completely, and saw a proper SDP. For resuming I've tried to add a new track with the same ssrc, msid, trackId, etc.. But after adding the new track and calling setLocalDescription I see in a log something like: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Removal is irreversible in WebRTC media negotiation, so you can't re-add the same track later. It is typically used to reject a track. Track negotiation is designed only to negotiate formats and codecs, you should not attempt to signal stop and restart with it. You should need renegotiation only when a new media is added later, like screen sharing. To pause a track, just stop sending, and to resume, restart sending. You can send your own signaling messages to inform the remote side explicitly of the playback state. |
Beta Was this translation helpful? Give feedback.
Removal is irreversible in WebRTC media negotiation, so you can't re-add the same track later. It is typically used to reject a track.
Track negotiation is designed only to negotiate formats and codecs, you should not attempt to signal stop and restart with it. You should need renegotiation only when a new media is added later, like screen sharing.
To pause a track, just stop sending, and to resume, restart sending. You can send your own signaling messages to inform the remote side explicitly of the playback state.