Explore the community Forums Lectora Lectora Questions & Answers Play/Pause with multiple audio files

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #349526 Score: 0
    Profile photo of Karen Johnson
    Karen Johnson
    Member
    beginner
    intermediate
    friend finder
    wise owl
    @kjohnson7704

    I have tabs each with it’s own audio file that plays when tab is clicked. I want a Pause/Play button on page that will pause all events/audio when clicked and then pick up where left off when click again. Any suggestions?  I already have stops on all other audio if you are on a certain tab.

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

    The pause button is easy: Add actions to “Pause” each audio.

    For the play button you need to know which audio has been playing, i.e. which tab is opened.

    Create a variable called “currentTab”. Initial value = 0 (if no tab is opened when the page is loaded) = 1 (if the first tab is opened when the page is loaded).

    Add an action to each tab button.

    On: Click
    Action: Modify variable
    Target: currentTab
    Type: Set equal to
    Value: 1 (for the first tab), 2 (for the second), …

    Add actions to the Play for each audio / tab:

    On: Click
    Action: Play
    Target: audio_1

    Condition: Only if “currentTab” Equal to “1”

    Change the target and the value in the condition for each audio.

    Tim

    #349999 Score: 0
    Profile photo of Karen Johnson
    Karen Johnson
    Member
    beginner
    intermediate
    friend finder
    wise owl
    @kjohnson7704

    Hi Tim,

    Thanks again for your solution. It really helped our course have the functionality it needed.

    Karen

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

You must be logged in to reply to this topic.