brightcove / videojs-thumbnails

A video.js plugin that displays thumbnail images over the scrubber.
Other
168 stars 97 forks source link

How to generate the thumbnail object array? #2

Closed tim-peterson closed 11 years ago

tim-peterson commented 11 years ago

I'm confused on how to generate the object array of thumbnails. Can you make it clear somewhere in the documentation (Readme.md) how this is done in Javascript?

The issue i'd think many people including myself have is how to generate an array with numeric keys.

      0: {
        src: '/assets/img/01.png'
      },
      5: {
        src: '/assets/img/02.png'
      },
      10: {
        src: '/assets/img/03.png'
      }

I created a gist which doesn't work but at least would get us started on how people should be generating this array https://gist.github.com/tim-peterson/5610133

dmlap commented 11 years ago

The thumbnails plugin takes an object with numeric keys, not an array. If you wanted to setup a different thumbnail to display every five seconds dynamically, you might try something like this:

var options = {}, i = 10;
while (i--) {
  options[i * 5] = { src: '/assets/img' + (i * 5) + '.jpg' };
}