Is there a better way to set Event triggers on a video

sirwise23
sirwise23 Community Member Posts: 442 ☆ Roadie ☆
Hello,

I was wondering if anyone using the video editor to set event points on videos and if there is a better way than having to do this.

I used to rely on this much more in the past. Microsoft used to have its own tool that was much better but only worked with WMV files. The Lectora Video Editor software is very dated and I feel like it does a horrible job on non-high end machines. I believe it works by uncompressing the entire video, letting you add the event markers, and then re-encoding the whole thing again. This was fine 6 years ago but as video files get larger with the better bandwidth, this software can't handle it as well.
I know using JavaScript I have set up ways to pause, play, and jump to times on a MP4 file in Lectora. I was wondering if there was also a JavaScript method of having actions or an action group run at specific video times.

Or please tell me that the next release of Lectora will have something new for this so I don't spend too much time implementing a process here.

Thanks,
Laz

Comments

  • ssneg
    ssneg Community Member Posts: 1,466 ☆ Roadie ☆
    NB! The below info needs to be confirmed by a Lectora dev.

    I think that Lectora stores the event timings inside Lectora project file, not the video file. So if you switch video file to another, timings should still work. And technically you should not require the editor to set the timings. You could just enter those in Lectora or use a much simpler software than the obsolete video editor.

    However, Lectora still somehow changes the video file after you set the timings (I guess it adds timing info to metadata), and it also requires you to actually install the video editor to work with timings. I, too, look forward to the video editor being replaced with a much lighter version based on the HTML5 player Lectora uses in the rest of the application.
  • klaatu
    klaatu Community Member Posts: 988
    Yes, if all you're looking to do is fire off actions at time intervals there is a pretty easy method.
    In the attached example I trigger an action that shows a picture at 10 seconds, 15 seconds, 20 seconds and 25 seconds.

    The following function will check the current time of the running video every .05 seconds and trigger actions accordingly. You can fire off a group of actions using runGroup_ogXX() replacing the XX with the HTML Name of the group.

    You will need to change the video125 in the script above to the HTML Name of your video player.

    If you wish, you can uncomment the console log line by removing the two // so you can see time fly (in the dev console).

    --------------   code   --------------

    setInterval(function() {
    var time = video125.mediaElement.currentTime;
    //console.log(time);
    if (time >10.0 && time <10.5){
    action340();
    } else if (time >15.0 && time <15.5){
    action344();
    } else if (time >20.0 && time <20.5){
    action346();
    } else if (time >25.0 && time <25.5){
    action348();
    }
    }, 50);

    ------------------------------------------------------------

    Is this what you are looking for?

    Keep in mind that if you copy and paste the code above you will have to replace the quotes, they do not copy over correctly.
  • sirwise23
    sirwise23 Community Member Posts: 442 ☆ Roadie ☆
    @Sergey  When using the video editor it is actually making a change to the video itself.  The AWT file stores what you want to do with the events but the markers are saved into the video.    If you switch a video the markers go away and if you put that video in a different project the markers go with it.  This is what takes the Video Editor so long.   When I used to use the Windows Media File Editor it was much faster because I think all it did was write the timing out in the header of the file without doing a decode and encode.

    @Darrel  This looks more like what I was thinking.  Now that things are using the HTML5 Player like Sergey mentioned I figured there was easier ways to do things like this.

     
  • dlueken
    dlueken Community Member Posts: 13
    @Lazaro - You are correct.  The event points are stored in the video resource file itself and the actions connected to these events are in the video object which is stored in the AWT.  We have an improvement on our backlog to move the event points to the object so that the video can be replaced without recreating all of the event hooks.
  • ssneg
    ssneg Community Member Posts: 1,466 ☆ Roadie ☆
    @Darin, well, Lectora does store all the event information inside the AWT file (see pic). And the way the event firing functionality is built IIRC is that Lectora monitors the playhead position and if playhead is at the event timing point, it will fire the event. It never bothers to check what's inside the file.



    So if you replace the mp4 files in the published output, the events will still fire. I checked.

    Now the Lectora editor does rely on events being embedded in the file for some reason (unfortunately), and it reads them from the video file, not from the project file (although the events are stored in the project file). So if you replace the video files in your project, all events will be lost.