Forum Discussion
JavaScript to prevent user to force learners to watch entire video
The script you don’t want to use
As an e-learning developer, I don’t want to force learners to watch a video all the way through. Not because it’s technically difficult — quite the opposite — but because playback time is not a guarantee of learning.
We all know the reality: as soon as a video starts, it becomes a coffee moment or an ALT+TAB moment for many learners. The video continues playing, but the learner’s attention is elsewhere. “When media completes” often just means that time has passed — not that the content has actually been absorbed.
This is something that comes up regularly in discussions with clients and accrediting bodies. Sometimes, despite your best efforts, it’s not possible to convince stakeholders otherwise. I’ve even encountered situations where accrediting organizations request a modified version of the same e-learning, allowing them to skip required elements during their own review process.
A key limitation in Storyline is that you cannot dynamically control the video player at runtime. While feature requests can be submitted, there is currently no built-in way to reliably prevent seeking or playback speed changes based on runtime logic.
That’s why I developed a JavaScript solution that prevents learners from seeking forward or changing playback speed. It avoids workarounds such as placing transparent overlays on top of the video or building a custom video player. Instead, a Storyline variable controls whether the video remains locked or whether full playback control is restored.
It’s the script you don’t want to use — but sometimes need to.
GitHub repository (documentation and source files):
https://github.com/ChrisDornaELearning/Articulate-Storyline-Locked-videoplayer
Articulate Review example:
https://360.articulate.com/review/content/b22d968d-65b0-4a0f-9bdb-90c6c8a0c9b5/review
4 Replies
- PhilMayorSuper Hero
I popped in here to say why would you do this, and then saw it was you ChrisDorna and thought he wouldn't post that.
Great solution for a problem we shouldn't have to find one for.
- RitaBrasCommunity Member
Good afternoon Chris,
I have a course with several videos and I would like to use your solution. Is this solution designed only for a course with a single video, or can I use the code for multiple videos within the same course?
Thank you.
- ChrisDornaCommunity Member
Hi Rita,
You can use this script on a regular slide (if your project contains only one video) or on the master slide. In the latter case, you need an additional variable called startJavaScript.
On the slide where a video needs to be (un)locked, set the variables videoObjectId and videoLocked, and then toggle the startJavaScript variable.
On the master slide, add a trigger with the JavaScript that fires when the startJavaScript variable changes.
I made also a small change in the script. You can download it here:
- SamHillSuper Hero
Just here to make a comment on accessibility and video for anybody considering using this and other things you need to consider.
When preventing users from changing the speed of playback, you are affecting accessibility. Users may need to slow video down for comprehension (especially where the language is not the users first language). Users may also want to speed it up, for example screen reader users who are used to consuming audio information at much quicker speeds.
Finally, make sure you have a text transcript available for users who cannot use the video. You can't force people to read the transcript, like you can't force people to watch a video, but opening a transcript should trigger the same event that the end of the video does!
As ChrisDorna said, it's the (clockwork orange) script you should try and avoid, but there are going to be valid use cases out there, just keep accessibility at the forefront.