javascript - Update button class with video.js markerReached function -


this 1 has got brain in twist.

i'm using great video.js markers plugin , want update menu buttons markerreached callback added plugin, when video hits new chapter corresponding button's class active, until next chapter begins , updates button below.

this each button indicates chapter playing active button next it.

the buttons navigate timestamp in video:

<div class="menu">  <button onclick="setcurtime(2)" type="button" value="2">chapter 1</button> <button onclick="setcurtime(57)" type="button" value="57">chapter 2</button>  </div> 

and here's js chapter markers:

// initialize video.js var video = videojs('current_video');  //load marker plugin video.markers({   markers: [      {time: 2,   text: "chapter 1"},      {time: 57,  text: "chapter 2"},   ] }); 

so should hook markerreached event into?

just add onmarkerreached options,

// initialize video.js var video = videojs('current_video');  //load marker plugin video.markers({   onmarkerreached: function(marker) { /* stuff */ },   markers: [      {time: 2,   text: "chapter 1"},      {time: 57,  text: "chapter 2"},   ] }); 

see example here - http://www.sampingchuang.com/videojs-markers


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -