Why is the hidden audio-player not playing inside onReady() on this published site?

Site link: https://www.psquareinternational.com/audio-test

This site has 3 audio player – all hidden – I’ve set #audioPlayer3 to play inside the page’s onReady() function.

In the published site, it does not play. How can I make it play as soon as the page loads?

$w.onReady( function () {
let Alevel= 3 ;
$w( “#audioPlayer” +Alevel).play();
// $w( “#audioPlayer3” ).play(); // even this line does not seem to do the job
});

Thanks in advance!

Hey Bhavika,

I added an audio player to a test site of mine and set it to be hidden on load. I then added the following code.

$w.onReady(function () {
   $w("#audioPlayer1").play()
} );

I then published my site and when I go to the live page the audio player plays automatically as expected.

I checked out the code on your site and I can see that you don’t have any code for the audio player to play in the page onReady function.

Can you add the code to the onReady function again and test it? If it still doesn’t work please leave it there and let us know so we can have a look.

Dara | Corvid Team