static onWebkitNeedKey_(event) {
    shaka.log.debug('PatchedMediaKeysApple.onWebkitNeedKey_', event);

    const PatchedMediaKeysApple = shaka.polyfill.PatchedMediaKeysApple;
    const mediaKeys =
    /** @type {shaka.polyfill.PatchedMediaKeysApple.MediaKeys} */(
        this.mediaKeys);
    goog.asserts.assert(mediaKeys instanceof PatchedMediaKeysApple.MediaKeys,
        'non-polyfill instance of newMediaKeys');

    goog.asserts.assert(event.initData != null, 'missing init data!');

    // Convert the prefixed init data to match the native 'encrypted' event.
    const uint8 = shaka.util.BufferUtils.toUint8(event.initData);
    const dataview = shaka.util.BufferUtils.toDataView(uint8);
    // The first part is a 4 byte little-endian int, which is the length of
    // the second part.
    const length = dataview.getUint32(
        /* position= */ 0, /* littleEndian= */ true);
    if (length + 4 != uint8.byteLength) {
      throw new RangeError('Malformed FairPlay init data');
    }
    // The remainder is a UTF-16 skd URL.  Convert this to UTF-8 and pass on.
    const str = shaka.util.StringUtils.fromUTF16(
        uint8.subarray(4), /* littleEndian= */ true);
    const initData = shaka.util.StringUtils.toUTF8(str);

    // NOTE: Because "this" is a real EventTarget, the event we dispatch here
    // must also be a real Event.
    const event2 = new Event('encrypted');

    const encryptedEvent =
      /** @type {!MediaEncryptedEvent} */(/** @type {?} */(event2));
    encryptedEvent.initDataType = 'skd';
    encryptedEvent.initData = shaka.util.BufferUtils.toArrayBuffer(initData);

    this.dispatchEvent(event2);
  }
Handler for the native media elements webkitneedkey event.

@this {!HTMLMediaElement}
@param {!MediaKeyEvent} event
@suppress {constantProperty} We reassign what would be const on a real
  MediaEncryptedEvent, but in our look-alike event.
@private