google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.72k stars 6.03k forks source link

How to seek backward inside a stream where DRM key rotation is in place. #8034

Closed tibor-leo-safar-accedo closed 3 years ago

tibor-leo-safar-accedo commented 4 years ago

[REQUIRED] Searched documentation and issues

Have digging all across the internet for such issue but not much related discussions discovered so far.

[REQUIRED] Question

Hi, The scenario of the issue is the following. We are using ExoPlayer version 2.10.8 It is given a Live DASH stream with DRM key rotation, there is a new DRM key in every 5 minute. We do use the OfflineLicenseHelper class for DRM key acquisition, storing the key Id's in order to reuse them between playback sessions. Playing back the head of the stream is OK, we can detect, acquire new license and the playback continues with minimal UI glitches. The window of the live stream is quite big, 4 hours, in order to provide some extra features for our users like instant restart of a program (what can fit into te live window). The issue comes when we try to seek back in the stream behind any of DRM key rotation events. An example

We have tried this without using OfflineLicenseHelper, letting ExoPlayer to handle everything, of course with the same result.

Question:

A full bug report captured from the device

No bug report, the description should be enough. If not, let me know what exactly to collect.

Link to test content

Issue #4133 and #3561 seems to be related somehow. Unfortunately there is no publicly available test content. I think the issue can be reproduced with any of the streams with DRM key rotation when seeking back in stream to any moent before a DRM key change event. (not aware of any such publicly available stream)

Would really appreciate for some help on this topic.

AquilesCanta commented 4 years ago

Is it possible (if yes how?) to acquire a valid DRM key for a position back in time, where the DRM key was different then the one used for the Live edge (head) of the stream?

Yes. ExoPlayer should do that for you without any special handling. The only thing you should make sure is that you are using multiSession.

I think the issue can be reproduced with any of the streams with DRM key rotation when seeking back in stream to any moent before a DRM key change event. (not aware of any such publicly available stream)

I have tested this with internal test streams and it works well.

I think the only way we can assist here is that you provide repro steps in the demo app. This will require you to send us a sample stream, as explained in the issue template.

tibor-leo-safar-accedo commented 4 years ago

Hi Santiago!

Thank you very much for your response.

I think a quite important thing was not considered in your response, what was listed between the lines, we try to use the OfflineLicenseHelper class to acquire licenses, store them, then reuse them in case it is needed. This way of implementation can lift some pressure from the DRM server regarding the number of hits.

In our case we would need to put together such a DrmInitData object what can exactly point to the data segment for what segment we would like to acquire the DRM license. For the moment the DrmInitData uses only the main manifest of the stream, therefore in all cases we will have a valid DRM key only for the head of the stream.

My question would be to you if it would be possible to use the OfflineLicenseHelper in such way to achieve our goal.

Thank you, Tibor Leo Safar.

On 2020. Oct 9., at 15:43, Santiago Seifert notifications@github.com wrote:

Is it possible (if yes how?) to acquire a valid DRM key for a position back in time, where the DRM key was different then the one used for the Live edge (head) of the stream?

Yes. ExoPlayer should do that for you without any special handling. The only thing you should make sure is that you are using multiSession https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/drm/DefaultDrmSessionManager.Builder.html#setMultiSession-boolean-.

I think the issue can be reproduced with any of the streams with DRM key rotation when seeking back in stream to any moent before a DRM key change event. (not aware of any such publicly available stream)

I have tested this with internal test streams and it works well.

I think the only way we can assist here is that you provide repro steps in the demo app. This will require you to send us a sample stream, as explained in the issue template https://github.com/google/ExoPlayer/blob/release-v2/.github/ISSUE_TEMPLATE/question.md.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/google/ExoPlayer/issues/8034#issuecomment-706188340, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSO3TGVZXRA2KXQMSQGT5TSJ4HO5ANCNFSM4SBWF2XQ.

ojw28 commented 3 years ago

OfflineLicenseHelper is really intended for VOD download use cases. Trying to use it for streaming with key rotation is not something we support. It sounds like a very fragile approach.

Note that, depending on how much key reuse you need, you may find DefaultDrmSessionManager.Builder.setSessionKeepaliveMs useful.