Hi
Is it possible to play sound effects on mobile twitch extension? I can play audio on overlay twitch extension it works fine, but when I play it on mobile it does nothing. I am using HTML Audio.
Hi
Is it possible to play sound effects on mobile twitch extension? I can play audio on overlay twitch extension it works fine, but when I play it on mobile it does nothing. I am using HTML Audio.
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
I get this error:
the request is not allowed by the user agent or the platform in the current context, possibly the user denied permission.
the volume is 0 at the beginning and I am only setting it to 0.5 if user enables sound on the extension.
First google hit:
Sounds like the user didn’t interact with the webpage first, “sufficently” for the browser to allow audio playing.
This isn’t an extensions problem. But a general web problem.
For localtest you are also battling user interaction score, and/or the possible lack of SSL on your localtest.