Skip to main content
Skip table of contents

Obtaining the licence and entitlement check

This document describes how to obtain licences in direct mode only.

The client application must get licences to access protected content and must be integrated with the remote server portal to send and retrieve licence payloads.

The PAK connects directly to the licence server to retrieve licences. The client application and the remote server portal do not need to be involved in exchanges but should exchange data through application data sent along initialisation exchanges, typically to manage authentication of license requests.

The get licence operation must take place each time the client application needs to display protected content.

Example code

The following code example shows how to get a licence in direct mode.

CODE
// checkAccess notification called when we want to play protected content

- (void)checkAccess
{
  (…)
  IPakCoreDrmAgent* pDrmAgent = [self getDrmAgent];
  std::vector<IPakCoreDrmSession*> pSessions = pDrmAgent->getDrmSessions();
  for (auto it=pSessions.begin() ; it < pSessions.end(); it++ )
  {
    IPakCoreDrmSession* pDrmSession = *it;
    assert(pDrmSession);
 
    IPakCoreDrmEntitlement* pEntitlement = pDrmSession->pGetRelatedDrmEntitlement();
    assert(pEntitlement);
 
    int sessionStatus = pDrmSession ->getStatus() ;
    int entitlementState = pEntitlement->getState();
      
    if (pDrmSession->getAccess() == IPakCoreDrmSession::DRM_ACCESS_DENIED_INVALID_ENTITLEMENT ||
        pDrmSession->getAccess() == IPakCoreDrmSession::DRM_ACCESS_DENIED)
    {
         BOOL result = pEntitlement->requestLicense([_server[PROTECTED_PRIVATE_DATA] UTF8String],
                                                          [_server[CLEAR_PRIVATE_DATA] UTF8String],
                                                          [_server[SERVER_URL] UTF8String]
                                                          );
}
    delete pDrmSession;
  }//end forloop
}

Checking entitlements

The entitlement check describes which values will be returned by the different objects' methods when the entitlement is present but denying access due to its expiration. In this case, the client application can automatically re-fetch the license or prompt the user to purchase the entitlement again. This operation can take place at any time.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.