async createOrLoad() {
    if (this.storedPersistentSessions_.size) {
      this.storedPersistentSessions_.forEach((metadata, sessionId) => {
        this.loadOfflineSession_(sessionId, metadata);
      });

      await this.allSessionsLoaded_;

      const keyIds = (this.currentDrmInfo_ && this.currentDrmInfo_.keyIds) ||
          new Set([]);

      // All the needed keys are already loaded, we don't need another license
      // Therefore we prevent starting a new session
      if (keyIds.size > 0 && this.areAllKeysUsable_()) {
        return this.allSessionsLoaded_;
      }

      // Reset the promise for the next sessions to come if key needs aren't
      // satisfied with persistent sessions
      this.hasInitData_ = false;
      this.allSessionsLoaded_ = new shaka.util.PublicPromise();
      this.allSessionsLoaded_.catch(() => {});
    }

    // Create sessions.
    const initDatas =
        (this.currentDrmInfo_ ? this.currentDrmInfo_.initData : []) || [];
    for (const initDataOverride of initDatas) {
      this.newInitData(
          initDataOverride.initDataType, initDataOverride.initData);
    }

    // If there were no sessions to load, we need to resolve the promise right
    // now or else it will never get resolved.
    // We determine this by checking areAllSessionsLoaded_, rather than checking
    // the number of initDatas, since the newInitData method can reject init
    // datas in some circumstances.
    if (this.areAllSessionsLoaded_()) {
      this.allSessionsLoaded_.resolve();
    }

    return this.allSessionsLoaded_;
  }
Creates the sessions for the init data and waits for them to become ready.

@return {!Promise}