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

DRM license wrapping in JSON #2682

Closed
jakubvojacek opened this issue Jul 2, 2018 · 9 comments
Closed

DRM license wrapping in JSON #2682

jakubvojacek opened this issue Jul 2, 2018 · 9 comments

Comments

@jakubvojacek
Copy link

We are planning to move from shaka player to dashjs for live content due to missing support of what shaka team calls "encoder drift" (shaka-project/shaka-player#999).

However, we are using widevine and license & response wrapping (for shaka it's nicely described here https://shaka-player-demo.appspot.com/docs/api/tutorial-license-wrapping.html). Basically, we need to send authentication header in each license / renewal request and both the request and response should be wrapped in JSON.

My understanding is that the header can be set as following:

player.setProtectionData({
	"com.widevine.alpha": {
	    "serverURL": "https://test...",
	    "httpRequestHeaders": {
	        "Authorization": licenseToken
	    }
	}
});

Is there a way to also be able send the request as JSON and receive it as JSON?

Thank you

@epiclabsDASH
Copy link
Contributor

@jakubvojacek, we are taking a look and will come back to you shortly with the best way of achieving this (license wrapping in json) in dash.js. Thanks for the patience.

@jakubvojacek
Copy link
Author

@epiclabsDASH thank you, will stay tuned 👍

@jakubvojacek
Copy link
Author

@epiclabsDASH any update on the feature request above? Do you need some examples of what I mean?

Thank you

@jakubvojacek
Copy link
Author

To clarify, this is how should the license request look like, for example:

{"profiles_id":10,"channels_id":20,"rawLicense":"CAESxx..."}

and this is how the license response looks like

{"rawLicense":"CAIS+QoKKgoQn2esM9iZ+hQMpyfR....","additional_data":{}}

Do you think something like this would be possible?

Thank you

@Achibana
Copy link

You can overwrite the getLicenseRequestFromMessage of keySystem to wrapper the request and unwrapper the response in getLicenseMessage in Servers.

@el-gringo
Copy link

el-gringo commented Jan 20, 2020

@Achibana

Hi, I have been able to wrap my license request, but I did not find a way to unwrap the response from the server.
Here is the way I did it:

const player = dashjs.MediaPlayer().create();
player.initialize(video, null, true);
player.setProtectionData({
    "com.widevine.alpha": {
        serverURL: WIDEVINE_LICENSE_URL,
        httpRequestHeaders: {
            "Authorization": "Bearer " + authenticationToken
        },
        withCredentials: false
    }
});

player.on(dashjs.MediaPlayer.events.KEY_SYSTEM_SELECTED, e => {
    e.data.keySystem.getLicenseRequestFromMessage = challenge => {
        const wrapper = {
            licenseRequest: base64Encode(challenge),
            ...otherData
        };
        const wrappedJson = JSON.stringify(wrapped);
        return wrappedJson;
    }
}

@Achibana
Copy link

@el-gringo you can unwrap the response from the Server:
const licenseMessage = licenseServerData.getLicenseMessage(xhr.response, keySystemString, messageType);
you can extent each server, like Widevine or PlayReady.

@el-gringo
Copy link

@Achibana Thank you, but I did not find a way to access licenseServerData. It does not seem to be exported anywhere.

@dsilhavy
Copy link
Collaborator

license request and response modification is implemented and an example is available here:
https://reference.dashif.org/dash.js/nightly/samples/drm/license-wrapping.html

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

5 participants