HbbTV-Association / ReferenceApplication

MIT License
80 stars 32 forks source link

OIPF: Manage possible errors returned by the DRM Playready #60

Closed Pazzeo closed 1 year ago

Pazzeo commented 1 year ago

Hello,

Using the method oipfDrm.sendDRMMessage I have always the return code of the execution of the method, but I'm not able to retrieve the possible return error code provided by the remote License server. For example, using the TEST 2.1, I tired to trigger an error modifying the contentkey. However, I was not able to capture the errror returned. I had always the resultCode equal to 0. Do you think it is possible to achieve? Reading the documentation I saw that there is this method onDRMSystemMessage. Does anyone have experience with that?

Thanks Pazzeo

Murmur commented 1 year ago

I had always the resultCode equal to 0 -> Do you mean a function sendDRMMessage(..) is always 0 in an appropriate async callback handlers?

modifying the contentkey -> Do you mean you modified the KeyID in the manifest or you refer to a ContentID value?

String contentID – the unique identifier of the protected content in the scope of the DRM system 
that raises the error (i.e. in the case of Marlin BB it is the Marlin contentID, 
in the case of CSPG-CI+ and CSPG-DTCP this field is empty).

Sorry, we have not used onDRMSystemMessage callback listener. What do you see in onDRMMessageResult, onDRMRightsError callback listeners?

retrieve the return error code provided by the remote License server -> If you are trying to catch the real http body text and response code of Laurl invocation then it may be quite difficult in a native player environment (oipf).

// Set Playready LAURL address for playback
var laUrl = "https://mydrm.com/licenseurl";
var msgType = "application/vnd.ms-playready.initiator+xml";
var DRMSysID = "urn:dvb:casystemid:19219";
var xmlLicenceAcquisition =
'<?xml version="1.0" encoding="utf-8"?>' +
'<PlayReadyInitiator xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols/">' +
   '<LicenseServerUriOverride>' +
      '<LA_URL>' +laUrl + '</LA_URL>' +
   '</LicenseServerUriOverride>' +
'</PlayReadyInitiator>';

oipfDrm.onDRMMessageResult = drmMsgHandler;
oipfDrm.onDRMRightsError = drmRightsErrorHandler;
oipfDrm.onDRMSystemMessage = drmSysMsgHandler;

// msgId identifies the drmMsgHandler(msgId, ...) callback
var msgId = oipfDrm.sendDRMMessage(msgType, xmlLicenceAcquisition, DRMSysID);
console.log("sendDrmMsgId=" + msgId);

function drmMsgHandler(msgId, resultMsg, resultCode) {
  console.log("" + msgId +","+  resultMsg +","+ resultCode);
}
function drmRightsErrorHandler(resultCode, contentId, systemId, issuerUrl) {
  console.log("" + resultCode + "," + contentId + "," + systemId + "," + issuerUrl);
}

// DRM system has a message to report to the current html doc.
function drmSysMsgHandler(msg, systemId) {
  console.log(""+ msg + "," + systemId);
}
Pazzeo commented 1 year ago

Hi Murmur,

Do you mean a function sendDRMMessage(..) is always 0 in an appropriate async callback handlers? Yes, the return code is not reporting for example that the license manager was not able to generate the license

Do you mean you modified the KeyID in the manifest or you refer to a ContentID value? I've modified the contentKey used in the LAURL to make a failure in the license request. Moreover, I've tried also to remove the entire field. But in any case, I was not able to retrieve the error message returned by the license server.

In general, I would like to have a feedback on the status of the acquisition of the license. So for that, I was trying to access the http body and response code. I think it is not possible using the native player, correct? In general, is it not possible to access the CustomData present in the answer?

I've tried to implement the onDRMSystemMessage as you shared, but nothing it is reported. In the documentation is not clear what "DRM system has a message to report" means. Do you have any idea?

Thanks Pazzeo

Murmur commented 1 year ago

No I don't know what onDRMSystemMessage actually should report back to the application.

I see you modified a bogus contentkey:XXXX attribute in a license url so that payload decryption should fail. This is a microsoft test server so laurl always return a license object no matter what contentKey or KeyId you provide.

If you want playready laurl to fail put securitylevel=9999 so it definitely returns http error and soapxml error document, also put a bogus KeyId and contentKey to make sure payload cannot be decoded. https://test.playready.microsoft.com/service/rightsmanager.asmx?cfg=(kid:01020304-0101-0202-0303-001122334455,sl:9999,persist:false,contentkey:AABBCCI0EjQSNBI0EjQSNw==)

Still oipfDrmAgent may not report failed laurl invocation but gives you resultCode=0 retval.

jpiesing commented 1 year ago

I've tried to implement the onDRMSystemMessage as you shared, but nothing it is reported. In the documentation is not clear what "DRM system has a message to report" means. Do you have any idea?

I've looked in Microsoft's documentation on PlayReady and HbbTV and cannot see any mention of onDRMSystemMessage so I guess it's not used with PlayReady. This is part of the PlayReady licensee documentation so is confidential and please don't ask me to share it :(

Pazzeo commented 1 year ago

Thanks guys. So, in general it is not possible to know the result of the html request. Reading the documentation of hbbtv, I saw that there is this method Boolean canPlayContent( String DRMPrivateData, String DRMSystemID ) My concern is what is the DRMPrivateData? In case of DASH, is it the pssh present in the mpd? The question is that it could be used if the content is playable after the execution of sendDRMMessage.

Pazzeo

bobcampbell-resillion commented 1 year ago

Hi, the "Improving Interoperability Task Force" group in HbbTV reviewed this ticket and suggest that you might get more engagement and perhaps some help via the new HbbTV Developer Portal and specifically the Forum

I'm closing this here, as its not strictly an issue with the Reference Application, and its been open a number of months with no further answers provided.