phloxic / videojs-sprite-thumbnails

Video.js plugin to display thumbnails from a sprite image when hovering over the progress bar
https://lastshiphome.de/en/movie
MIT License
52 stars 13 forks source link

Dynamic sources #14

Closed pork1977 closed 3 years ago

pork1977 commented 3 years ago

Hi, quick question..

When you call the following code for a second time (say the video changed sources) with dynamic data as variables it doesn't seem to update the thumbnail images with the new image source which is passed in. It works first time round so fine there, just wondered if this was by design or if there was something I could do to fix it?

videoPlayer.spriteThumbnails({
    url: "" + my_image_url + "",
    interval: my_interval,
    width: my_width,
    height: my_height
});
phloxic commented 3 years ago

@pork1977 - thanks for bringing this up.

This is not by design, unfortunately. The first port of call for the plugin configuration should be the sources, because if anything thumbnails are a part of the sources, not the player. Classic case: playlists. The excuse for this structural oversight is that, new to Videojs, I quickly whipped up the plugin for my current intended use, and by that time was too focused on the player point of view.

I definitely intend to implement this, and have it more or less prepared except for the actual configuration part. Unfortunately I cannot say when I can finish it because of serious lack of time, sorry.

pork1977 commented 3 years ago

Thanks for the reply @phloxic - totally understand. I stripped out the main function you had in there and popped that into my own project I have (hope you don't mind!) - it works brilliantly so thank you

phloxic commented 3 years ago

@pork1977 see https://github.com/phloxic/videojs-sprite-thumbnails#initialization and https://github.com/phloxic/videojs-sprite-thumbnails#playlist-example

Re-open if you see a problem with this approach.