Chrome won’t play WebAudio getUserMedia via WebRTC/Peer.js

This still appears to be an issue even in Chrome 73.

The solution that saved me for now is to also connect the media stream to a muted HTML audio element. This seems to make the stream work and audio starts flowing into the WebAudio nodes.

This would look something like:

let a = new Audio();
a.muted = true;
a.srcObject = stream;
a.addEventListener('canplaythrough', () => {
    a = null;
});

let audioStream = audioContext.createMediaStreamSource(stream);
audioStream.connect(audioContext.destination);

JSFiddle: https://jsfiddle.net/jmcker/4naq5ozc/


Original Chromium issue and workaround:
https://bugs.chromium.org/p/chromium/issues/detail?id=121673#c121

New Chromium issue: https://bugs.chromium.org/p/chromium/issues/detail?id=687574 https://bugs.chromium.org/p/chromium/issues/detail?id=933677

Leave a Comment