Firefox createMediaStreamDestination bug using rtc?

冷暖自知 提交于 2019-12-22 05:39:28

问题


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


回答1:


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




回答2:


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).



来源:https://stackoverflow.com/questions/29550278/firefox-createmediastreamdestination-bug-using-rtc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!