Trying to setSinkId on an audio node. I have noticed setSinkId only works in very specific circumstances and I need clarification. Examples behave similar in latest firefox and chrome.
This works:
index.html
<audio id="audio"></audio>
app.js
this.audio = document.getElementById('audio');
this.audio.src =... and .play()
this.audio.setSinkId(this.deviceId);
This is not OK beyond testing as now every player will be sharing a node. They each need a unique one.
This does not:
app.js
this.audio = new Audio();
this.audio.src =... and .play()
this.audio.setSinkId(this.deviceId)
This also doesn't work
app.js
this.audio = document.createElement('audio');
document.body.appendChild(this.audio);
this.audio.src =... and .play()
this.audio.setSinkId(this.deviceId)
Are there differences between new Audio, createElement, and audio present in HTML? Why doesn't setSinkId work on a new Audio()?