Worked fine last I was testing this on mobile.
However it will pause the stream if a stream is playing.
All extensions require a a volume control to be present
And the volume to start at muted/0
So you’ll need a volumne control.
I was invoking on a “positive action” from the user.
IE A button press.
And invoking via something like:
cheersboard_preview = new Audio();
cheersboard_preview.volume = parseInt(document.getElementById('cheersboard_preview_volume_control').value) / 100;
cheersboard_preview.src = SOMEAUDIOFILE;
var playPromise = cheersboard_preview.play();
if (playPromise !== undefined) {
playPromise.then(_ => {
e.target.classList.add('playing');
console.log('playing');
})
.catch(error => {
console.log('Play Error', (error.message ? error.message : error));
});
} else {
console.log('Somethings awry');
}
cheersboard_preview_volume_control is a HTML input of type range
You will probably want to spit out the error’s to a HTML Text area or something to see whats going on