createMenu() {
    let tracks = this.player_.textTracks() || [];
    let chaptersTrack;
    let items = this.items = [];

    for (let i = 0, l = tracks.length; i < l; i++) {
      let track = tracks[i];
      if (track['kind'] === this.kind_) {
        if (!track.cues) {
          track['mode'] = 'hidden';
          /* jshint loopfunc:true */
          // TODO see if we can figure out a better way of doing this https://github.com/videojs/video.js/issues/1864
          window.setTimeout(Fn.bind(this, function() {
            this.createMenu();
          }), 100);
          /* jshint loopfunc:false */
        } else {
          chaptersTrack = track;
          break;
        }
      }
    }

    let menu = this.menu;
    if (menu === undefined) {
      menu = new Menu(this.player_);
      menu.contentEl().appendChild(Dom.createEl('li', {
        className: 'vjs-menu-title',
        innerHTML: toTitleCase(this.kind_),
        tabIndex: -1
      }));
    }

    if (chaptersTrack) {
      let cues = chaptersTrack['cues'], cue;

      for (let i = 0, l = cues.length; i < l; i++) {
        cue = cues[i];

        let mi = new ChaptersTrackMenuItem(this.player_, {
          'track': chaptersTrack,
          'cue': cue
        });

        items.push(mi);

        menu.addChild(mi);
      }
      this.addChild(menu);
    }

    if (this.items.length > 0) {
      this.show();
    }

    return menu;
  }
/**
   * Create menu from chapter buttons
   *
   * @return {Menu} Menu of chapter buttons
   * @method createMenu
   */
Create menu from chapter buttons
@return {Menu} Menu of chapter buttons
@method createMenu
Create menu from chapter buttons @return { Menu } Menu of chapter buttons @method createMenu
createMenu() {
    let tracks = this.player_.textTracks() || [];
    let chaptersTrack;
    let items = this.items = [];
    for (let i = 0, l = tracks.length; i < l; i++) {
      let track = tracks[i];
      if (track['kind'] === this.kind_) {
        if (!track.cues) {
          track['mode'] = 'hidden';
          window.setTimeout(Fn.bind(this, function() {
            this.createMenu();
          }), 100);
        } else {
          chaptersTrack = track;
          break;
        }
      }
    }
    let menu = this.menu;
    if (menu === undefined) {
      menu = new Menu(this.player_);
      menu.contentEl().appendChild(Dom.createEl('li', {
        className: 'vjs-menu-title',
        innerHTML: toTitleCase(this.kind_),
        tabIndex: -1
      }));
    }
    if (chaptersTrack) {
      let cues = chaptersTrack['cues'], cue;
      for (let i = 0, l = cues.length; i < l; i++) {
        cue = cues[i];
        let mi = new ChaptersTrackMenuItem(this.player_, {
          'track': chaptersTrack,
          'cue': cue
        });
        items.push(mi);
        menu.addChild(mi);
      }
      this.addChild(menu);
    }
    if (this.items.length > 0) {
      this.show();
    }
    return menu;
  }
createMenu ( ) { let tracks = this . player_ . textTracks ( ) || [ ] ; let chaptersTrack ; let items = this . items = [ ] ; for ( let i = 0 , l = tracks . length ; i < l ; i ++ ) { let track = tracks [ i ] ; if ( track [ 'kind' ] === this . kind_ ) { if ( ! track . cues ) { track [ 'mode' ] = 'hidden' ; window . setTimeout ( Fn . bind ( this , function ( ) { this . createMenu ( ) ; } ) , 100 ) ; } else { chaptersTrack = track ; break ; } } } let menu = this . menu ; if ( menu === undefined ) { menu = new Menu ( this . player_ ) ; menu . contentEl ( ) . appendChild ( Dom . createEl ( 'li' , { className : 'vjs-menu-title' , innerHTML : toTitleCase ( this . kind_ ) , tabIndex : - 1 } ) ) ; } if ( chaptersTrack ) { let cues = chaptersTrack [ 'cues' ] , cue ; for ( let i = 0 , l = cues . length ; i < l ; i ++ ) { cue = cues [ i ] ; let mi = new ChaptersTrackMenuItem ( this . player_ , { 'track' : chaptersTrack , 'cue' : cue } ) ; items . push ( mi ) ; menu . addChild ( mi ) ; } this . addChild ( menu ) ; } if ( this . items . length > 0 ) { this . show ( ) ; } return menu ; }
Create menu from chapter buttons
 @return {Menu} Menu of chapter buttons
 @method createMenu
Create menu from chapter buttons @return { Menu } Menu of chapter buttons @method createMenu
/* jshint loopfunc:true */ // TODO see if we can figure out a better way of doing this https://github.com/videojs/video.js/issues/1864 /* jshint loopfunc:false */