Playing Audio on Scene Load does not work on latest browsers

I was checking an old piece I did in 2016 (https://www.centraldeinformacao.pt/_portfolio/vodafonedubai-01/index.html) and the audio on scene load is not working on Safari 12.0.2 and Chrome 71.0.3578.98!!! with Mojave 10.14.2!!!

The audio is an .mp3 format.
I’ve checked that it works on older versions.

Am I missing something?
Can anyone reproduce this?

Chrome and Safari since then have changed their audio policies. Chrome has the notion of a ‘Media Engagement Index’ which further complicates things, but the key thing is that both Chrome and Safari are waiting for some user action to start the audio. Mobile browsers were the first to restrict audio from playing when initially loading the page, but now most browsers will want to see some click or tap before playing sound.

For your case, the error shown in Chrome is:

The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu

Does this mean that all my older projects have 2 b changed?
:frowning:

Only if you are relying on audio playing without the user doing anything. Sorry to be the bearer of this news!

So basically, on scene load play audio will no longer function in Hype, right?
:frowning:

It will not function in the context of Chrome’s default behavior for the first scene.

Once audio has been triggered via event, it will work. So you could have a button start a small audio sample, then audio on scene load will subsequently work.

There are other places where it will work such as if you are building an iOS app and configure the web view to autoplay audio.

yes, guess I will have to rethink onload audio from now on... the problem now is finding time to change the old projects!!!! :confused:

yep,... right now I'm avoiding iOS app design because I prefer not to depend on Apple so I will keep on designing and exporting for web (mobile, tablet and desktop layouts) and place it on my servers. But I think I know what u mean. Have to try to explore more on autoplay audio. Thanks @jonathan

...and thanks 2 u @Daniel for the sad news... someone had 2 do it :wink:

1 Like

Hello,
Since this last post, has anyone found a solution to play sound when starting a timeline without any action by the user? (a code to add in the files after the export for example)

No, this is blocked at the browser level and there's no clever hack to avoid it.

The best technique to get around autoplay restrictions is to have a "start" type of button that may play a silent audio before users begin viewing your content. This primes the page to allow playing audio in other contexts that would happen automatically (timeline action, scene loads, etc.)

Thank you for your reply.
In any case, the user will have to click on the start button, is that right?

you may have some luck with autoplay when having an init audio start done by a userinteraction

1 Like

:grinning: