Cracker0dks
Cracker0dks

Reputation: 2490

Firefox createMediaStreamDestination bug using rtc?

I stream audio over rtc and want to mute and unmute the audio.

This works... but no gain control:

function(stream) { /* getUserMedia stream */
      console.log("Access granted to audio/video");
      peer_connection.addStream(stream);
}

This works on chrome but NOT on Firefox (with gain control)

function(stream) { /* getUserMedia stream */
  console.log("Access granted to audio/video");
  var microphone = context.createMediaStreamSource(stream);
  gainNode = context.createGain();
  var dest = context.createMediaStreamDestination();
  microphone.connect(gainNode);
  gainNode.connect(dest);

  local_media_stream = dest.stream;
  peer_connection.addStream(local_media_stream);
}

I get no error and i hear no voice. When I send the gainNode to context.destination i can hear myself.

I think "context.createMediaStreamSource(stream)" is broken in any way. Can anyone tell me why ? and how to fix this.


EDIT: So i checked the streams and:

stream //type: LocalMediaStream    
dest.steam //type: MediaStream

in Firefox! In chrome both are MediaStreams

Upvotes: 6

Views: 370

Answers (2)

Cracker0dks
Cracker0dks

Reputation: 2490

Ok thanks to @Ken Fyrstenberg I just tried the Firefox Nighly build. On the Nighly everythink works fine (as in Chrome). The data types are:

stream //type: LocalMediaStream    
dest.steam //type: MediaStream

as before, but I can hear the opponent and be able to mute the mic.

So I only have to wait for release :P

Upvotes: 3

user1693593
user1693593

Reputation:

To mute the audio you can enable/disable the track itself by doing:

stream.getAudioTracks()[0].enabled = false;  // mutes

This won't solve the problem with the gain node, which is most likely a bug/limitation in Firefox at the moment (in which case we can only wait for a fix). But if the purpose is to (un)mute this should work (it also works with video tracks).

Upvotes: 3

Related Questions