videojs-markers icon indicating copy to clipboard operation
videojs-markers copied to clipboard

How can I use this with videojs-playlist?

Open seabasss opened this issue 4 years ago • 1 comments

Hey,

I want to use this with videojs-playlist, but I can't find a way to update the new markers properly when switching track. It seems like videojs-markers gets confused to which timeline it's supposed to put the markers on.

When I'm running this:

player.on('beforeplaylistitem', function() {
   this.markers.removeAll();
});

player.on('playlistitem', function() {
   this.markers({//...});
});

I get this error:

this.markers is not a function

I've also tried:

player.on('beforeplaylistitem', function() {
   this.markers.removeAll();
});

player.on('playlistitem', function() {
   this.markers.add([//...]);
});

And that doesn't give me an error, but the markers are off as soon as I switched track in the playlist. Is there a way to run a this.markers.update() or similar? Thanks!

seabasss avatar Oct 15 '19 01:10 seabasss

I know this is an old post, but I was able to update the markers by completely resetting the plugin.

player.on('playlistitem', function() {
   if (typeof this.markers !== 'function') {
      this.markers.destroy();
   }
   this.markers({//...});
});

uvanchang avatar Feb 17 '22 20:02 uvanchang