Play Sound Effect on Button Click
February 20, 2020 12:00 AM
Hi Everyone,
I'd like to add some sound effects to my buttons to spice up the UI a little bit - though I can't figure out for the life of me how to do it!
Lectora has Mute/Unmute Media actions, but no "Play Media File" actions.
Am I missing something?
Thanks,
Cam
Discussion (6)
Do you have a media file within reach? Otherwise the relevant actions won't show.
To expand on Tim's comment, insert a media file onto the page (or section, or whatever unit) and you will then be able to play it. You have to do it in that order.
Lectora handles autoplay media by putting up a message "Tap / click here to continue" when you first launch the title. You should see this message if you have autoplay media on the first page or an "on show" action (or other "hands-off" action) that plays a media on the first page. If you have those on subsequent pages, Lectora will not show that message because the user would have done some interaction with the browser and the autoplay would work fine.
Do you see the message "Tap / click here to continue" ?
Cam, have you tried turning on the browser's JavaScript debugger and watching exactly where the code gets paused?
However - a new issue!
My Javascript works fine when the audio is triggered by a user action (e.g. clicking) but not on anything "hands-off" (e.g. showing a hidden object).
My web browser blocks this as "autoplaying" audio... does anyone know of a workaround that doesn't involve the user manually turning this off in their browser?
Wow, it's that simple - I'm a goose!
I actually got this working with Javascript by adapting @timk's awesome demo Lectora Player demo (can't link to it as the forum says there's a security error with my post??)
So I have the audio files at the top AU level and play them with Javascript, rather than having the audio files on every page which is nice.
undefined
Discussions have been disabled for this post