question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Widevine DRM InvalidResponseCodeException: Response code: 404

See original GitHub issue

Searched documentation and issues

I was looking to the ExoPlayer documentations and on GitHub’s issues.

Introduction

The problem occurs on a custom made device, which name I can’t tell (and I can’t tell you if it is certified or not), the device run Android 9, it’s new stick device. ExoPlayer version 2.9.6. We play content with Widevine’s DRM solution and it works on every other “production ready” devices (TVs) with DRM support like Sony 4K TVs. But on our “custom device” we have an error and don’t understand the real cause of it. On the code level we can’t see execution of method executeKeyRequest, but only executeProvisionRequest (same as in ExoPlayer example project, in class HttpMediaDrmCallback), where the request.getDefaultUrl() is equal to https://www.googleapis.com/certificateprovisioning/v1/devicecertificates/create?key=xxx.

Question

Why is it happening? Does the device missing the Widevine certification on a factory level, or certification missed for our app x.y.z? What should we do and where to read about Android Pie Widevide DRM support/implementation?

We can’t provide manifest, but it’s Dash.

A full bug report captured from the device

E/ExoPlayerImplInternal: Playback error.
    com.google.android.exoplayer2.ExoPlaybackException: com.google.android.exoplayer2.drm.DrmSession$DrmSessionException: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 404
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.shouldWaitForKeys(MediaCodecRenderer.java:1039)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:990)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:665)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:529)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:300)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:193)
        at android.os.HandlerThread.run(HandlerThread.java:65)
     Caused by: com.google.android.exoplayer2.drm.DrmSession$DrmSessionException: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 404
        at com.google.android.exoplayer2.drm.DefaultDrmSession.onError(DefaultDrmSession.java:447)
        at com.google.android.exoplayer2.drm.DefaultDrmSession.onProvisionError(DefaultDrmSession.java:240)
        at com.google.android.exoplayer2.drm.DefaultDrmSessionManager.onProvisionError(DefaultDrmSessionManager.java:610)
        at com.google.android.exoplayer2.drm.DefaultDrmSession.onProvisionResponse(DefaultDrmSession.java:312)
        at com.google.android.exoplayer2.drm.DefaultDrmSession.access$000(DefaultDrmSession.java:45)
        at com.google.android.exoplayer2.drm.DefaultDrmSession$PostResponseHandler.handleMessage(DefaultDrmSession.java:474)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193) 
        at android.os.HandlerThread.run(HandlerThread.java:65) 
     Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 404
        at com.google.android.exoplayer2.ext.okhttp.OkHttpDataSource.open(OkHttpDataSource.java:176)
        at com.google.android.exoplayer2.upstream.DataSourceInputStream.checkOpened(DataSourceInputStream.java:102)
        at com.google.android.exoplayer2.upstream.DataSourceInputStream.read(DataSourceInputStream.java:82)
        at com.google.android.exoplayer2.upstream.DataSourceInputStream.read(DataSourceInputStream.java:76)
        at com.google.android.exoplayer2.util.Util.toByteArray(Util.java:140)
        at com.massiveinteractive.mdk.video.exoplayer.drm.AdvancedHttpMediaDrmCallback.executePost(AdvancedHttpMediaDrmCallback.java:135)
        at com.massiveinteractive.mdk.video.exoplayer.drm.AdvancedHttpMediaDrmCallback.executeProvisionRequest(AdvancedHttpMediaDrmCallback.java:67)
        at com.google.android.exoplayer2.drm.DefaultDrmSession$PostRequestHandler.handleMessage(DefaultDrmSession.java:508)
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.os.HandlerThread.run(HandlerThread.java:65) 
D/SurfaceUtils: disconnecting from surface 0x805fc808, reason disconnectFromSurface
E/libc: Access denied finding property "media.metrics.enabled"
E/libc: Access denied finding property "media.metrics.enabled"
I/ExoPlayerImpl: Release d8e3767 [ExoPlayerLib/2.9.6] [DV6067Y, OTT-G1, SDMC, 28] [goog.exo.core, goog.exo.ui, goog.exo.dash, goog.exo.okhttp]

And code from where exception is fired: AdvancedHttpMediaDrmCallback.java:135 is the same as in example ExoPlayer project in class HttpMediaDrmCallback:

return Util.toByteArray(inputStream);

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:26 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ojw28commented, Jul 9, 2019

In my initial response I was asking @rrfrias to take a look at this. Burying this under three further posts on the issue likely confused things.

@rrfrias , @fredgc - Please could you respond to my question above? Thanks!

0reactions
VladimirCorescommented, Aug 14, 2019

We found the problem and fixed the issue. It was because of the second parameter in executePost(url, null, null); in executeProvisionRequest, the data parameter, had value null, but it has to be Util.EMPTY_BYTE_ARRAY, not sure why it’s an issue on Android 9.

Read more comments on GitHub >

github_iconTop Results From Across the Web

com.google.android.exoplayer2.upstream.HttpDataSource ...
com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 404 · Ask Question. Asked 3 years ago.
Read more >
How to check if your Android device supports Widevine DRM
Want to know if your Android device can stream HD videos from Netflix and Amazon Prime Video? Here's how to check for Widevine...
Read more >
Index (library-core API) - Javadoc.io
Helper class for blacklisting tracks in a TrackSelection when 404 (Not Found) and 410 (Gone) HTTP response codes are encountered.
Read more >
Why Call Provision Request While Using Exoplayer To Play ...
Widevine DRM InvalidResponseCodeException: Response code: 404 #6128 on #4772 Widevine provisioning failing on Android 9 Pixel 2 device.
Read more >
PlayerActivity.java example - Javatips.net
WidevineTestMediaDrmCallback ; import com.google.android.exoplayer. ... InvalidResponseCodeException)e.getCause()).responseCode == 404 && this.player.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found