Video timestamp

Apr 11, 2024

I have searched for this and had a couple of failed attempts using javascript. Can I get the current timestamp of a video on the slide.

For context the video plays independent of the timeline and has a scrubber and I want to trigger specific items at specific times of the video. I will continue messing with javascript and post the results if I find an answer

3 Replies
Nedim Ramic

Hi Phil,

I've been working on a similar concept for a while now. I've successfully manipulated the video independently from the timeline. This is the basic set up to integrate with Storyline:

let video = document.getElementsByTagName('video')[0];
video.duration;
video.currentTime;

video.ontimeupdate = function() { getVideoTimes() };

function getVideoTimes() {

    let player = GetPlayer();
    player.SetVar('currentTime', video.currentTime);
    player.SetVar('duration', video.duration);
    
    console.log(video.currentTime);
    console.log(video.duration);    
}