initTracks (player) {
    const
      t = this,
      trackFiles = t.trackFiles === null ? t.node.querySelectorAll('track') : t.trackFiles
    ;
    // store for use by plugins
    t.tracks = [];

    if (trackFiles) {
      player.trackFiles = trackFiles;
      for (let i = 0; i < trackFiles.length; i++) {
        const
          track = trackFiles[i],
          srclang = track.getAttribute('srclang').toLowerCase() || '',
          trackId = track.getAttribute('id') || `${t.id}_track_${i}_${track.getAttribute('kind')}_${srclang}`
        ;
        track.setAttribute('id', trackId);

        const trackData = {
          trackId: trackId,
          srclang: srclang,
          src: track.getAttribute('src'),
          kind: track.getAttribute('kind'),
          label: track.getAttribute('label') || '',
          entries: [],
          isDefault: track.hasAttribute('default'),
          isError: false,
          isLoaded: false
        };
        t.tracks.push(trackData);

        if (track.getAttribute('kind') === 'captions' || track.getAttribute('kind') === 'subtitles') {
          // caption / subtitle handling
          switch (track.readyState) {
            case 2:
              // already loaded
              t.handleCaptionsLoaded(track);
              break;
            case 3:
              // quit loading with error
              t.handleCaptionsError(track);
              break;
            default:
              // is going to be loaded
              track.addEventListener('load', (event) => {
                t.handleCaptionsLoaded(event.target);
              });
              track.addEventListener('error', (event) => {
                t.handleCaptionsError(event.target);
              });
              break;
          }
        } else if (track.getAttribute('kind') === 'chapters') {
          // chapter handling
          switch (track.readyState) {
            case 2:
              t.handleChaptersLoaded(track);
              break;
            case 3:
              t.handleChaptersError(track);
              break;
            default:
              track.addEventListener('load', (event) => {
                t.handleChaptersLoaded(event.target);
              });
              track.addEventListener('error', (event) => {
                t.handleChaptersError(event.target);
              });
              break;
          }
        }
      }
    }
  }
Check for track files and setup event handlers and local track data.
@param {MediaElementPlayer} player