Send explicit message to clients for mute/unmute. (#107)

* Send explicit message to clients for mute/unmute.

* documentation in config
This commit is contained in:
David Zhao
2021-09-01 21:50:02 -07:00
committed by GitHub
parent 4044c314b8
commit e82d50d717
14 changed files with 44 additions and 32 deletions
+13 -1
View File
@@ -536,7 +536,7 @@ func (p *ParticipantImpl) SendDataPacket(dp *livekit.DataPacket) error {
}
}
func (p *ParticipantImpl) SetTrackMuted(trackId string, muted bool) {
func (p *ParticipantImpl) SetTrackMuted(trackId string, muted bool, fromAdmin bool) {
isPending := false
p.lock.RLock()
for _, ti := range p.pendingTracks {
@@ -559,6 +559,18 @@ func (p *ParticipantImpl) SetTrackMuted(trackId string, muted bool) {
currentMuted := track.IsMuted()
track.SetMuted(muted)
// when request is coming from admin, send message to current participant
if fromAdmin {
_ = p.writeMessage(&livekit.SignalResponse{
Message: &livekit.SignalResponse_Mute{
Mute: &livekit.MuteTrackRequest{
Sid: trackId,
Muted: muted,
},
},
})
}
if currentMuted != track.IsMuted() && p.onTrackUpdated != nil {
logger.Debugw("mute status changed",
"participant", p.Identity(),