Play Sound Effect on Button Click

_
_ Community Member Posts: 82 ☆ Roadie ☆
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

Comments

  • timk
    timk Community Member Posts: 1,239 ✭ Legend ✭
    Do you have a media file within reach? Otherwise the relevant actions won't show.
  • carlfink
    carlfink Community Member Posts: 1,099 ✭ Legend ✭
    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.
  • _
    _ Community Member Posts: 82 ☆ Roadie ☆
    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.

     
  • _
    _ Community Member Posts: 82 ☆ Roadie ☆
    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?
  • raungnaing
    raungnaing Community Member Posts: 35
    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" ?
  • carlfink
    carlfink Community Member Posts: 1,099 ✭ Legend ✭
    Cam, have you tried turning on the browser's JavaScript debugger and watching exactly where the code gets paused?