Esempio n. 1
0
 public function getThumbnailUrl(KSecureEntryHelper $securyEntryHelper, $storageId = null, KalturaThumbParams $thumbParams = null)
 {
     if ($thumbParams) {
         $assetUrl = $this->getDownloadUrlWithExpiry(84600);
         $assetParameters = KalturaRequestParameterSerializer::serialize($thumbParams, "thumbParams");
         $thumbnailUrl = $assetUrl . "?thumbParams:objectType=KalturaThumbParams&" . implode("&", $assetParameters);
     }
     if ($storageId) {
         $thumbnailUrl = $this->getExternalUrl($storageId);
     }
     $thumbnailUrl = $this->getDownloadUrl(true);
     /* @var $serverNode EdgeServerNode */
     $serverNode = $securyEntryHelper->shouldServeFromServerNode();
     if (!$serverNode) {
         return $thumbnailUrl;
     }
     $urlParts = explode("://", $thumbnailUrl);
     return $urlParts[0] . "://" . $serverNode->buildEdgeFullPath('http', null, null, assetType::THUMBNAIL) . $urlParts[1];
 }
Esempio n. 2
0
 /**
  * Get download URL for the asset
  * 
  * @action getUrl
  * @param string $id
  * @param int $storageId
  * @param KalturaThumbParams $thumbParams
  * @return string
  * @throws KalturaErrors::THUMB_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::THUMB_ASSET_IS_NOT_READY
  */
 public function getUrlAction($id, $storageId = null, KalturaThumbParams $thumbParams = null)
 {
     $assetDb = assetPeer::retrieveById($id);
     if (!$assetDb || !$assetDb instanceof thumbAsset) {
         throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_ID_NOT_FOUND, $id);
     }
     if (kEntitlementUtils::getEntitlementEnforcement()) {
         $entry = entryPeer::retrieveByPK($assetDb->getEntryId());
         if (!$entry) {
             //we will throw thumb asset not found, as the user is not entitled, and should not know that the entry exists.
             throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_ID_NOT_FOUND, $id);
         }
     }
     if ($assetDb->getStatus() != asset::ASSET_STATUS_READY) {
         throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_IS_NOT_READY);
     }
     if ($thumbParams) {
         $assetUrl = $assetDb->getDownloadUrlWithExpiry(84600);
         $assetParameters = KalturaRequestParameterSerializer::serialize($thumbParams, "thumbParams");
         return $assetUrl . "?thumbParams:objectType=KalturaThumbParams&" . implode("&", $assetParameters);
     }
     if ($storageId) {
         return $assetDb->getExternalUrl($storageId);
     }
     return $assetDb->getDownloadUrl(true);
 }