Forum Discussion

TravisMurrayLXD's avatar
TravisMurrayLXD
Community Member
4 days ago
Solved

Audio not playing in Review 360 or S3

Midway through my SL project, I have audio triggered to play using an "Execute Javascript" trigger. (I can explain why I needed to do it this way at the bottom 👇 if you care to know). 

It plays perfectly when previewed in SL but when published to Review 360 or Amazon S3, it does not play.

From what I've researched on this topic, it looks like browsers' strict autoplay policies are the culprit-- the solution being that I need to allow the user to "interact with the domain", so click or do something first. 

However, I'm confused why this is happening if the user has already completed more than dozen interactions up to this point in my course. And right before the Javascript triggers the audio, at least in one instance where this is occurring, users are interacting. 

Here is the flow:

➡️ Slide starts (this isn't first slide, it's the 2nd slide in the second scene)
➡️ Audio is on base layer (the only thing there)
➡️ When timeline starts on base layer, immediately shows "Interactivity" layer
➡️ When user clicks a button, timeline continues and reaches a cue point.
➡️ When the cue point is reached, "Execute Javascipt" fires and plays the audio from the base layer, which runs in the background, independent of pauses and interactions on the "Interactivity" layer. 
➡️ Audio fades out (again with Javascript trigger) at the end

I'd love any input on how to make this play nice in Review 360 and S3. Thank you!



P.S. Why I'm using Javascript to play the audio: I needed to play background music on this slide that would do three important things that SL can't do otherwise: 

✅ Run in the background despite pauses in the timeline
✅ Fade out at the end of the slide, but only when a user clicks a final "Continue" button (because every user could arrive at the final continue button at different times depending on how long it took them to click during the slide interactions)
✅ Restart and replay the audio in the case that a user lingered longer on the slide than the duration of the audio track OR if they replay the slide to do it again

  • Here is where I landed...

    After battling with this all day with no fix, I realized I could just use a "Play media" trigger to play the audio in the base layer and then use a JS trigger at the very end, just before the timeline ends, to reset the audio, in the case that the user clicks "replay".

    💥 In summary: Storyline takes care of the audio start, JS takes care of the fade and reset. That creates no issues when published to Review 360 or S3. 

    Thank for you help PhilMayor​ and I hope this saves someone out there a lot of time in the future! 

8 Replies

  • First thing I would check is the console do you have any errors, if one piece of code goers down they all go down

    • TravisMurrayLXD's avatar
      TravisMurrayLXD
      Community Member

      Thanks for your response PhilMayor​!

      I did what you suggested and discovered that Storyline isn't compiling the JavaScript triggers when I publish. The code works fine in preview mode, but when I publish to Review 360 or web (Amazon S3), I get 'Script not defined' errors - even for a simple one-line test. This appears to be a file corruption or Storyline software issue, not a problem with the actual JavaScript code.

      I closed the project and created a simple slide with a test button with a simple Javascript test and that worked. So it looks the issue is somewhere/somehow within my project itself.

      So I'm thinking I need to try to maybe copy everything into a fresh project in SL and redo the Javascript triggers from scratch. Do you think this will solve what appears to be a corrupted project file?

      Thank you! 


      • PhilMayor's avatar
        PhilMayor
        Super Hero

        I suspect you have an error in the code in one of your triggers. 

        the way storyline executes code one error can poison your code so it stops

        executing and you can get undefined errors. The simple way to check if your code is being included is to publish and look in the user.js file it should all be there. 

        you should have an error in the console to give you a line number of where your error is.