jsxm
jsxm copied to clipboard
Autoplay
Hi, I have a problem with autoplaying in my site...
- Everytime I
XMPlayer.init();
andfetch
, I have to wait about 2 to 3 minutes before playing... - Here's how I did it...
<script>
// Play the XM file
function play() {
XMPlayer.play();
}
// Initialize the player
XMPlayer.init();
// Load the XM file
fetch('a sad touch.xm')
.then(response => response.arrayBuffer())
.then(buffer => {
XMPlayer.load(buffer);
setTimeout(function(){
play();
}, 3500);
});
// Pause the XM file
function pause() {
XMPlayer.pause();
}
// Stop the XM file
function stop() {
XMPlayer.stop();
}
</script>
- Is jsxm support autoplay after loaded xm? or I just live in pain?
Site: bang1338.xyz
Browsers don't allow you to autoplay audio on load without at least some interaction with the page. So for example I had to add a "play" button to start a demo with audio.
Does the 3-second delay actually work for autoplaying? Hmm
Does the 3-second delay actually work for autoplaying? Hmm
- Yes, 3.5 seconds delay.
- Put 3.5 seconds, work for Cent Browser, Chrome, Vivaldi Browser on Android.