Explore the community Forums Lectora Lectora Questions & Answers Play Sound Effect on Button Click

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #439484 Score: 0
    Profile photo of Cam Phillips
    Cam Phillips
    Member
    beginner
    intermediate
    friend finder
    wise owl
    curious george
    contributor
    19 pts
    @_

    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

    #439503 Score: 1
    Profile photo of Tim K
    Tim K
    Member
    contributor
    beginner
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    wise owl
    curious george
    Group Member
    352 pts
    @timk

    Do you have a media file within reach? Otherwise the relevant actions won’t show.

    This post has received 1 vote up.
    #439513 Score: 1
    Profile photo of CarlFink
    CarlFink
    Member
    beginner
    intermediate
    contributor
    LUC16 Attendee
    wise owl
    curious george
    advanced
    36 pts
    @CarlFink

    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.

    This post has received 1 vote up.
    #439750 Score: 0
    Profile photo of Cam Phillips
    Cam Phillips
    Member
    beginner
    intermediate
    friend finder
    wise owl
    curious george
    contributor
    19 pts
    @_

    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.

     

    • This reply was modified 4 months, 2 weeks ago by Profile photo of Cam Phillips Cam Phillips.
    • This reply was modified 4 months, 2 weeks ago by Profile photo of Cam Phillips Cam Phillips.
    #439754 Score: 0
    Profile photo of Cam Phillips
    Cam Phillips
    Member
    beginner
    intermediate
    friend finder
    wise owl
    curious george
    contributor
    19 pts
    @_

    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?

    #439790 Score: 1
    Profile photo of Robert Aung-Naing
    Robert Aung-Naing
    Member
    beginner
    intermediate
    friend finder
    profile
    wise owl
    contributor
    18 pts
    @raungnaing

    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” ?

    This post has received 1 vote up.
    #439795 Score: 0
    Profile photo of CarlFink
    CarlFink
    Member
    beginner
    intermediate
    contributor
    LUC16 Attendee
    wise owl
    curious george
    advanced
    36 pts
    @CarlFink

    Cam, have you tried turning on the browser’s JavaScript debugger and watching exactly where the code gets paused?

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.