Audio elements missing from index_lms_html5
Oct 09, 2017
Hi all.
Both the story.html and story_html5.html, when run locally or off a web server, have <audio> elements appended to them. This has allowed me to write a script that will find all the <audio> elements on a page, and pause/mute them. This works perfectly when running locally.
I uploaded the same course to scormcloud, everything works fine in IE, I can see the <audio> elements fine and I can control them using Javascript. In Chrome, the elements are not generated, or if they are then they are only created for the duration that the audio plays (nothing seems to suggest that this is how it works).
My first thought, upon seeing that there are no <audio> elements, was that maybe they are being created as Javascript objects, using new audio(), but I can't find any code in the entire output that would suggest this.
The network tab of the Chrome developer tools shows that all of audio files are loading, so the issue can't be around files not loading correctly.
How is the audio still playing when there are no <audio> elements or audio objects?
How can I use Javascript to control these non-existent audio objects?
Any insight into how (or why?!) audio is generated differently when run off of an LMS would be great.
9 Replies
I've spent some more time looking into this issue. I still can't find any reason why the story_html5 and index_lms_html5 would output audio differently.
Update:
It appears that audio is loaded via XHR when run off a server that allows XHR, with the generation of html5 <audio> tags being a fallback... this is all well and good, but it creates discrepancies when viewing courses on different browsers.
For those interested in a fix, so you can play with audio using javascript, replace the function on line 29,238 with the following -
This is the same code that is used to generate the <audio> elements when viewing a course locally.
My above fix appears to be working perfectly. I wouldn't recommend messing with the minified js files, but if you do break something you can easily republish.
Edit: Could someone from the dev team let me know why the output is different?
Another quick update, as I'm the only one posting.
This only works in HTML5. I'm outputting to HTML5 only, so this is fine for my course, obviously if you need a Flash fallback, then this isn't for you.
Any kind of comment from the staff would be very helpful.
Hi chiefy,
Sorry for the delay in getting to you here! As a note for future, our team is always monitoring the forums but we're reading oldest to newest, so new comments may keep this out of our view for a bit. 🙂
If you ever need immediate assistance, you're always welcome to contact our Support team here. They're around 24/7!
I took a look at the information you shared, and it's a bit beyond the scope of what we support when it comes to Javascript and modifications of our published output. I can ping a few members of our team to see if they can weigh in, but I know there are a handful of ELH community members who are Javascript pros - so I hope they can shed some light on this for you too!
Thanks, and let me know if you need anything else.
Thank you for getting back to me!
Giving us the ability to control the audio of the HTML5 output with Javascript is incredibly useful, obviously consistency between where and how it's published is very important. Hopefully someone from the team will know more.
Hi Chiefy,
I checked in with my team, and they agreed it's not something we'd be equipped to help with, but hopefully folks in the community can chime in to assist here.
This discussion is closed. You can start a new discussion or contact Articulate Support.