Forum Discussion

DougRoberts-6c3's avatar
DougRoberts-6c3
Community Member
2 months ago

Why can toggling a variable trigger audio on hidden layers?

I have a course where I want a button to toggle voiceover on or off for users. To this end I used a button on a master slide that toggles a variable, then audio on individual slides starts or stops depending on whether the variable changes to true or false.

I thought this would work fine until I discovered that audio on all layers plays regardless of whether or not the layer is shown.

I made a demo Story here -- the slide has a base layer with a button to toggle a variable, and a second layer with audio that plays or stops when the variable changes.

Result: audio on the hidden layer plays when the variable changes to True.

Expected result: only audio on visible layer(s) plays.

  • Nedim's avatar
    Nedim
    Community Member

    This is certainly unexpected behavior. However, it suggests that audio in Storyline is not strictly tied to a specific layer, slide, or even a slide property. Instead, Storyline seems to manage audio files separately, storing them in a content folder within the project. This means that audio can play independently of the layer or slide it is associated with, depending on how it's triggered or toggled.

    In your example, the audio is triggered based on the value of a variable and is technically played directly from its source, rather than from the layer where it resides. For instance, on a blank slide, the same audio can be played directly from its source using JavaScript, even if it's not added to the slide itself, whereas media triggers typically only control audio files assigned to specific layers.
    Whether it's a bug or not, you’ve certainly discovered something that could be advantageous to others.

    However, I experimented with your file and managed to stop the audio from playing on the other layer when a button is clicked on the base layer. Although this workaround addresses the issue, I’m not certain it will help you achieve the more complex functionality you initially intended.

  • Thanks for talking a look. I appreciate your attempt to solve -- it works of course, but it's too labour-intensive for what I need to do now (dozens of layers).

    I was interested to see if it works the same for video files -- it does, but only if the video has loaded first, by visiting the layer then hiding it.