Dash-Industry-Forum / dash.js

A reference client implementation for the playback of MPEG DASH via Javascript and compliant browsers.
http://reference.dashif.org/dash.js/nightly/samples/dash-if-reference-player/index.html
Other
5.11k stars 1.67k forks source link

Clear key DRM Protection not working in Dash Js but work in Shaka Player #3387

Closed singhcool closed 4 years ago

singhcool commented 4 years ago
Clear key DRM Protection not working in Dash Jsw but work in Shaka Player

I have encrypted the video using clearkey not playing in dash js player but the mpd file plays well in shaka player and Jsw player

Please refer to the below Mpd file content. Please help advance thanks

<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" mediaPresentationDuration="PT32.000S" minBufferTime="PT3.00S" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static">
<!--  Created with Bento4 mp4-dash.py, VERSION=1.8.0-629  -->
<Period>
<!--  Video  -->
<AdaptationSet maxHeight="1080" maxWidth="1964" mimeType="video/mp4" segmentAlignment="true" startWithSAP="1">
<SegmentTemplate duration="3000" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/seg-$Number$.m4s" startNumber="1" timescale="1000"/>
<Representation bandwidth="4307806" codecs="avc1.64002A" frameRate="24" height="1080" id="video/avc1" scanType="progressive" width="1964"/>
</AdaptationSet>
<!--  Audio  -->
<AdaptationSet lang="en" mimeType="audio/mp4" segmentAlignment="true" startWithSAP="1">
<SegmentTemplate duration="3000" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/seg-$Number$.m4s" startNumber="1" timescale="1000"/>
<Representation audioSamplingRate="44100" bandwidth="119006" codecs="mp4a.40.2" id="audio/en/mp4a">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
</Representation>
</AdaptationSet>
</Period>
</MPD>

rsz_screenshot_from_2020-08-26_21-37-25

dsilhavy commented 4 years ago

Did you check the sample? https://reference.dashif.org/dash.js/nightly/samples/drm/clearkey.html

singhcool commented 4 years ago

@dsilhavy Yes I have checked with your samples. But our mpd file different from your mpd file. But our mpd file working fine with shaka. Dash player support any specific type of clear key encryption Can you provide any encryption steps with clear key. I struggled more than two days. Please help to rectify this issue

dsilhavy commented 4 years ago

If you host your content (MPD and segments) we might be able to look into this.

dsilhavy commented 4 years ago

Please also keep in mind that you need to host the player on an https server if you are testing outside of localhost. Otherwise EME is disabled

singhcool commented 4 years ago

@dsilhavy Please find the below source http://www.mediafire.com/folder/n4qy9s36xvq7o/31313-fmp4 Clear Key : 87237D20A19F58A740C05684E699B4AA

Clear Key ID: A16E402B9056E371F36D348AA62BB749

dsilhavy commented 4 years ago

Please host the content on a webserver or upload as a zip

singhcool commented 4 years ago

@dsilhavy Issue happened due to clearkey encoding method. I converted key into base64url encode. Then issue automatically fixed Thanks for your response @dsilhavy

const key = a4eb03f8e0928d2e55e37c2fa6afb1ce
const keyId = 12fa7db6feed6dc1c301fc0e66e35fb3
const keyEncoded = Buffer.from(key, 'hex').toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/[==]+$/, '');
const keyIdEncoded = Buffer.from(keyId, 'hex').toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/[==]+$/, '');