Open boom1 opened 3 months ago
Thanks for the request - do you have some content which triggers this key request type that you could share with us for testing/debugging? Please either post media and license server links here or send them to android-media-github@google.com with the subject Issue #1404
. Please also update this issue to indicate you’ve done this.
Hello Ian, A test would be to play the same DRM-protected media file twice. On the second run, getKeyRequest() might return REQUEST_TYPE_NONE. I added some more info to android-media-github@google.com.
Thanks for the email, unfortunately it's not really detailed enough for us to take action (we need literal media & license URLs we can use to repro).
A test would be to play the same DRM-protected media file twice. On the second run, getKeyRequest() might return REQUEST_TYPE_NONE.
I tried this in the demo app with the Widevine DASH (MP4, H264) -> HD (cenc)
sample, but every time I played it I saw REQUEST_TYPE_INITIAL
(0) emitted from the MediaDrm
instance, so I'm afraid it didn't help to repro the behaviour.
I had hoped that it is sufficient that REQUEST_TYPE_NONE is part of the official Google API for MediaDrm. IMHO ExoPlayer should handle all allowed return codes correctly. Doing so wouldn't harm for any current DRM (unless it wrongly returns REQUEST_TYPE_NONE although it means REQUEST_TYPE_INITIAL, which at least Widevine doesn't do). What else can I do; would a +1 from the platform provider help?
Use case description
When a DRM-protected (e.g. PlayReady) media file is played back for the second time, the DRM key could still be available in the DRM. Then the DRM might return REQUEST_TYPE_NONE on getKeyRequest() (see https://developer.android.com/reference/android/media/MediaDrm.KeyRequest#REQUEST_TYPE_NONE ). DefaultDrmSession should handle this case.
Proposed solution
The proposed solution is to check the return value of getKeyRequest() and to start playback immediately, when the key is already available. See this patch:
Alternatives considered
The check for REQUEST_TYPE_NONE could be done in requestHandler.post() or below, but then additional changes are necessary; especially some kind of null or empty keyResponse would need to be considered as OK/key-already-available. (IMHO not better.)