Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #353756 Score: 0
    Profile photo of Jurg van der Vlies
    Jurg van der Vlies
    curious george
    wise owl
    1 pt

    Hi, I want to change the current time of the video player by executing Javascript. I have added an action to a button that executes Javascript. It runs:

    var vid = document.getElementById(“video10”); vid.currentTime = 5;

    But the video player does not skip to 00:05.00. It doesn’t work at all.

    Is there anyone that can help me out?

    #353764 Score: 1
    Profile photo of Joe Wieloch
    Joe Wieloch
    friend finder
    LUC16 Attendee
    verified member
    wise owl
    14 pts

    I see you know the html name of the video object (which can be found in the properties tab of the video object by hovering over the popup “more” button in the audio panel under edit events).

    It’s easy in Lectora Online you would just use the html name to reference the object and call a JavaScript method:


    You can also retrieve the current time:


    One thing I like to do in my scripting is to set an additional variable dynamically so I can reuse the scripting in other titles.  So I would point to my video object with a known variable.

    Add an action to your video object, trigger On Page Show, action Run JavaScript:

    window.MyMainVideo = %HTMLNAME%;

    Now when calling APIs on that video object I can use my known reference, and this makes my scripts portable if I copy the video and scripting to another title.

    For example:  MyMainVideo.setTrackTime(5);   will always resolve to the correct html name for the associated video!





    This post has received 1 vote up.
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.