I'm building a web application, where music/audio is playing from an object using new Audio(). On another tab I'd like to listen to the music through WebRTC. I already have the WebRTC established, and I can confirm it works with microphones on both sides.
When I try to change the "music" tab's microphone to a mediastream of a "new Audio()", it no longer works and the listeners-tab is silent.
I'm trying it like this:
audio = new Audio();
audio.src = someArray['audiosrc'];
mediaStream = audio.captureStream()
audio.play();
webRTC.addTrack(mediaStreams.getAudioTracks()[0]);
I have no clue why the listeners-tab is completely silent... Is there anything wrong with the code? I don't see any errors in the console, I don't see any errors on the receiving side, but it still does not want to "stream" the audio.