# All files / src/utils mediakeys-helper.ts

75% Statements 3/4
83.33% Branches 5/6
100% Functions 1/1
75% Lines 3/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21

    1x
    1x
    1x

     /**
     * @see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/requestMediaKeySystemAccess
     */
    export enum KeySystems {
      WIDEVINE = 'com.widevine.alpha',
      PLAYREADY = 'com.microsoft.playready',
    }

    export type MediaKeyFunc = (keySystem: KeySystems, supportedConfigurations: MediaKeySystemConfiguration[]) => Promise<MediaKeySystemAccess>;
    const requestMediaKeySystemAccess = (function (): MediaKeyFunc | null {
      Eif (typeof window !== 'undefined' && window.navigator && window.navigator.requestMediaKeySystemAccess) {
        return window.navigator.requestMediaKeySystemAccess.bind(window.navigator);
      } else {
        return null;
      }
    })();

    export {
      requestMediaKeySystemAccess
    };