React-native-webrtc: Muting incoming audio doesn't work - 0.8.0

Created on 15 Dec 2016  路  7Comments  路  Source: react-native-webrtc/react-native-webrtc

As I understand this code should mute incoming audio:

var config = this.props.mixertest.webrtcStuff
      if(config.remoteStream){
             var pc = config.pc
             var streams = pc._remoteStreams
        streams[0].getTracks().forEach(track => track.enabled = !track.enabled)
      }}}

It does change track.enabled value but audio doesn't get muted. What did I miss? Is there other way to mute incoming audio?

Most helpful comment

@szymonzmyslony @atyenoria did you ever manage to find a workaround?

@zxcpoiu you seemed knowledgeable with the details :) .. do you know a good work-around to this issue?

Toggling enabled (and muted)-properties on local and remote stream audio tracks won't work.

All 7 comments

yes, you are right.
but I only test on local tracks not sure about if we can mute the remote stream that way.

it's obvious there are only 3 ways:

  1. find a way to mute remote track locally ( not sure about it )
  2. turn off your speaker for that stream use system api. ( but webrtc controls audio player itself, so it may have unpredictable behaviors )
  3. asking remote party to mute their local track remotely, just like "hold" in terms of telephony.

see how official webrtc app does is always a good direction to understand it's ability

so in your opinion it's impossible to do it locally?

everything is possible :)

I just didn't find any implementations does that yet.

my guess is:

  1. if you can get AudioPlayer instance which created by webrtc, you might able to use AudioPlayer API to pause it.

  2. by webrtc documents: https://www.w3.org/TR/webrtc/#hold-functionality
    it shows how to implement "hold" functionality, but it seems like the same as my previous comments point 3.

This module did not implement RTCRtpTransceiver, RTCRtpReceiver, RTCRtpSender yet.
and I believe those are interfaces which control local/remote media streams' rendering.

@szymonzmyslony
I tried streams[0].getTracks().forEach(track => track.enabled = !track.enabled) . But nothing changed. Have you succeeded in muting remote audio??

no, I dont know how to it yet. Any comments would be appreciated.

@szymonzmyslony @atyenoria did you ever manage to find a workaround?

@zxcpoiu you seemed knowledgeable with the details :) .. do you know a good work-around to this issue?

Toggling enabled (and muted)-properties on local and remote stream audio tracks won't work.

Pretty sure this has been fixed now. Closing and if its still an issue for someone can you make a new issue?

Was this page helpful?
0 / 5 - 0 ratings