DRM_KEY_SESSION_INITIALIZATION_FAILED 2007

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 or the data field of the error event 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
    // Supports Widevine playback, therefore needs a Widevine DRM configuration
    player.getSupportedDRM().then(console.log)
    ['com.widevine.alpha'] // Response will vary between device capabilities

    // Supported FairPlay, therefore needs a FairPlay DRM configuration
    player.getSupportedDRM().then(console.log)
    ['com.apple.fairplay', 'com.apple.fps.1_0', 'com.apple.fps.2_0']
  • On a DASH stream, try removing the init data from your manifest and use only the one which is available from the segments. Usually the key provided inside the cenc:pssh is used. You could try to change the manifest to not include it or by specifying in your player config the preprocessHttpResponse to strip out the tag

    @example
    @Example Dash manifest
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <MPD id="505916a3-fc9b-4088-be98-d90796861a3a" profiles="urn:mpeg:dash:profile:isoff-main:2011" type="static" availabilityStartTime="2015-09-17T09:32:38.000Z" publishTime="2015-09-17T09:32:46.000Z" mediaPresentationDuration="P0Y0M0DT0H3M30.000S" minBufferTime="P0Y0M0DT0H0M1.000S" bitmovin:version="1.6.0" xmlns:ns2="http://www.w3.org/1999/xlink" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:bitmovin="http://www.bitmovin.net/mpd/2015">
    <Period>
    <AdaptationSet mimeType="video/mp4" codecs="avc1.42c00d">
    <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="eb676abb-cb34-5e96-bbcf-616630f1a3da" xmlns:cenc="urn:mpeg:cenc:2013"/>
    <ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
    <cenc:pssh xmlns:cenc="urn:mpeg:cenc:2013">WSs6jyCfc1R0h7QAAADsIARIQ62dqu8s0Xpa7z2FmMPGjd2lkZXZpbmVfdGEQyAA==</cenc:pssh>
    </ContentProtection>
    <ContentProtection schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">
    <cenc:pssh xmlns:cenc="urn:mpeg:cenc:2013">ABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AHQAcAA6AC8APABBAEwARwBJAEQAPgBBAEUAUwBDAFQAUgA8AC8AQQBMAEcASQBEAD4APAAvAFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwTABBAF8AVQBSAEwIAEUAQQBEAEUAUgA+A=</cenc:pssh>
    </ContentProtection>
    <SegmentTemplate media="../video/$RepresentationID$/cenc_dash/segment_$Number$.m4s" initialization="../video/$RepresentationID$/cenc_dash/init.mp4" duration="4000" startNumber="0" timescale="1000"/>
    <Representation id="180_250000" bandwidth="250000" width="320" height="180" frameRate="25"/>
    </AdaptationSet>
    <AdaptationSet lang="en" mimeType="audio/mp4" codecs="mp4a.40.2" bitmovin:label="english stereo">
    <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
    <SegmentTemplate media="../audio/$RepresentationID$/cenc_dash/segment_$Number$.m4s" initialization="../audio/$RepresentationID$/cenc_dash/init.mp4" duration="3999" startNumber="0" timescale="1000"/>
    <Representation id="1_stereo_192000" bandwidth="192000" audioSamplingRate="48000">
    <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="eb676abb-cb34-5e96-bbcf-616630f1a3da" xmlns:cenc="urn:mpeg:cenc:2013"/>
    <ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
    <cenc:pssh xmlns:cenc="urn:mpeg:cenc:2013">AAAAWAAAAA7e+LqXnWSs6jyCfcs0Xpa7z2FmMPGj2hoNd2lkZXZpbmVfdGVzdCIQZmtqM2xqYVNkZmFsa3Izai=</cenc:pssh>
    </ContentProtection>
    <ContentProtection schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">
    <cenc:pssh xmlns:cenc="urn:mpeg:cenc:2013">ApMAbADAAMwAvAFAAbAIAB2AGUQARQBDAFQASQBOAEYATwAwB6ADcgBpAGcAaAB0AHMAbQBhAG4AQBnAGgAdAA9ADEAJgBhAHkAPQBFAEEAdABQBMAGEAeQB3AD0APQA8AC8ATABBAF8AVQBwALwBXAFIATQBIAEUAQQBEAEUAUgAA=</cenc:pssh>
    </ContentProtection>
    </Representation>
    </AdaptationSet>
    </Period>
    </MPD>
    var config = {
    network: {
    preprocessHttpResponse: function(type, response) {
    if (type === 'manifest/dash') {
    // Replace all cenc:pssh tags with an invalid tag which will not allow them to be used
    // Refer to the manifest example above for the example structure of a manifest
    response.body = response.body.replace(/cenc:pssh/g, 'invalid-tag');
    }
    return Promise.resolve(response);
    }
    }
    }
  • You can ask your DRM vendor to try verifying the init data is valid and not malformed. Most commonly the PSSH boxes need to be confirmed

  • Enable the debug logs messages by setting level to DEBUG in your player config. This will allow you to see more detailed error information about what was the caused of the error