async function withDrm(player, manifest, action) {
    const net = player.getNetworkingEngine();
    goog.asserts.assert(net, 'Player should have a net engine right now');

    let error = null;

    /** @type {!shaka.drm.DrmEngine} */
    const drm = new shaka.drm.DrmEngine({
      netEngine: net,
      onError: (e) => { error = error || e; },
      onKeyStatus: () => {},
      onExpirationUpdated: () => {},
      onEvent: () => {},
    });

    try {
      drm.configure(player.getConfiguration().drm);
      const variants = manifest.variants;
      await drm.initForStorage(variants, /* usePersistentLicenses= */ true);
      await action(drm);
    } finally {
      await drm.destroy();
    }

    if (error) {
      throw error;
    }
  }
@param {!shaka.Player} player
@param {shaka.extern.Manifest} manifest
@param {function(!shaka.drm.DrmEngine):Promise} action
@return {!Promise}