async initState_(initState, appData) {
    // Take on player state first.
    for (const k in initState['player']) {
      const v = initState['player'][k];
      // All player state vars are setters to be called.
      /** @type {Object} */(this.player_)[k](v);
    }

    // Now process custom app data, which may add additional player configs:
    this.appDataCallback_(appData);

    const autoplay = this.video_.autoplay;

    // Now load the manifest, if present.
    if (initState['manifest']) {
      // Don't autoplay the content until we finish setting up initial state.
      this.video_.autoplay = false;
      try {
        await this.player_.load(initState['manifest'], initState['startTime']);
        if (initState['addThumbnailsTrackCalls']) {
          for (const args of initState['addThumbnailsTrackCalls']) {
            this.player_.addThumbnailsTrack(...args);
          }
        }
        if (initState['addTextTrackAsyncCalls']) {
          for (const args of initState['addTextTrackAsyncCalls']) {
            this.player_.addTextTrackAsync(...args);
          }
        }
        if (initState['addChaptersTrackCalls']) {
          for (const args of initState['addChaptersTrackCalls']) {
            this.player_.addChaptersTrack(...args);
          }
        }
      } catch (error) {
        // Pass any errors through to the app.
        goog.asserts.assert(error instanceof shaka.util.Error,
            'Wrong error type! Error: ' + error);
        const eventType = shaka.util.FakeEvent.EventName.Error;
        const data = (new Map()).set('detail', error);
        const event = new shaka.util.FakeEvent(eventType, data);
        // Only dispatch the event if the player still exists.
        if (this.player_) {
          this.player_.dispatchEvent(event);
        }
        return;
      }
    } else {
      // Ensure the below happens async.
      await Promise.resolve();
    }

    if (!this.player_) {
      // We've already been destroyed.
      return;
    }

    // Finally, take on video state and player's "after load" state.
    for (const k in initState['video']) {
      const v = initState['video'][k];
      this.video_[k] = v;
    }

    for (const k in initState['playerAfterLoad']) {
      const v = initState['playerAfterLoad'][k];
      // All player state vars are setters to be called.
      /** @type {Object} */(this.player_)[k](v);
    }

    // Restore original autoplay setting.
    this.video_.autoplay = autoplay;
    if (initState['manifest']) {
      // Resume playback with transferred state.
      this.video_.play();
      // Notify generic controllers of the state change.
      this.sendMediaStatus_();
    }
  }
Take on initial state from the sender.
@param {shaka.cast.CastUtils.InitStateType} initState
@param {Object} appData
@private