Skip to content

Problem providing key response to MediaDrm (Dash with Widevine) #282

@ghost

Description

Hello everyone,

I am experiencing the following issue when trying to play content with Dash and Widevine. (custom content and custom proxy widevine license server)

The exception it is raised in this line of code:

mediaDrm.provideKeyResponse(sessionId, (byte[]) response);
02-05 19:24:29.037    5488-5488/com.google.android.exoplayer.demo E/EventLogger﹕ playerFailed [6.47]
    com.google.android.exoplayer.ExoPlaybackException: android.media.MediaDrm$MediaDrmStateException: Failed to handle key response: DRM vendor-defined error: -2998
            at com.google.android.exoplayer.MediaCodecTrackRenderer.maybeInitCodec(MediaCodecTrackRenderer.java:289)
            at com.google.android.exoplayer.MediaCodecTrackRenderer.onInputFormatChanged(MediaCodecTrackRenderer.java:678)
            at com.google.android.exoplayer.MediaCodecTrackRenderer.readFormat(MediaCodecTrackRenderer.java:465)
            at com.google.android.exoplayer.MediaCodecTrackRenderer.doSomeWork(MediaCodecTrackRenderer.java:442)
            at com.google.android.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:398)
            at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:203)
            at android.os.Handler.dispatchMessage(Handler.java:98)
            at android.os.Looper.loop(Looper.java:135)
            at android.os.HandlerThread.run(HandlerThread.java:61)
            at com.google.android.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
     Caused by: android.media.MediaDrm$MediaDrmStateException: Failed to handle key response: DRM vendor-defined error: -2998
            at android.media.MediaDrm.provideKeyResponse(Native Method)
            at com.google.android.exoplayer.drm.StreamingDrmSessionManager.onKeyResponse(StreamingDrmSessionManager.java:287)
            at com.google.android.exoplayer.drm.StreamingDrmSessionManager.access$700(StreamingDrmSessionManager.java:42)
            at com.google.android.exoplayer.drm.StreamingDrmSessionManager$PostResponseHandler.handleMessage(StreamingDrmSessionManager.java:369)

From what I can see in the proxy (Charles) I setup in the middle, the license seems to be acquired correctly but for some reason the MediaDrm is failing to process it. Any hints?

This is the struct of the license server response:

{
    "status": "OK",
    "license": "...",
    "license_metadata": {
        "content_id": "..."
    },
    "supported_tracks": [{
        "type": "SD"
    }],
    "make": "LG",
    "model": "Nexus 4",
    "security_level": 1,
    "internal_status": 0,
    "session_state": {
        "license_id": {
            "request_id": "...",
            "session_id": "...",
            "purchase_id": "",
            "type": "STREAMING",
            "version": 0
        },
        "signing_key": ...",
        "keybox_system_id": 
    }
}

Not idea what this provideKeyResponse method is expecting in the response object.

Thanks and great project. Hopefully I can contribute my self as well in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions