-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Remove all FairPlay formatting #1951
Comments
@joeyparrish , for me it's important have the sessionId and the contentId to format correctly the request. Is it possible include it? |
Note: in the PatchedMediaKeysApple.onWebkitKeyMessage_ I see the sessionId but not in shaka.media.DrmEngine.prototype.sendLicenseRequest_ |
Do you know why fc081fe doesn't exist in the current version? It has all that's needed to run on BuyDRM KeyOS - skd parsing and assetId parameter. |
It dropped the assetId in the process though. Maybe that could be the default or at least there should be a way to access contentId easily. |
This allows a request/response filter to determine which EME session made the request. This also changes the session ID of FairPlay sessions so they are available too. Issue #1951 Change-Id: I1a07abae6faf4a87fad7b5d4290a00b25e83da8e
Now any formatting must be done by the app the same as other key systems. Issue #1951 Change-Id: Ifeaa0abdfda462cd457d19f6dce93c5af3a5fdad
@TheModMaker, I is saw the commits published yesterday, but it doesn't include the contentId. The contentId it's necessary in some Fairplay license servers. Can you add it? Note: the function extractContentId must be customizable by the app (each Fairplay implementation use his own format) I attach the official example from Apple: |
@avelad, I believe we accidentally added the session ID to the |
I suggest you take a look at the new tutorial for more info. We extract the content id from the init data we get from the browser. You can look at the body of the request and extract either the content id we think it is or use the browser init data to get your own content id. |
@TheModMaker, now that I'm looking at it again, I'm a bit confused, as well. Perhaps we can clarify this in the tutorial. For example, currently it says:
The body contains the "init data", and the format of the "init data" includes another "init data" and the "content ID". It says the content ID is extracted from the "init data", and the "init data" is provided by the browser. That's a lot of "init data" references and at least two different things by that name. It's unclear (to me) which refers to what. |
Ok. I'll fix it. For the record, the "init data" in most contexts refers to what we get from the browser. That blob is the POST body in the request filter and, by default, what we send to the server. |
I think that the documentation is a bit confusing. The issue with the contentId is related to #1923 According to Apple documentation, the "final" initData is (when the webkitneedkey event is fired):
In the Shaka implementation, I don't see the contentId: Secondly, the function extractContentId must be customizable by the apps (eg: filter) due differents FairPlay servers has different implementation (with our providers we are found 3 implementations differents in 5 providers) |
On the other hand, although it is more a question, I am not very familiar with the operation of Uint8Array, could you add in the tutorial an example of how to extract the initData, contentId and serverCertificate fields (although the latter has already been given in the configuration of the player)? |
Or perhaps we should even create a utility method that apps can use to parse FairPlay init data, if that is going to be commonly required. |
I wonder if we should just remove all formatting from FairPlay requests. So all we'd do is pass the init data we get from the browser. The app would then have to create a request filter that appends their cert. We could provide a helper to aid in this. This would allow the app to have their own content ID calculations. We also would no longer require a server certificate for FairPlay since the app will be adding it in the request filter. So every app would need to do something like: player.getNetworkingEngine().registerRequestFilter((type, request) => {
if (type != shaka.net.NetworkingEngine.RequestType.LICENSE) {
return;
}
const initData = new Uint8Array(request.body);
const contentId = shaka.util.FairPlayUtils.defaultGetContentId(initData);
request.body = shaka.util.FairPlayUtils.defaultCreatePostData(
initData, contentId, myCert);
}); We could even have a default filter generator, something like this: player.getNetworkingEngine().registerRequestFilter(
shaka.util.FairPlayUtils.createRequestFilter(myCert));
player.getNetworkingEngine().registerRequestFilter(
shaka.util.FairPlayUtils.createRequestFilter(myCert, getContentId));
// Or alternatively
shaka.util.FairPlayUtils.addRequestFilter(player, myCert, getContentId)); |
Actually I was confused about what is happening here. The init data comes from the media and we need to transform it before passing it to the browser (before @avelad To answer your comment above, we do generate the init data like you said, but there is no way to customize the content ID. It appears here: https://github.com/google/shaka-player/blob/438d5998044073bbe0186470426d344bf6ac48ef/lib/polyfill/patchedmediakeys_apple.js#L162-L218 |
Hum... I was looking in the wrong place ... :S Yes but that's how you say, I need "something" to personalize the contentId. |
This allows a request/response filter to determine which EME session made the request. This also changes the session ID of FairPlay sessions so they are available too. Issue #1951 Change-Id: I1a07abae6faf4a87fad7b5d4290a00b25e83da8e
Closes #1951 Change-Id: I2dac43117ef444cf0701b2195d4a0e93385e5d52
Now there is a generic callback to transform the init data before passing it to the browser. This can be used by apps to use a custom content ID in FairPlay content. This also adds some utilities to help in writing these functions and moves the default behavior to DrmEngine. Closes #1951 Change-Id: I78ce660c126b53a69d5f55b16775ffcdbbe4d748
These will be cherry-picked to appear in v2.5.5. But, to avoid breaking anyone depending on it, we will still provide the old filters by default. For v2.5.x, you can disable this by setting the |
It seems that different FairPlay license servers communicate differently. We initially implemented a superset of the format used in Apple's sample docs, but this turns out to be a poor intermediate format for others to build request/response filters for arbitrary formats.
We should remove the formatting of requests and responses, which unfortunately will require applications to use request/response filters for FairPlay in (probably) all cases.
To close this issue, we should:
eval
, which is regrettable, and will need to be whitelisted inbuild/conformance.textproto
See also #1915 (comment), #1923.
The text was updated successfully, but these errors were encountered: