media
media copied to clipboard
Recover from DRM License request authentication error (401)
Use case description
Access to MultiDRM license servers is prudently protected by client authentication headers. With Widevine Proxy server the proxy is able to authenticate the caller and reject it or respond by forwarding the request to Google's widevine server. One common use case would be signaling a HTTP 401 status.
ExoPlayer provides for error recovery via the LoadErrorHandlingPolicy, calling the getRetryDelayMsFor() when the request fails, however there is no provision for returning anything other than a delay value.
Note this license request is often issued while there is significant buffered content, so being able to recover in-place saves a lot of time.
Proposed solution
Add an optional method to LoadErrorHandlingPolicy interface, like:
/**
* Updates the request properties, if required. Returns true if updated
*/
boolean updateRequestPropertiesForError(LoadErrorInfo loadErrorInfo, HashMap<String, String> keyRequestParameters) { return false; }
This would be used, for example to update any short-lived login token in the request headers. Obviously this is just an idea to riff on, as the ultimate source of the header values is the MediaItem.DrmConfiguration. The MediaItem is far distanced from the point of the load error detection
Alternatives considered
The only alternative with the current code base (that I can see) is to not retry, and completely restart playback with an updated MediaItem from outside of ExoPlayer code.