예제 #1
0
 /**
  * Get Play Ready policy and dates for license creation
  * 
  * @action getLicenseDetails
  * @param string $keyId
  * @param string $deviceId
  * @param int $deviceType
  * @param string $entryId
  * @param string $referrer 64base encoded  
  * @return KalturaPlayReadyLicenseDetails $response
  * 
  * @throws KalturaErrors::MISSING_MANDATORY_PARAMETER
  * @throws KalturaErrors::ENTRY_ID_NOT_FOUND
  * @throws KalturaPlayReadyErrors::ENTRY_NOT_FOUND_BY_KEY_ID
  * @throws KalturaPlayReadyErrors::PLAYREADY_POLICY_NOT_FOUND
  */
 public function getLicenseDetailsAction($keyId, $deviceId, $deviceType, $entryId = null, $referrer = null)
 {
     KalturaLog::debug('Get Play Ready license details for keyID: ' . $keyId);
     $entry = $this->getLicenseRequestEntry($keyId, $entryId);
     $referrerDecoded = base64_decode(str_replace(" ", "+", $referrer));
     if (!is_string($referrerDecoded)) {
         $referrerDecoded = "";
     }
     // base64_decode can return binary data
     $drmLU = new DrmLicenseUtils($entry, $referrerDecoded);
     $policyId = $drmLU->getPolicyId();
     if (!isset($policyId)) {
         throw new KalturaAPIException(KalturaPlayReadyErrors::PLAYREADY_POLICY_NOT_FOUND, $entry->getId());
     }
     $dbPolicy = DrmPolicyPeer::retrieveByPK($policyId);
     if (!$dbPolicy) {
         throw new KalturaAPIException(KalturaPlayReadyErrors::PLAYREADY_POLICY_OBJECT_NOT_FOUND, $policyId);
     }
     list($beginDate, $expirationDate, $removalDate) = $this->calculateLicenseDates($dbPolicy, $entry);
     $policy = new KalturaPlayReadyPolicy();
     $policy->fromObject($dbPolicy, $this->getResponseProfile());
     $this->registerDevice($deviceId, $deviceType);
     $response = new KalturaPlayReadyLicenseDetails();
     $response->policy = $policy;
     $response->beginDate = $beginDate;
     $response->expirationDate = $expirationDate;
     $response->removalDate = $removalDate;
     return $response;
 }