David Liu

protocol 3: remote mute/unmute

resolves LK-94
@@ -372,6 +372,7 @@ internal constructor( @@ -372,6 +372,7 @@ internal constructor(
372 fun onAddTrack(track: MediaStreamTrack, streams: Array<out MediaStream>) 372 fun onAddTrack(track: MediaStreamTrack, streams: Array<out MediaStream>)
373 fun onUpdateParticipants(updates: List<LivekitModels.ParticipantInfo>) 373 fun onUpdateParticipants(updates: List<LivekitModels.ParticipantInfo>)
374 fun onActiveSpeakersUpdate(speakers: List<LivekitModels.SpeakerInfo>) 374 fun onActiveSpeakersUpdate(speakers: List<LivekitModels.SpeakerInfo>)
  375 + fun onRemoteMuteChanged(trackSid: String, muted: Boolean)
375 fun onSpeakersChanged(speakers: List<LivekitModels.SpeakerInfo>) 376 fun onSpeakersChanged(speakers: List<LivekitModels.SpeakerInfo>)
376 fun onDisconnect(reason: String) 377 fun onDisconnect(reason: String)
377 fun onFailToConnect(error: Exception) 378 fun onFailToConnect(error: Exception)
@@ -492,6 +493,10 @@ internal constructor( @@ -492,6 +493,10 @@ internal constructor(
492 listener?.onDisconnect(reason) 493 listener?.onDisconnect(reason)
493 } 494 }
494 495
  496 + override fun onRemoteMuteChanged(trackSid: String, muted: Boolean) {
  497 + listener?.onRemoteMuteChanged(trackSid, muted)
  498 + }
  499 +
495 override fun onLeave() { 500 override fun onLeave() {
496 close() 501 close()
497 listener?.onDisconnect("") 502 listener?.onDisconnect("")
@@ -314,6 +314,10 @@ constructor( @@ -314,6 +314,10 @@ constructor(
314 handleActiveSpeakersUpdate(speakers) 314 handleActiveSpeakersUpdate(speakers)
315 } 315 }
316 316
  317 + override fun onRemoteMuteChanged(trackSid: String, muted: Boolean) {
  318 + localParticipant.onRemoteMuteChanged(trackSid, muted)
  319 + }
  320 +
317 /** 321 /**
318 * @suppress 322 * @suppress
319 */ 323 */
@@ -369,7 +369,7 @@ constructor( @@ -369,7 +369,7 @@ constructor(
369 listener?.onLeave() 369 listener?.onLeave()
370 } 370 }
371 LivekitRtc.SignalResponse.MessageCase.MUTE -> { 371 LivekitRtc.SignalResponse.MessageCase.MUTE -> {
372 - //TODO 372 + listener?.onRemoteMuteChanged(response.mute.sid, response.mute.muted)
373 } 373 }
374 LivekitRtc.SignalResponse.MessageCase.ROOM_UPDATE -> { 374 LivekitRtc.SignalResponse.MessageCase.ROOM_UPDATE -> {
375 //TODO 375 //TODO
@@ -394,6 +394,7 @@ constructor( @@ -394,6 +394,7 @@ constructor(
394 fun onParticipantUpdate(updates: List<LivekitModels.ParticipantInfo>) 394 fun onParticipantUpdate(updates: List<LivekitModels.ParticipantInfo>)
395 fun onSpeakersChanged(speakers: List<LivekitModels.SpeakerInfo>) 395 fun onSpeakersChanged(speakers: List<LivekitModels.SpeakerInfo>)
396 fun onClose(reason: String, code: Int) 396 fun onClose(reason: String, code: Int)
  397 + fun onRemoteMuteChanged(trackSid: String, muted: Boolean)
397 fun onLeave() 398 fun onLeave()
398 fun onError(error: Exception) 399 fun onError(error: Exception)
399 } 400 }
@@ -188,6 +188,11 @@ internal constructor( @@ -188,6 +188,11 @@ internal constructor(
188 } 188 }
189 } 189 }
190 190
  191 + fun onRemoteMuteChanged(trackSid: String, muted: Boolean) {
  192 + val pub = tracks[trackSid]
  193 + pub?.muted = muted
  194 + }
  195 +
191 interface PublishListener { 196 interface PublishListener {
192 fun onPublishSuccess(publication: TrackPublication) {} 197 fun onPublishSuccess(publication: TrackPublication) {}
193 fun onPublishFailure(exception: Exception) {} 198 fun onPublishFailure(exception: Exception) {}