Search code examples
javascripthtml5-videopopcornjs

Change a Cue start time in Popcorn.js?


I need to change a Cue point in a video using Popcorn.js. Is there a way to edit the time of a Cue event already sent to he Popcorn player via the Cue() method?

Thanks!


Solution

  • var events = Popcorn.getTrackEvents();
    for (var e in events) {
      Popcorn.removeTrackEvent(events[e]._id);
    }
    Popcorn.cue(newTime, newFunction);
    

    Its not exactly the editing the event, but it works fine for me - i need to replace everything and then play video again.

    There are also getTrackEvent(obj, id) and getLastTrackEventId(obj) - you can handle each event separately (i did not tested it).

    It looks it will be implemented in new release 1.3