vimeo / player.js

Interact with and control an embedded Vimeo Player.
https://player.vimeo.com/api/demo
MIT License
1.45k stars 262 forks source link

Request: Get Chapters from Player #551

Closed CalebKester closed 4 years ago

CalebKester commented 4 years ago

There's support for TextTracks. Could we get support for getting Chapters from this? Or is this planned for the future? https://developer.vimeo.com/api/upload/texttracks

danrossi commented 4 years ago

The old way is you put them in the description and parse them for navigation. There is now a "getCuepoints" api. I assuming these are for chapters, is there an example video for that ?

danrossi commented 4 years ago

I have a video with chapter markers. That displays in non pro mode in the embedded player controlbar. But to obtain this data to include in a custom controlbar shows up as empty data. Is this the correct api method ?

this.vimeoPlayer.getCuePoints().then(function(cuePoints) {
                  console.log("cues", cuePoints);
                }).catch(function(error) {
                     console.log("cues", error);
                  switch (error.name) {

                      case 'UnsupportedError':
                          // Cue points aren't supported by the current player or browser
                          break;

                      default:
                          // Some other error occurred
                          break;
                  }
                });
CalebKester commented 4 years ago

Official Chapters were released a few months ago: https://vimeo.com/blog/post/easy-navigation-for-your-videos-with-chapters/

I've looked through all of their API and player.js and there's no way to get this chapter information out of a video.

fisherinnovation commented 4 years ago

Thanks for your feedback everyone! We have this item on the roadmap and expect to add support for Chatper data in the near future. I will ensure this thread is updated when that happens.

danrossi commented 4 years ago

OK what is the getCuePoints method then ? Is this chapter data available in the api endpoint ?

The old way Ive been parsing chapter markers. Is within the description.

steve52 commented 4 years ago

@danrossi , the getCuePoints() method returns cuePoints added using out addCuePoint() method. https://developer.vimeo.com/player/sdk/reference#add-a-cue-point-to-a-video

As @fisherinnovation said, a getChapters() method is something we've been planning to add to our Player SDK. ever since we released Chapters. I'm working on it now and it should be available in a few days. I'll update this thread when it's in production!

steve52 commented 4 years ago

@CalebKester @danrossi , getChapters(), getCurrentChapter(), and a chapterchange event have all been added to the player and this library! Feel free to use and leave any feedback for more improvements. :)

https://github.com/vimeo/player.js/blob/master/README.md#getchapters-promisearray-error https://github.com/vimeo/player.js/blob/master/README.md#getcurrentchapter-promiseobject-error https://github.com/vimeo/player.js/blob/master/README.md#chapterchange

CalebKester commented 4 years ago

Thanks @steve52 . I pulled it from github (npm isn't updated yet) and it's doing exactly what I would expect. I'll report back after I use it more if I have any issues. Thanks again for the quick turnaround.

steve52 commented 4 years ago

FYI, npm should install the latest version now!

danrossi commented 4 years ago

This works. I get cues and the chapter event works. There is still no qualities api to do quality selection on a custom controlbar. A way to obtain a poster image without calls to a data api would be preferable. Is there such a thing ?