Page 1 of 1

play audio automatically in HTML5

PostPosted: Wed Jan 27, 2016 3:50 am
by belvistastudios
Hi guys,

I hope you can assist me with an alternative approach to audio playing in HTML5.

I am currently developing a solution that is predominantly for mobile phones. It consists of a countdown timer that starts with an audio tune and completes with an audio tune and then shows another display set, which does the same thing. The idea is that someone should not need to look at their phone to know the timer is starting or stopping, the audio tunes are their prompt.

I have read the need to have someone allow audio and video to play in HTML5 but I have audio set up on each display set and there will be approximately 50 so you can imagine that no one is going to give the audio access every time.

Essentially, timer on display a, on time zero, show display b, on time zero, show display c etc. Audio starts the display and ends it so the user.

Is there a way to allow audio permissions to be selected on one page and have that carry throughout the solution? Maybe through global variables?

If you could assist, it would be much appreciated - my brain is strained trying to work it out. I can provide the files if you can suggest a way for you to take a look for better context.

Thanks in advance. And thanks for all the support (forum and videos) you provide. They're really useful.

Re: play audio automatically in HTML5

PostPosted: Wed Jan 27, 2016 12:37 pm
by Nav
So is this the same sound(s) being used over and over again? A start chime, and a stop chime? Or is there other audio that is going on in between?

I don't really understand what you're trying to do. Can you tell us the name of your lesson? You can email us at support@smartbuilder and we can find your lesson. Is the lesson already set up (or partially set up) and working on a computer?

The simple answer is no, you cannot pre-approve audio permissions. If that were possible, we would definitely recommend it to everyone! We simply don't have the control to override the mobile browsers' behaviour. However, if you're constantly reusing the same sounds (and that's it), perhaps you can have them manually play the audio once, and then just tell that same audio to start over and play again. If it's all different audio, then there's nothing you can really do (until Apple changes their stance).

- Nav

Re: play audio automatically in HTML5

PostPosted: Wed Jan 27, 2016 5:47 pm
by Nav
Thanks for sending the lesson name (via email - for those of you finding this thread later). So here's the solution that I propose. And this is assuming that you just have a "start" sound and an "end" sound that you're re-using again and again. This whole thing falls apart if you want to have different audios playing at different times (for example, audio instructions / voice over / etc).

If you move the audio to the Master Page, you still need the learner to manually click on each audio once. There is no way around that. But, you can prompt the user to click on them, by describing what to do "Click the audio to the right to hear the sound that tells you to begin the activity..."

Once they have played each audio, you can hide the audio objects. You can still play hidden audio objects. So you just keep playing those exact same audios on the Master Page whenever you want the sound. You can use Global Events to trigger the playing of each.

There's no getting around the permissions issue. But technically the learner started the audio manually once, and you're just replaying the same audio, which is allowed.

Here's a video that explains it in a simple lesson -

Here's the sample you can try on your mobile device - ... index.html (note - you have to press the audio objects first).

Hope that helps. It's a workaround to a problem that we don't have any control over.

Re: play audio automatically in HTML5

PostPosted: Wed Jan 27, 2016 6:46 pm
by belvistastudios
Awesome. Thanks for your suggestion. I will give it a go and watch the videos too.

I appreciate you looking into it for me. Have a great day.

Not able to open ./cache/data_global.php