Is there a way to get the audio playing from the speakers of a device

Viewed 224

So I've been battling with an issue for a while now, I've been trying to get the audio playing through the speakers of a device using the MediaDevices singleton object in javascript. I'm trying to achieve something similar to Shazam or snapchat where they can both get the audio playing from the speakers of a device and also from a microphone so that I can for instance be taking a video using my microphone and video cam and also streaming the sound playing from the background.

I'll like to know if this is possible because I tried using devices with kind of "audiooutput" and deviceId of "default" accessible through the enumerateDevices method assuming that's the device's output speaker but I still get the audio from the microphone even when using the device kind of "audiooutput".

Note: I'm able to combine multiple audio nodes successfully.

I'm not asking for a do it for me answer, just a theory of how to go about implementing it if it's possible in javascript.

Thanks in advance :D

1 Answers

No, this isn't possible via the Web Audio API. Not all platforms even support this capability.

On some platforms, you can use getDisplayMedia() and get audio with it, but compatibility isn't great right now.

Related