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

Encrypted audio only packages doesn't request key from license server or respect setProtectionData() #1224

Closed
ProjectTako opened this issue Feb 25, 2016 · 3 comments

Comments

@ProjectTako
Copy link

I am attempting to serve out audio only dash packages with encrypted audio. I have successfully served out non-encrypted audio only, and encrypted video+audio packages. The same methodology used to create the video+audio packages did not with with audio only.

After creating a video+audio package, and attempting to play it, I see the network request to my custom key server, that looks something like:
https://my.site.com/?flcdAX5XHQF-Vx0BflcdAQ&flcdAn5XHQJ-Vx0CflcdAg

However, when creating an audio only package and attempting playback, this call never happens.

I also tried using the player.setProtectionData() API to set the keys manually. I created a sources.json file based on the one located here. Doing this on the video+audio stream worked as expected. The above call never happens, but the playback still occurs. Using this method on the audio only stream still results in a failure to playback.

The drm_file.xml used to encrypt the audio-only mp4:

<?xml version="1.0" encoding="UTF-8"?>
<GPACDRM type="CENC AES-CTR">

  <DRMInfo type="pssh" version="1">
    <!--
    SystemID specified in
    https://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/cenc-format.html
    -->
    <BS ID128="1077efecc0b24d02ace33c1e52e2fb4b" />
    <!-- Number of KeyIDs = 1 -->
    <BS bits="32" value="1" />
    <!-- KeyID -->
    <BS ID128="0x7e571d017e571d017e571d017e571d01" />
  </DRMInfo>

  <CrypTrack trackID="1" isEncrypted="1" IV_size="16" saiSavedBox="senc"
    first_IV="0x00000000000000000000000000000000">
    <key KID="0x7e571d017e571d017e571d017e571d01"
      value="0x7e5711117e5711117e5711117e571111" />
  </CrypTrack>

</GPACDRM>

The sources.json protData snippet:

"protData":{
            "org.w3.clearkey":{
                "clearkeys":{
                    "flcdAX5XHQF-Vx0BflcdAQ":"flcREX5XERF-VxERflcREQ"
                }
            }
        }

The console log for when attempting to playback the audio only stream:
[6] EME detected on this user agent! (ProtectionModel_21Jan2015) Debug.js:108 [10] [dash.js 2.0.0] MediaPlayer has been initialized Debug.js:108 [10] Playback Initialized Debug.js:108 [144] Parsing complete: ( xml2json: 1ms, objectiron: 1ms, total: 0.002s) Debug.js:108 [145] Manifest has been refreshed at Thu Feb 25 2016 13:55:02 GMT-0500 (Eastern Standard Time)[1456426502.445] Debug.js:108 [150] MediaSource is open! Debug.js:108 [150] [object Event] Debug.js:108 [150] Duration successfully set to: 215.299 Debug.js:108 [150] Added 0 inline events Debug.js:108 [151] No video data. Debug.js:108 [151] audio codec: audio/mp4;codecs="mp4a.40.2" Debug.js:108 [158] Schedule controller stopping for audio Debug.js:108 [159] Perform SIDX load: https://cdn.wearevl.com/dash/audio/encrypted/v7/10128859_e_track1_dashinit.mp4 Debug.js:108 [159] No text data. Debug.js:108 [159] No fragmentedText data. Debug.js:108 [159] No embeddedText data. Debug.js:108 [159] No muxed data. Debug.js:108 [350] Parsing segments from SIDX. Debug.js:108 [352] Start Event Controller Debug.js:108 [354] Schedule controller starting for audio Debug.js:108 [371] loaded audio:InitializationSegment:NaN (206, 0ms, 18ms) Debug.js:108 [371] Initialization finished loading Debug.js:108 [374] Getting the request for audio time : 0 Debug.js:108 [375] SegmentBase: 0 / 215.299 Debug.js:108 [376] DRM: onNeedKey Debug.js:108 [377] DRM: initData: $psshwïìÀ²M�¬ã<�RâûK Debug.js:108 [165] DRM: KeySystem Access Denied! -- Key system access denied! Debug.js:108 [166] Schedule controller stopping for audio Debug.js:108 [167] Native video element event: loadedmetadata Debug.js:108 [167] Starting playback at offset: 0

I see no call to the license server in the network tab, nor does player.setProtectionData() seem to do anything.

I'm sort of at a lose here. I can create non-encrypted audio only packages that playback fine, and I can also create video+audio, both encrypted and non-encrypted packages that playback fine.

@bwidtmann
Copy link
Contributor

@ProjectTako that is an issue with the corresponding CDM of the browser. I experienced the same problem when trying to playback video only encrypted content.

When requesting access to the key system (CDM), you have to pass video and audio capability info (e.g. codecs). When you pass there always an object for audio and video (althought you just have audio), you get key access granted and the CDM triggers your license aquisition request and everything should work fine.

That is of course not a proper solution. If audio only playback with dash.js is a real use case for you, we maybe have to think about a better solution based on w3c standards and have to talk to the browser vendors.

@ProjectTako
Copy link
Author

@bwidtmann This is super useful information. Do you have an example of doing something like this? I haven't looked too in depth at documentation yet, but nothing jumps out right away at me of how to do this.

Audio only playback is definitely a real use case for me. I'm one of the developers for a medium sized music distribution company and we're trying to add dash as one of our supported formats with our internal player(s) using dash.js. The major labels require content encryption as one of the requirements to be able to stream their content.

This solution will hopefully be enough to allow us to get started with supporting dash, but I do agree this is not a proper solution.

@bwidtmann
Copy link
Contributor

You can do this in ProtectionController.js in line 305:

if (videoInfo) {
videoCapabilities.push(new MediaCapability(videoInfo.codec));
}

you should replace those lines with something like this:

videoCapabilities.push(new MediaCapability('avc1.4D401E'));

You could also manipulate your manifests because this information is retrieved from there. For example include a dummy video representation inside an adaptation set.

davemevans pushed a commit that referenced this issue Oct 3, 2016
Fix #1224 - only set non-empty MediaCapabilities on MediaKeySystemConfiguration
@davemevans davemevans added this to the v2.4.0 milestone Oct 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants