how to mute the voice of the remote media stream?

7,242 views
Skip to first unread message

Silent Tiger

unread,
Oct 29, 2012, 1:12:58 AM10/29/12
to discuss...@googlegroups.com
how to mute the voice of the remote media stream?
I've set the 'muted' property of the video element which present the remote media stream, but it doesn't work.
I've set the 'enable' property of the audio tracks in the remote media stream, it doesn't work too.
 what shall I do?

Vikas Marwaha

unread,
Oct 29, 2012, 8:19:00 PM10/29/12
to discuss...@googlegroups.com
Hi,

I tested the mute functionality in 1311.1 canary seems to work fine. You can refer to apprtc code. Below is some snippet for audio muting.

function toggleAudioMute() {
if (localStream.audioTracks.length === 0) {
console.log("No local audio available.");
return;
}

if (isAudioMuted) {
for (i = 0; i < localStream.audioTracks.length; i++) {
localStream.audioTracks[i].enabled = true;
}
console.log("Audio unmuted.");
} else {
for (i = 0; i < localStream.audioTracks.length; i++){
localStream.audioTracks[i].enabled = false;
}
console.log("Audio muted.");
}

isAudioMuted = !isAudioMuted;
}

/Vikas

--
 
 
 

Silent Tiger

unread,
Oct 29, 2012, 9:38:28 PM10/29/12
to discuss...@googlegroups.com
First, thanks for your reply, but, I mean mute the REMOTE media stream, not local.
The muting of local stream works fine, but this way doesn't work on the remote stream.


在 2012年10月30日星期二UTC+8上午8时19分03秒,Vikas写道:

Wei Jia

unread,
Oct 30, 2012, 1:32:07 PM10/30/12
to discuss...@googlegroups.com
Audio volume control should be hooked up in canary 24.0.1312.0.

Wei


--
 
 
 

Vikas

unread,
Oct 30, 2012, 3:34:19 PM10/30/12
to discuss-webrtc
Thanks Wei, To add you can test it by right clicking on the local/
remote video and select show controls. It should work in today's
canary.

/Vikas

On Oct 30, 10:32 am, Wei Jia <w...@google.com> wrote:
> Audio volume control should be hooked up in canary 24.0.1312.0.
>
> Wei
>
>
>
>
>
>
>
> On Mon, Oct 29, 2012 at 6:38 PM, Silent Tiger <cia.fbi....@gmail.com> wrote:
> > First, thanks for your reply, but, I mean mute the REMOTE media stream,
> > not local.
> > The muting of local stream works fine, but this way doesn't work on the
> > remote stream.
>
> > 在 2012年10月30日星期二UTC+8上午8时19分03秒,Vikas写道:
>
> >> Hi,
>
> >> I tested the mute functionality in 1311.1 canary seems to work fine. You
> >> can refer to apprtc <http://apprtc.appspot.com> code. Below is some
> >> snippet for audio muting.
>
> >> function toggleAudioMute() {
> >>  if (localStream.audioTracks.lengt**h === 0) {
> >>  console.log("No local audio available.");
> >>  return;
> >>  }
>
> >> if (isAudioMuted) {
> >> for (i = 0; i < localStream.audioTracks.length**; i++) {
> >>  localStream.audioTracks[i].ena**bled = true;
> >>  }
> >>  console.log("Audio unmuted.");
> >>  } else {
> >>  for (i = 0; i < localStream.audioTracks.length**; i++){
> >>  localStream.audioTracks[i].ena**bled = false;

Dennis E. Dowhy

unread,
May 20, 2013, 8:30:16 AM5/20/13
to discuss...@googlegroups.com
Nicolas,
derive a new media stream from your local stream for each outgoing peer connection.

e.g.

var newLocalStreamPeer1 = new webkitMediaStream(localsteam);
pc1.addStream(newLocalStreamPeer1);
var newLocalStreamPeer2 = new webkitMediaStream(localsteam);
pc2.addStream(newLocalStreamPeer2);
var newLocalStreamPeer3 = new webkitMediaStream(localsteam);
pc3.addStream(newLocalStreamPeer3);

// This will mute my audio going to peer 2 only.
newLocalStreamPeer2.getAudioTracks()[0].enabled=false;




On Sun, May 19, 2013 at 6:08 PM, Nicolas <menoni....@gmail.com> wrote:
Hi,

I'm searching to do something like that. Particularly I want to mute the audio (not the video) that is going out from my computer to one of the remote peers, and still sending audio to the others peers.

I have tested the Vika's code previously mentioned but it mutes the receiving audio (incoming) from a particular remote peer, and I have to mute the sending audio (outgoing).

Any suggestions?
Thank you.

--
 
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Akshay Shah

unread,
Jul 6, 2015, 1:42:25 AM7/6/15
to discuss...@googlegroups.com
Hi.. 

I am looking for the same. Did you get any way working for muting the incoming audio stream?

Christoffer Jansson

unread,
Jul 7, 2015, 6:08:58 AM7/7/15
to discuss...@googlegroups.com, meetak...@gmail.com
Hi,

As mentioned in the previous comments changing the track enabled state to false will mute the stream, applies to both local and remote streams, set enabled to true to unmute.

E.g.
Mute
remoteStream.getAudioTracks()[0].enabled = false;

Unmute
remoteStream.getAudioTracks()[0].enabled = true;

/Chris

Gunjot Singh

unread,
Jan 29, 2019, 1:11:13 AM1/29/19
to discuss-webrtc
Yes. Still not working :( Any updates on this ?


On Monday, October 29, 2012 at 10:42:58 AM UTC+5:30, Silent Tiger wrote:

Shashidhara K

unread,
Jan 30, 2019, 8:37:35 AM1/30/19
to discuss...@googlegroups.com
Hi, 
transceiver.sender.track.enabled=false;

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages