-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Fix/fairplay different key per asset #3261
Fix/fairplay different key per asset #3261
Conversation
…ry to support multiple concurrent requests
Video.js
Outdated
@@ -267,15 +267,15 @@ export default class Video extends Component { | |||
const getLicensePromise = Promise.resolve(getLicenseOverride); // Handles both scenarios, getLicenseOverride being a promise and not. | |||
getLicensePromise.then((result => { | |||
if (result !== undefined) { | |||
NativeModules.VideoManager.setLicenseResult(result, findNodeHandle(this._root)); | |||
NativeModules.VideoManager.setLicenseResult(result, data.contentId, findNodeHandle(this._root)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do this change impact client app ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should not affect the client app because setLicenseResult
and setLicenseError
are not called by the client.
Thank you for this great enhancement ! I think you update https://github.com/react-native-video/react-native-video/blob/master/docs/DRM.md#getlicense function Thank you |
Hello @freeboub, thanks for your comments. We decided to take in account your comment #2881 (comment) and kept The |
@facugu1998 Thank you for the changes, can you please complete DRM.md file, at least to add the new prop: licenseUrl |
@freeboub Actually, the parameters were available before the PR. The docs were not updated, how can we describe the function? We thought something like this:
|
@facugu1998 Yes that's Ok for me, thank you. (I agree DRM doc is not really clear in general ;) ) |
Hello @freeboub, we updated the DRM documentation. Should we change something else? |
@facugu1998 can you please chack following PR please ? #3578 I changed the api as it is causing some regressions on existing implementation, do you agree with that ? |
@freeboub hello, I think it's perfect. But in order to make it work I had to do the changes I detailed here #3417 (comment). |
Summary
As described in #3227, when a content has mutliple asset and each asset has different key, for example, skd://{key}/AUDIO for audio playlist, skd://{key}/HD and skd://{key}/SD for video playlist, the content is not being played.
Problem found
In
ios/Video/Features/RCTResourceLoaderDelegate.swift
, for everycontentId
the functionhandleDrm()
is called. For every call, the_loadingRequest
object was set to the current call, so the reference to the previous_loadingRequest
is lost. Also, when thelicense
is retrieved from thegetLicense
function, thesetLicenseResult
is called, and sets the current_loadingRequest
to finished, event though it was already finished.Solution description
We replaced the
_loadingRequest
object to a dictionary ofAVAssetResourceLoadingRequest
with key thecontentId
of the request. So, when the license is resolved, it looks for the request in the dictionary and finishes it with the corresponding value. Then, it removes it from the dictionary.In order to get that working, we had to add the parameter
contentId
to the native functionssetLicenseResult
andsetLicenseResultError
. Also, we had to pass thecontentId
asloadingRequest.request.url?.absoluteString,
in_onGetLicense
insidehandleDRM
, so, the getLicense function now receives the full request url and not only the request's host.Video Sample
You can test the problem and solution with the following content:
URL: https://cdnw1-stg.zetatv.com.uy/testzapp/bigbuckbunny/playlist.m3u8
licenseServer: https://pm-stg.zetatv.com.uy:8443/api/fairplay/get_license/fbdd541b-0036-4b4c-afef-351b7627ba81/
certificateUrl: https://pm-stg.zetatv.com.uy:8443/fairplay/cert.crt
Requirements for testing
The onGetLicense function defined on the video component should be the following: