Audio in starting timeline won't work


(Rodolfo Mata) #1

Hi

I have an audio at the starting scene just at the beginning of the main timeline and it was working ok with Chrome and Safari browsers but now it has stopped working with Chrome (this in the final HTML5 file with its hypersources) while it continues to work with Safari. Every other audio works. All are mp3. I have tried with and without the preloading option and I have changed the audio with no results: the same behaviour with the browsers. What surprises me is that the sound works with the preview mode in Chrome. Am I doing something wrong to produce my HTML5?
Regards
Rodolfo


#2

It’s probably the new restrictions on autoplaying audio. That’s assuming you are autoplaying. Audio (or video containing audio) must be muted if autoplaying. If called by some user action then this is not a problem. Do you have something that we can see? so that we can be more specific in a resolution.


(Rodolfo Mata) #3

I didn’t know about that recent restriction. It started yesterday?
Here I have my hype file zipped. It’s just in the starting scene:
https://drive.google.com/open?id=1uJEIM_Qd7nJHoiNcp1dV7MGiopcjwHn0


#4

The change @dbear is referring to is the new Media Engagement Index in Chrome: If people have already approved audio playback on this site, and have spent some time on it, audio will autoplay. But if this is their first visit, the audio will not play back without any user interaction.

So to get your audio to be able to play in Chrome, you’re going to need to have it play in response to someone clicking something. This can be as simple pausing your main timeline, and then creating a button at time 0 which resumes the main timeline and plays your audio. The audio play action needs to basically happen immediately after a click.


(Jonathan Deutsch) #5

I also assume on export you’re opening the .html file directly in chrome as a file:/// URL? This has to use a different playing method for audio that looks like it more strongly enforces the autoplay restrictions.


(Rodolfo Mata) #6

I introduced a “click to start” button and it worked. I didn’t know about that new Media Engagement Index. This Forum is so good to clear doubts! Thanks a lot!


(Rodolfo Mata) #7

Yes, I was doing exactly that. I was testing the files before sending them to the webmaster to upload them in the review site where I collaborate. Why that enforces the autoplay restrictions?


(Jonathan Deutsch) #8

When opening with the file:/// method, the Hype runtime has to use an <audio> tag. My guess is that browsers treat this more similarly to <video> under-the-hood and there’s been a lot of recent work to stop video from autoplaying if it contains an audio track or is not muted.

When serving over http and https, Hype can make use of the newer, low-latency Web Audio API. I don’t know why desktop browsers are more relaxed about this autoplaying. iOS definitely won’t autoplay with this method, so it is still likely better to put all audio behind some sort of interaction.


(Rodolfo Mata) #9

Thank you Johnathan!