Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playback doesn't start on DRMized streams #3711

Closed
5 tasks done
nicoweilelemental opened this issue Jul 21, 2021 · 6 comments
Closed
5 tasks done

Playback doesn't start on DRMized streams #3711

nicoweilelemental opened this issue Jul 21, 2021 · 6 comments
Labels

Comments

@nicoweilelemental
Copy link

nicoweilelemental commented Jul 21, 2021

Environment
  • Link to playable MPD files:

https://d24rwxnt7vw9qb.cloudfront.net/out/v1/2fc23947945841b9b1be9768f9c13e75/index.mpd (one key for both audio and video tracks, key rotation activated)

https://d24rwxnt7vw9qb.cloudfront.net/out/v1/6e16c26536564c2f9dbc5f725a820cff/index.mpd (one key for video and one key for audio, no key rotation)

Streams are using both Widevive and Playready, multi-period but all periods are encrypted (no mix of clear + encrypted)

  • Dash.js version: 4.0.1
  • Browser name/version: Chrome 91
  • OS name/version: win10
Steps to reproduce
  1. Please provide clear steps to reproduce your problem
    Load one of the two streams with Widevine parameters:
    License URL : https://lic.staging.drmtoday.com/license-proxy-widevine/cenc/
    Request header key: x-dt-custom-data
    Request header value: ewogICAgInVzZXJJZCI6ICJhd3MtZWxlbWVudGFsOjpzcGVrZS10ZXN0aW5nIiwKICAgICJzZXNzaW9uSWQiOiAidGVzdHNlc3Npb24xMjMiLAogICAgIm1lcmNoYW50IjogImF3cy1lbGVtZW50YWwiCn0=

  2. If the bug is intermittent, give a rough frequency if possible
    Permanent problem

Observed behavior

The DRM license requests are succesful but the playback doesn't start. Another DRM partner reported they have the same problem with dash.js v4 and that they didn't have it with v3.

Console output (second stream URL)
emeLogger.RequestMediaKeySystemAccessCall {timestamp: "15:1:41:639", title: "RequestMediaKeySystemAccessCall", target: Navigator, returned: Promise, keySystem: "com.widevine.alpha", …}
VM16:418 emeLogger.PromiseResult {timestamp: "15:1:41:639", title: "RequestMediaKeySystemAccessCall Promise Result", status: "resolved", args: Array(2), result: e…r.MediaKeySystemAccess}
VM16:418 emeLogger.GetConfigurationCall {timestamp: "15:1:41:640", title: "GetConfigurationCall", target: e…r.MediaKeySystemAccess, returned: {…}}
Debug.js:169 [4668314][ProtectionController] DRM: KeySystem Access Granted (com.widevine.alpha)!  Selecting key system..
[...].
[4668551][ProtectionModel_21Jan2015] DRM: Session created.  SessionID = 50CF9E69577CC7C2181EA7FB5DCD3CF0  
[4668583][ProtectionModel_21Jan2015] DRM: Session created.  SessionID = 686A0055992CAA23727CED2A6DC4454E 
emeLogger.MessageEvent {title: "MessageEvent", event: MediaKeyMessageEvent, timestamp: "17:17:50:468", target: e…r.MediaKeySession, message: Uint8Array(2), …}
Debug.js:169 [4668584][ProtectionController] DRM: onKeyMessage 
Debug.js:169 [4668648][BufferController][video] Waiting for more buffer before starting playback 
Debug.js:169 [4668761][StreamProcessor][audio] OnFragmentLoadingCompleted for stream id 3584702 and media type audio - Url: https://d24rwxnt7vw9qb.cloudfront.net/out/v1/6e16c26536564c2f9dbc5f725a820cff/index_audio_6_0_3584713.mp4?m=1618852834  
Debug.js:169 [4668763][BufferController][audio] Got enough buffer to start 
Debug.js:169 [4668763][BufferController][audio] Buffered range: 8016011.966667 - 8016013.972, currentTime =  8016012.9735 
Debug.js:169 [4668763][ScheduleController][audio] Appended bytes for audio and stream id 3584702 
VM16:418 emeLogger.EncryptedEvent {title: "EncryptedEvent", event: MediaEncryptedEvent, timestamp: "17:17:50:647", target: e…r.HTMLMediaElement, initData: Uint8Array(975), …}
Debug.js:169 [4668766][ProtectionController] DRM: onNeedKey 
Debug.js:169 [4668767][ProtectionController] DRM: Ignoring initData because we have already seen it! 
Debug.js:169 [4668779][ScheduleController][audio] Media segment needed for audio and stream id 3584702 
Debug.js:169 [4668779][StreamProcessor][audio] Next fragment request url for stream id 3584702 and media type audio is https://d24rwxnt7vw9qb.cloudfront.net/out/v1/6e16c26536564c2f9dbc5f725a820cff/index_audio_6_0_3584714.mp4?m=1618852834 
VM16:418 emeLogger.UpdateCall {timestamp: "15:1:42:190", title: "UpdateCall", target: e…r.MediaKeySession, returned: Promise, response: Uint8Array(1304), …}
VM16:418 emeLogger.PromiseResult {timestamp: "15:1:42:234", title: "UpdateCall Promise Result", status: "rejected", args: Array(1), result: TypeError: Failed to execute 'update' on 'MediaKeySession': Rejected with system code (13)}
VM16:418 emeLogger.UpdateCall {timestamp: "15:1:42:236", title: "UpdateCall", target: e…r.MediaKeySession, returned: Promise, response: Uint8Array(1304), …}
VM16:418 emeLogger.PromiseResult {timestamp: "15:1:42:264", title: "UpdateCall Promise Result", status: "rejected", args: Array(1), result: TypeError: Failed to execute 'update' on 'MediaKeySession': Rejected with system code (13)}
Debug.js:169 [4668968][StreamProcessor][video] OnFragmentLoadingCompleted for stream id 3584702 and media type video - Url: https://d24rwxnt7vw9qb.cloudfront.net/out/v1/6e16c26536564c2f9dbc5f725a820cff/index_video_4_0_3584713.mp4?m=1618852834  
VM16:418 emeLogger.EncryptedEvent {title: "EncryptedEvent", event: MediaEncryptedEvent, timestamp: "17:17:50:858", target: e…r.HTMLMediaElement, initData: Uint8Array(975), …}
Expected behavior

The playback should start, as verified in the castLabs player:

https://players.castlabs.com/presto/6.1.9/#/player/config?cfg=eyJzb3VyY2UiOnsidXJsIjoiaHR0cHM6Ly9jY2YzNzg2YjkyNWVlNTFjLm1lZGlhcGFja2FnZS51cy1lYXN0LTEuYW1hem9uYXdzLmNvbS9vdXQvdjEvMmZjMjM5NDc5NDU4NDFiOWIxYmU5NzY4ZjljMTNlNzUvaW5kZXgubXBkIiwidHlwZSI6ImFwcGxpY2F0aW9uL2Rhc2greG1sIiwiZHJtUHJvdGVjdGVkIjp0cnVlfSwiYXV0b3BsYXkiOnRydWUsImRybSI6eyJlbnYiOiJEUk10b2RheV9TVEFHSU5HIiwiY3VzdG9tRGF0YSI6eyJ1c2VySWQiOiJhd3MtZWxlbWVudGFsOjpzcGVrZS10ZXN0aW5nIiwic2Vzc2lvbklkIjoidGVzdHNlc3Npb25TUDEiLCJtZXJjaGFudCI6ImF3cy1lbGVtZW50YWwiLCJmYWlyUGxheUNvbnRlbnRJZFN0cmF0ZWd5IjoiZnVsbC1za2QiLCJoZWFkZXJzIjp7fX19LCJtZXRhZGF0YSI6eyJ0aXRsZSI6ImRhc2ggc3Bla2UgdjEifSwidGV4dHN0eWxlIjp7ImZvbnRGYW1pbHkiOiInUm9ib3RvJywgc2Fucy1zZXJpZiIsImZvbnRDb2xvciI6IndoaXRlIiwiYmFja2dyb3VuZENvbG9yIjoicmdiYSgwLCAwLCAwLCAwLjc1KSJ9fQ%3D%3D

https://players.castlabs.com/presto/6.1.9/#/player/config?cfg=eyJzb3VyY2UiOnsidXJsIjoiaHR0cHM6Ly9jY2YzNzg2YjkyNWVlNTFjLm1lZGlhcGFja2FnZS51cy1lYXN0LTEuYW1hem9uYXdzLmNvbS9vdXQvdjEvNmUxNmMyNjUzNjU2NGMyZjlkYmM1ZjcyNWE4MjBjZmYvaW5kZXgubXBkIn0sImF1dG9wbGF5Ijp0cnVlLCJkcm0iOnsiZW52IjoiRFJNdG9kYXlfU1RBR0lORyIsImN1c3RvbURhdGEiOnsidXNlcklkIjoiYXdzLWVsZW1lbnRhbDo6c3Bla2UtdGVzdGluZyIsInNlc3Npb25JZCI6InRlc3RzZXNzaW9uU1AyIiwibWVyY2hhbnQiOiJhd3MtZWxlbWVudGFsIiwiZmFpclBsYXlDb250ZW50SWRTdHJhdGVneSI6ImZ1bGwtc2tkIiwiaGVhZGVycyI6e319fSwibWV0YWRhdGEiOnsidGl0bGUiOiJkYXNoIHNwZWtlIHYyIn0sInRleHRzdHlsZSI6eyJmb250RmFtaWx5IjoiJ1JvYm90bycsIHNhbnMtc2VyaWYiLCJmb250Q29sb3IiOiJ3aGl0ZSIsImJhY2tncm91bmRDb2xvciI6InJnYmEoMCwgMCwgMCwgMC43NSkifX0%3D

@dsilhavy
Copy link
Collaborator

@nicoweilelemental I checked this and it does not work for me in dash.js 3.2.2 and 4.0.0. Also not working in Shaka. Both, dash.js and Shaka fail with:

Failed to execute 'update' on 'MediaKeySession': Rejected with system code (13)

when calling session.update(message) after the successful license request.

One thing I need to check is why dash.js does not dispatch that error to the reference UI.

@dsilhavy
Copy link
Collaborator

It looks like DRMToday returns the Widevine license in a JSON object rather than in arraybuffer format. We do have an implementation for that which can be called the following way:

{
  "name": "Elemental DRM Today",
  "url": "https://d24rwxnt7vw9qb.cloudfront.net/out/v1/2fc23947945841b9b1be9768f9c13e75/index.mpd",
  "protData": {
    "com.widevine.alpha": {
      "drmtoday": true,
      "serverURL": "https://lic.staging.drmtoday.com/license-proxy-widevine/cenc/",
      "httpRequestHeaders": {
        "x-dt-custom-data": "ewogICAgInVzZXJJZCI6ICJhd3MtZWxlbWVudGFsOjpzcGVrZS10ZXN0aW5nIiwKICAgICJzZXNzaW9uSWQiOiAidGVzdHNlc3Npb24xMjMiLAogICAgIm1lcmNoYW50IjogImF3cy1lbGVtZW50YWwiCn0="
      },
      "httpTimeout": 5000
    }
  }
}

By adding "drmtoday": true we will use the CastLabs DRMToday License Server implementation and treat the payload of the DRM server different than we usually do. Setting this flag the playback works for me.

I will add a checkbox for that in the reference UI

@dsilhavy
Copy link
Collaborator

There is a new checkbox in the options section: "DRM Today". If this is checked we will handle the license response accordingly. With that, playback works fine for me.

@nicoweilelemental
Copy link
Author

nicoweilelemental commented Jul 22, 2021

So cool, thanks Daniel! Should the checkbox rather be a generic radiobutton called "License response expexted as json" or "License response expected as arraybuffer"?

@dsilhavy
Copy link
Collaborator

@nicoweilelemental I agree, that might be worth adding in the future. For now I would like to keep it as it is since the DRMToday implementation we have in place handles Playready and Widevine responses differently. So it is not just the response type but also how the license message is parsed.

@nicoweilelemental
Copy link
Author

@dsilhavy no worries, I see the streams playing now, so it's all good. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants