Firing a trigger after a video is fully loaded using JavaScript

Oct 29, 2021

Hi everybody!

We are looking for a way to fire a trigger after a video has been fully loaded. In theory, this should be possible using JavaScript.

The background:

We have a project in which a rather large video file is implemented in a way that allows the user to instantly jump to a part near the end of the video. As Storyline appears to progressively load the video beginning at the start of the file, this causes issues on slower connections, as later parts of the video aren't loaded yet.

We are thus looking for a way to stop the user from interacting with the video before it is fully loaded. We have a boolean variable ("loadingFinished") that, once toggled, allows the user to interact with the video. We now need that boolean variable to be toggled as soon as the video is fully loaded.

We have experimented with JavaScript triggers and tried possible solutions like, for instance, this:

let player = GetPlayer();

document.addEventListener("DOMContentLoaded", function () {

player.SetVar("loadingFinished", true);

});


Sadly, none of our attempts to solve this issue were successful yet. Could anyone maybe help us out here?

Any help would be greatly appreciated!

Cheers,

Stephan

1 Reply