DRM_MEDIA_KEY_INITIALIZATION_FAILED 2008

The DRM Media Keys object could not be created or initialized.

The Media Keys object is associated to the video element and used to create Media Key Sessions, which are used to interface with the Content Decryption Module. This error might occur if the creation of the Media Keys, or attaching them the video element failed, which can happen because the key system is not supported by the platform or the data provided to create the instance is not valid.

Please check the logs to determine the exact reason of the failure.

Troubleshooting steps for key initialization failed

  • Make sure the platform supports the DRM configuration by checking the response from getSupportedDRM

    @example
    // Not supported device
    player.getSupportedDRM().then(console.log)
    ['com.widevine.alpha'] // Response will vary between device capabilities

    // Supported device
    player.getSupportedDRM().then(console.log)
    ['com.apple.fairplay', 'com.apple.fps.1_0', 'com.apple.fps.2_0']
  • Check if your stream needs Fairplay to play. If the video element does not support the HTMLVideoElement.webkitKeys the error will be thrown. If the response is null then they have not been set and you can determine the reason from the logs in the console

    @example
    // Applicable only for Fairplay DRM content
    // Not supported device
    console.log(player.getVideoElement().webkitKeys)
    undefined // The video element does not support this feature

    // The device supports Fairplay but no keys were set
    console.log(player.getVideoElement().webkitKeys)
    null

    // The device supports Fairplay and keys were set
    console.log(player.getVideoElement().webkitKeys)
    WebKitMediaKeys {keySystem: "com.apple.fps.1_0", createSession: function} // Based on MacBook on Safari
  • If you are using a different than Fairplay config, please verify that the media keys are available and set for the platform by calling the HTMLVideoElement.mediaKeys. If the response is null then they have not been set and you can determine the reason from the logs in the console

    @example
    // Device with no media keys set
    console.log(player.getVideoElement().mediaKeys)
    null

    // Device with media keys set
    console.log(player.getVideoElement().mediaKeys)
    MediaKeys {}