getInitState_() {
    const initState = {
      'video': {},
      'player': {},
      'playerAfterLoad': {},
      'manifest': this.localPlayer_.getAssetUri(),
      'startTime': null,
      'addThumbnailsTrackCalls': this.addThumbnailsTrackCalls_,
      'addTextTrackAsyncCalls': this.addTextTrackAsyncCalls_,
      'addChaptersTrackCalls': this.addChaptersTrackCalls_,
    };

    // Pause local playback before capturing state.
    this.localVideo_.pause();

    for (const name of shaka.cast.CastUtils.VideoInitStateAttributes) {
      initState['video'][name] = this.localVideo_[name];
    }

    // If the video is still playing, set the startTime.
    // Has no effect if nothing is loaded.
    if (!this.localVideo_.ended) {
      initState['startTime'] = this.localVideo_.currentTime;
    }

    for (const pair of shaka.cast.CastUtils.PlayerInitState) {
      const getter = pair[0];
      const setter = pair[1];
      const value = /** @type {Object} */(this.localPlayer_)[getter]();

      initState['player'][setter] = value;
    }

    for (const pair of shaka.cast.CastUtils.PlayerInitAfterLoadState) {
      const getter = pair[0];
      const setter = pair[1];
      const value = /** @type {Object} */(this.localPlayer_)[getter]();

      initState['playerAfterLoad'][setter] = value;
    }

    return initState;
  }
@return {shaka.cast.CastUtils.InitStateType} initState Video and player
  state to be sent to the receiver.
@private