createItems(items=[]) {
    // Add an OFF menu item to turn all tracks off
    items.push(new OffTextTrackMenuItem(this.player_, { 'kind': this.kind_ }));

    let tracks = this.player_.textTracks();

    if (!tracks) {
      return items;
    }

    for (let i = 0; i < tracks.length; i++) {
      let track = tracks[i];

      // only add tracks that are of the appropriate kind and have a label
      if (track['kind'] === this.kind_) {
        items.push(new TextTrackMenuItem(this.player_, {
          'track': track
        }));
      }
    }

    return items;
  }
// Create a menu item for each text track
Create a menu item for each text track
Create a menu item for each text track
createItems(items=[]) {
    items.push(new OffTextTrackMenuItem(this.player_, { 'kind': this.kind_ }));
    let tracks = this.player_.textTracks();
    if (!tracks) {
      return items;
    }
    for (let i = 0; i < tracks.length; i++) {
      let track = tracks[i];
      if (track['kind'] === this.kind_) {
        items.push(new TextTrackMenuItem(this.player_, {
          'track': track
        }));
      }
    }
    return items;
  }
createItems ( items = [ ] ) { items . push ( new OffTextTrackMenuItem ( this . player_ , { 'kind' : this . kind_ } ) ) ; let tracks = this . player_ . textTracks ( ) ; if ( ! tracks ) { return items ; } for ( let i = 0 ; i < tracks . length ; i ++ ) { let track = tracks [ i ] ; if ( track [ 'kind' ] === this . kind_ ) { items . push ( new TextTrackMenuItem ( this . player_ , { 'track' : track } ) ) ; } } return items ; }
Create a menu item for each text track
Create a menu item for each text track
// Add an OFF menu item to turn all tracks off // only add tracks that are of the appropriate kind and have a label