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

Specific dash drm stream can't be played with dash.js meanwhile shakaplayer plays it. #2721

Closed
dovelive opened this issue Jul 27, 2018 · 9 comments

Comments

@dovelive
Copy link

dovelive commented Jul 27, 2018

I have a specific dash drm stream which was made with wowza and shaka extension.
We built a extension module for Wowza regarding the following article.
https://www.wowza.com/docs/how-to-test-mpeg-dash-webm-encryption-using-shaka-player
It was simply encrypted with clear key.

It can be played with shaka player as well as jwplayer.
However it can't be played with dash.js.

So I just want to know if that problem is because of the error in dash.js or configuration of stream.
I will share my code and mpd file. So please review it and let me knew about the resolution.

Here is the demo for this code.

http://jsbin.com/busolohewi/edit?html,css,output

html code

<!doctype html>
<html>
    <head>
        <title>Dash.js Rocks</title>
    </head>
        <style>
            video {
                width: 640px;
                height: 360px;
            }
        </style>
    <body>
        <div>
            <video id="video" controls></video>
        </div>
        <script src="//cdn.dashjs.org/latest/dash.all.debug.js"></script>
        <script>
            (function(){
          var url = "//vod-a141.videog.jp/vod/_definst_/smil:storage1/86/61/EgJM-KrjEHPm/template.smil/manifest.mpd";

            var player = dashjs.MediaPlayer().create();
			player.setProtectionData({
				"org.w3.clearkey": { "clearkeys": { "0294b9599d755de2bbf0fdca3fa5eab7":"O9ovQDRMfe9hQie5wPA+Jg" } } // KID=KEY
			});
            player.initialize(document.querySelector("#video"), url, false);

            })();
        </script>
    </body>
</html>

mpd file code.


<?xml version="1.0" encoding="UTF-8"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns="urn:mpeg:dash:schema:mpd:2011"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     xmlns:cenc="urn:mpeg:cenc:2013"
     xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd"
     profiles="urn:mpeg:dash:profile:isoff-live:2011"
     type="static"
     publishTime="2018-07-27T11:44:04Z" 
     mediaPresentationDuration="PT57.655S"
     minBufferTime="PT1.5S">
<ProgramInformation>
    <Title>storage1/86/61/EgJM-KrjEHPm/template.smil</Title>
</ProgramInformation>
<Period id="0" start="PT0.0S">
    <AdaptationSet id="0" group="1" mimeType="video/mp4" maxWidth="1920" maxHeight="1080" par="16:9" frameRate="30000/1001" segmentAlignment="true" startWithSAP="1" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
        <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="0294B959-9D75-5DE2-BBF0-FDCA3FA5EAB7"/>
        <ContentProtection schemeIdUri="urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e" value="ClearKey1.0">
            <cenc:pssh>AAAANHBzc2gBAAAA4nGdWKmFs8l4GrAwr3jTDgAAAAEClLlZnXVd4rvw/co/peq3AAAAAA==</cenc:pssh>
        </ContentProtection>
        <SegmentTemplate presentationTimeOffset="0" timescale="90000" media="chunk_ctvideo_rid$RepresentationID$_cs$Time$_mpd.m4s" initialization="chunk_ctvideo_rid$RepresentationID$_cinit_mpd.m4s">
            <SegmentTimeline>
                <S t="0" d="1081080"/>
                <S d="720720"/>
                <S d="1081080"/>
                <S d="720720"/>
                <S d="1081080"/>
                <S d="504270"/>
            </SegmentTimeline>
        </SegmentTemplate>
        <Representation id="p0va0br3077761" codecs="avc1.42c028" width="1920" height="1080" sar="1:1" bandwidth="3077761" />
        <Representation id="p0va0br1539736" codecs="avc1.42c01f" width="1280" height="720" sar="1:1" bandwidth="1539736" />
        <Representation id="p0va0br819223" codecs="avc1.42c01f" width="800" height="450" sar="1:1" bandwidth="819223" />
        <Representation id="p0va0br512068" codecs="avc1.42c01e" width="480" height="270" sar="1:1" bandwidth="512068" />
    </AdaptationSet>
    <AdaptationSet id="1" group="2" mimeType="audio/mp4" lang="eng" segmentAlignment="true" startWithSAP="1" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
        <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
        <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="0294B959-9D75-5DE2-BBF0-FDCA3FA5EAB7"/>
        <ContentProtection schemeIdUri="urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e" value="ClearKey1.0">
            <cenc:pssh>AAAANHBzc2gBAAAA4nGdWKmFs8l4GrAwr3jTDgAAAAEClLlZnXVd4rvw/co/peq3AAAAAA==</cenc:pssh>
        </ContentProtection>
        <SegmentTemplate presentationTimeOffset="0" timescale="44100" media="chunk_ctaudio_rid$RepresentationID$_cs$Time$_mpd.m4s" initialization="chunk_ctaudio_rid$RepresentationID$_cinit_mpd.m4s">
            <SegmentTimeline>
                <S t="0" d="529729"/>
                <S d="353153"/>
                <S d="529729"/>
                <S d="353153"/>
                <S d="529729"/>
                <S d="247093"/>
            </SegmentTimeline>
        </SegmentTemplate>
        <Representation id="p0aa0br80011" codecs="mp4a.40.2" audioSamplingRate="44100" bandwidth="80011">
        </Representation>
    </AdaptationSet>
</Period>
</MPD>

@dovelive
Copy link
Author

@dovelive dovelive changed the title Specific dash stream can't be played with dash.js meanwhile shakaplayer plays it. Specific dash drm stream can't be played with dash.js meanwhile shakaplayer plays it. Jul 27, 2018
@davemevans
Copy link
Contributor

davemevans commented Jul 30, 2018

The exception thrown is the same as reported in #2326 (comment), which suggests that the fix there is not complete.

It looks like everything goes OK until needkey is fired, at which point the supplied cenc initData (pssh from the segment) is provided to the CDM with the initDataType incorrectly set to keyids, at which point the exception is thrown.

Note that the key IDs and keys provided to the player in the setProtectionData call should be base64url encoded - in the example above, that does not appear to be the case.

@davemevans
Copy link
Contributor

As noted above, the keyid and key provided in the OP's example are invalid because they are not base64url encoded.

Once the protection data is fixed up and the fix from #2326 is mirrored in the other half of the if (keySystem) statement in selectKeySystem, the content plays.

This may or may not be the right solution - it may be preferable to pass the pssh to the CDM, in which case the fix could be in createKeySession. Another possibility could be comparing the known keyids to those in the pssh in the needkey handler, and ignoring if it only mentions keyids provided by the application.

@dovelive
Copy link
Author

Hi. @bbcrddave

I've changed the keyid to base64 encoded string, but it still not worked.
Would you like to commit or upload the patch that you are going to apply for fixing this issue?

@davemevans
Copy link
Contributor

The key also needs to be base64url encoded (ie the + needs to be replaced with a -).

I'm not proposing a PR because I think some more discussion, with people who understand this area of the code better, about what the best way to fix this is probably needed. @epiclabsDASH authored #2436 so I think he might be the best person to start with.

@epiclabsDASH
Copy link
Contributor

Taking care of this. Thanks everyone for the provided feedback.

@epiclabsDASH
Copy link
Contributor

I think this could be related with #2769 and the PR #2770 proposed by @bbert. Apart from the base64 problem, whose solution was already suggested by @davemevans, there was a regression in ClearKey module.

@epiclabsDASH
Copy link
Contributor

Closing issue. @dovelive, please, feel free to reopen it in case you can still reproduce the issue. Thanks.

@dovelive
Copy link
Author

dovelive commented Oct 8, 2018

Hi. @epiclabsDASH
I checked the patch but I found that my issue has not solved.

PR #2770 hasn't solved this issue.

So please check it once more.

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

3 participants