private mode implementation.

This commit is contained in:
Miroslav Šedivý 2022-03-26 23:20:38 +01:00
parent f549171ded
commit d004ddd68f
12 changed files with 160 additions and 11 deletions

View file

@ -15,6 +15,7 @@ type WebRTCPeerCtx struct {
connection *webrtc.PeerConnection
dataChannel *webrtc.DataChannel
changeVideo func(videoID string) error
setPaused func(isPaused bool)
iceTrickle bool
}
@ -122,6 +123,19 @@ func (peer *WebRTCPeerCtx) SetVideoID(videoID string) error {
return peer.changeVideo(videoID)
}
func (peer *WebRTCPeerCtx) SetPaused(isPaused bool) error {
peer.mu.Lock()
defer peer.mu.Unlock()
if peer.connection == nil {
return types.ErrWebRTCConnectionNotFound
}
peer.logger.Info().Bool("is_paused", isPaused).Msg("set paused")
peer.setPaused(isPaused)
return nil
}
func (peer *WebRTCPeerCtx) Destroy() {
peer.mu.Lock()
defer peer.mu.Unlock()