Search code examples
javascriptwebrtchtml5-audio

Javascript: Does <audio>.captureStream() work without play()?


In the browser, I want to capture the stream of an audio tag that has an .mp3 as source, then send it live via WebRTC to the server. I don't want to hear it via the speakers.

Is it possible to call audioElement.play() without having speaker output?


Solution

  • It seems that one can mute the audio element and still capture the stream:

    audioElement.muted = true; var stream = audioElement.captureStream();