See this topic for more discussion https://github.com/Dash-Industry-Forum/dash.js/pull/2770
ClearkeyDRM does not work with an embedded key:value key in a javascript. Using licenseurl.php script call works with the same manifest content.
Test manifest for ClearkeyDRM
https://m.dtv.fi/dash/dasherh264v2/drm/manifest_clearkey.mpd
Test manifest for NoDRM(free)
https://m.dtv.fi/dash/dasherh264v2/manifest.mpd
ClearkeyDRM(embedded key:value license key), not working
https://m.dtv.fi/dash/index_clearkey2b.html?video=21
ClearkeyDRM(laurl php script license key), works ok
https://m.dtv.fi/dash/index_clearkey2.html?video=21
NoDRM(free), works ok
https://m.dtv.fi/dash/index_clearkey2.html?video=2f
This is @nicosang comment about the possible problem.
From: @nicosang
I'm able to play your first stream by adding this line :
if (initData.constructor === Uint8Array) { in function createKeySession of ProtectionModel_21Jan2015 in order to not take into account the last encrypted event with a strange initData value.
So, it means the fix just above is not efficient enough.
Nico
https://m.dtv.fi/dash/dasherh264v2/drm/manifest_clearkey.mpd
This manifest does not signal the use of Clear Key. See DASH-IF IOP section 7.6.2.4 for the expected signaling.
I do not know if this has anything to do with the issue you are experiencing (maybe you use dash.js features to override the signaling in manifest) but I thought I should point out this in case you assumed the content is signaling Clear Key.
@sandersaares Thanks. Manifest signals
urn:mpeg:dash:mp4protection:2011 CENC and urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b drm systems. Same manifest with clearkey-laurl works fine but maybe you are correct, this is not how ClearKeyDRM is meant to be triggered. Think I have read some obscure old conflicting whatnot specs.
I studied a guideline you reference.
https://dashif.org/docs/DASH-IF-IOP-v4.2-clean.htm#_Toc511040865
<ContentProtection schemeIdUri="urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e" value="ClearKey1.0"/>
I am giving ClearKeyDRM LAURL in javascript(index_clearkey2.html) and using embedded KID:KEY in javascript(index_clearkey2b.html). It is using dashjs specific syntax in html javascript.
Use Dashjs licenseurl: ok(firefox)
https://m.dtv.fi/dash/index_clearkey2.html?video=21
Use Dashjs embedded KID:KEY: failed
https://m.dtv.fi/dash/index_clearkey2b.html?video=21
This is manifest 21(cenc, 1077efec..)
https://m.dtv.fi/dash/dasherh264v2/drm/manifest_clearkey.mpd
Use Dashjs licenseurl: failed
https://m.dtv.fi/dash/index_clearkey2.html?video=22
Use Dashjs embedded KID:KEY: failed
https://m.dtv.fi/dash/index_clearkey2b.html?video=22
This is manifest 22(cenc, e2719d58..)
https://m.dtv.fi/dash/dasherh264v2/drm/manifest_clearkey2.mpd
I cannot recreate init.mp4/PSSH on this computer atm, maybe should write only PSSH(e2719d58*) or no pssh atoms in init segments. Do any one of you manage to use embedded KID:KEY for dashjs player?
There are some working Clear Key samples in the sources.json file.
For example, "1080p with W3C Clear Key, single key" embeds the key and passes it somewhere via JavaScript. Is this the sort of behavior you are looking for?
This example works in dashjs reference player. Manifest has LAURL element inside a contentprotection but it was not invoked so I guess KID:KEY from json configuration was used.
http://reference.dashif.org/dash.js/v2.9.0/samples/dash-if-reference-player/index.html
https://media.axprod.net/TestVectors/v7-MultiDRM-SingleKey/Manifest_1080p_ClearKey.mpd
It's either my html javascript doing something bad or init.mp4 segment has issues. I must study axprod PSSH atoms and create similar content for reference. My goal is to have dashsj without any user interface and playback clearkeydrm embedded license.
Using Clear Key does not require any PSSH whatsoever - as far as I know, the PSSHs in the axprod video should not be used at all by dash.js (they are there only for PlayReady and Widevine).
I made a new test material and tried "everything". Only combination can get to work is urn:mpeg:dash:mp4protection:2011 and urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b in a manifest AND init.mp4/PSSH(1077ef*) must be present AND laurl from javascript code.
Works ClearkeyDRM (Chrome,Firefox) laurl in javascript, 1077ef* pssh in init.mp4.
https://m.dtv.fi/dash/index_clearkey2.html?video=33
https://m.dtv.fi/dash/dasherh264v3/drm/manifest_clearkey1077ef.mpd
Failed ClearkeyDRM e2719d laurl in a manifest, no PSSHs in init.mp4.
https://m.dtv.fi/dash/index_clearkey2.html?video=32
https://m.dtv.fi/dash/dasherh264v3/drm/manifest_clearkeywithlaurl.mpd
Failed ClearkeyDRM laurl from javascript, no 1077ef*, no PSSHs in init.mp4.
https://m.dtv.fi/dash/index_clearkey2.html?video=31
https://m.dtv.fi/dash/dasherh264v3/drm/manifest_clearkey.mpd
Standalone dashjs html page to playback ClearkeyDRM with javascript embedded KID:KEY nothing works. @nicosang was able to playback after his small UInit8Array patch.
https://m.dtv.fi/dash/index_clearkey2b.html?video=21
https://m.dtv.fi/dash/index_clearkey2b.html?video=22
https://m.dtv.fi/dash/index_clearkey2b.html?video=31
https://m.dtv.fi/dash/index_clearkey2b.html?video=32
https://m.dtv.fi/dash/index_clearkey2b.html?video=33
https://m.dtv.fi/dash/index_clearkey2b.html?video=34
But I do not know why axprod works, it does not have init/PSSH atoms, KID:KEY comes from the config.json file(so from javascript). Manifest also has clearkey LaUrl but probably not needed. I have lost ideas on my index_clearkey2b.html page and blame dashjs has a bug or documentation is not up to date :-)
Playback nondrm unprotected content is not a problem.
https://m.dtv.fi/dash/index_clearkey2.html?video=30
https://m.dtv.fi/dash/index_clearkey2b.html?video=30
https://m.dtv.fi/dash/dasherh264v3/manifest.mpd
How do you create your content? Can you zip it up, so I can download all the files, and give me the values for the keys? I will try to take a closer look Monday.
Use this shell script to download files, it's easier no need to zip the same content. See also kid:key and test license urls. Content is created using referenceapp dasher java tool (+ffmpeg,mp4box). Latest dasher code is in a staging server and soon pushed to github.
KID=0x43215678123412341234123412341236
KEY=0x12341234123412341234123412341236
Playready=https://test.playready.microsoft.com/service/rightsmanager.asmx?cfg=(kid:header,sl:2000,persist:false,firstexp:60,contentkey:EjQSNBI0EjQSNBI0EjQSNg==)
Clearkey=https://m.dtv.fi/dash/laurl_ck.php
#!/bin/sh
## Download dash files
## Usage (run inside a subfolder):
## mkdir dasherh264v3
## cd dasherh264v3
## ../downloadfiles.sh
url=
function download() {
repid=$1
mkdir $repid
cd $repid
echo Download $url, $repid
for idx in {1..73}; do
wget "$url/$repid/${idx}.m4s"
done
wget "$url/$repid/i.mp4"
wget "$url/$repid/i_cenc.mp4"
wget "$url/$repid/i_clearkey.mp4"
wget "$url/$repid/i_marlin.mp4"
wget "$url/$repid/i_nopssh.mp4"
wget "$url/$repid/i_playready.mp4"
wget "$url/$repid/i_widevine.mp4"
cd ..
}
##########################################
## download DRMmed files, create drm subfolder
mkdir drm
cd drm
url=https://m.dtv.fi/dash/dasherh264v3/drm
download a1
download v1
download v2
download v3
wget "$url/manifest.mpd"
wget "$url/manifest_clearkey.mpd"
wget "$url/manifest_clearkey1077ef.mpd"
wget "$url/manifest_clearkeywithlaurl.mpd"
wget "$url/manifest_clearkeywithlaurlpssh.mpd"
wget "$url/manifest_nopssh.mpd"
cd ..
##########################################
## download nonDRM files
url=https://m.dtv.fi/dash/dasherh264v3
download a1
download v1
download v2
download v3
wget "$url/manifest.mpd"
it's easier
[citation needed]
../downloadfiles.sh: 10: ../downloadfiles.sh: Syntax error: "(" unexpected
Please provide a zip for analysis.
@sandersaares Download this file https://m.dtv.fi/dash/dasherh264v3.zip
Your ssh console is broken somehow or copypaste script had non-visible characters like windows newlines or something.
There seems to be something wrong with your base64 encoding in the key ID / key. The last character is different from what I get.
When I take manifest_clearkey.mpd it plays fine in dash.js as follows:
<script>
function init() {
const protData = {
"org.w3.clearkey": {
"clearkeys": {
"QyFWeBI0EjQSNBI0EjQSNg": "EjQSNBI0EjQSNBI0EjQSNg"
}
}
};
var video,
player,
url = "https://m.dtv.fi/dash/dasherh264v3/drm/manifest_clearkey.mpd";
video = document.querySelector("video");
player = dashjs.MediaPlayer().create();
player.initialize(video, url, true);
player.setProtectionData(protData);
}
</script>
@nicosang @sandersaares UUhh I was blind after compiling a simplified usecase, shuffled keys in a copypaste after trying "everything". Also to give a dynamic json KEY-VALUE pair had an error.
ClearKeyDRM with embedded kid:key (Firefox+Chrome ok)
https://m.dtv.fi/dash/index_clearkey2b.html?video=22
https://m.dtv.fi/dash/index_clearkey2b.html?video=31
https://m.dtv.fi/dash/index_clearkey2b.html?video=32
https://m.dtv.fi/dash/index_clearkey2b.html?video=34
ClearkeyDRM with laurl license url (Firefox+Chrome ok)
https://m.dtv.fi/dash/index_clearkey2.html?video=21
https://m.dtv.fi/dash/index_clearkey2.html?video=33
This means we need to write two manifests a) ClearkeyDRM with embedded kid:key and b) ClearkeyDRM with laurl use-case at least with dashjs player.
The lack of a license request with video 31 seems like a dash.js defect. Maybe it is possible to get it fixed and this would let you stick with only 1 video.
@nicosang do you know why the two last links above might behave different in terms of license acquisition?
no idea right now....
My hypothesis:
Just guessing based on behavior, have not looked at code.
@Murmur , it seems that you have a cross domain issue with the license request for the video=21 sample.
_has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed_
I will provide a new PR to remove modifications of PR #2827. There is a big regression : widevine sample stream can't be played.
Nico
@nicosang @sandersaares Devop made a change in a web server and CORS were two times in a reply. Should be fixed now. But it is now laurl test pages stopped working. PR removal maybe did something for clearkey-laurl use case?
ClearkeyDRM(laurl): not working anymore in Chrome/Firefox:
https://m.dtv.fi/dash/index_clearkey2.html?video=21
https://m.dtv.fi/dash/index_clearkey2.html?video=33
ClearkeyDRM(kid:key): embedded stills works in Chrome/Firefox:
https://m.dtv.fi/dash/index_clearkey2b.html?video=31
edit: Yes sir, all three works on my PC also. Must have been a caching issue before a tuple-cors fix was replicated to all the little places.
Sorry @Murmur but according to me, your three samples work now, don't they?
Most helpful comment
@nicosang @sandersaares Devop made a change in a web server and CORS were two times in a reply. Should be fixed now. But it is now laurl test pages stopped working. PR removal maybe did something for clearkey-laurl use case?
ClearkeyDRM(laurl): not working anymore in Chrome/Firefox:
https://m.dtv.fi/dash/index_clearkey2.html?video=21
https://m.dtv.fi/dash/index_clearkey2.html?video=33
ClearkeyDRM(kid:key): embedded stills works in Chrome/Firefox:
https://m.dtv.fi/dash/index_clearkey2b.html?video=31
edit: Yes sir, all three works on my PC also. Must have been a caching issue before a tuple-cors fix was replicated to all the little places.