Пример #1
0
 protected function doGetFlavorAssetUrl(flavorAsset $flavorAsset)
 {
     $partnerId = $flavorAsset->getPartnerId();
     $flavorAssetId = $flavorAsset->getId();
     $versionString = $this->getFlavorVersionString($flavorAsset);
     return "/p/{$partnerId}/serveFlavor{$versionString}/flavorId/{$flavorAssetId}";
 }
 /**
  * @param flavorAsset $flavorAsset
  * @return string
  */
 protected function doGetFlavorAssetUrl(flavorAsset $flavorAsset)
 {
     $partnerId = $flavorAsset->getPartnerId();
     $subpId = $flavorAsset->getentry()->getSubpId();
     $flavorAssetId = $flavorAsset->getId();
     $partnerPath = myPartnerUtils::getUrlForPartner($partnerId, $subpId);
     $this->setFileExtension($flavorAsset->getFileExt());
     $this->setContainerFormat($flavorAsset->getContainerFormat());
     $versionString = $this->getFlavorVersionString($flavorAsset);
     $url = "{$partnerPath}/serveFlavor/entryId/" . $flavorAsset->getEntryId() . "{$versionString}/flavorId/{$flavorAssetId}";
     if ($this->protocol == StorageProfile::PLAY_FORMAT_RTSP) {
         return $url;
     }
     if ($this->protocol == StorageProfile::PLAY_FORMAT_APPLE_HTTP) {
         if (strpos($flavorAsset->getTags(), flavorParams::TAG_APPLEMBR) === FALSE) {
             // we use index_0_av.m3u8 instead of master.m3u8 as temporary solution to overcome
             // an extra "redirection" done on the part of akamai.
             // the auto created master.m3u8 file contains a single item playlist to the index_0_av.m3u8 file
             // this extra "redirection" fails
             $url = "http://" . @$this->params['hd_ios'] . "/i" . $url . "/index_0_av.m3u8";
         } else {
             $url .= "/file/playlist.m3u8";
         }
     } else {
         if ($this->clipTo) {
             $url .= "/clipTo/{$this->clipTo}";
         }
         if ($this->protocol == "hdnetworksmil") {
             $url = "http://" . $this->params["hd_flash"] . $url . '/forceproxy/true';
         } else {
             if ($this->protocol == StorageProfile::PLAY_FORMAT_RTMP) {
                 $url .= '/forceproxy/true';
                 $url = trim($url, "/");
                 if ($this->extention && strtolower($this->extention) != 'flv' || $this->containerFormat && strtolower($this->containerFormat) != 'flash video') {
                     $url = "mp4:{$url}";
                 }
             } else {
                 if ($this->extention) {
                     $url .= "/name/a.{$this->extention}";
                 }
                 if ($this->seekFromTime > 0) {
                     $fromTime = floor($this->seekFromTime / 1000);
                     /*
                      * Akamai servers fail to return subset of the last second of the video.
                      * The URL will return the two last seconds of the video in such cases. 
                      **/
                     $entry = $flavorAsset->getentry();
                     if ($entry && $fromTime > $entry->getDurationInt() - 1) {
                         $fromTime -= 1;
                     }
                     $url .= "?aktimeoffset={$fromTime}";
                 }
             }
         }
     }
     $url = str_replace('\\', '/', $url);
     return $url;
 }
Пример #3
0
 /**
  * @param flavorAsset $flavorAsset
  * @return string representing the basic url.
  */
 protected function getBaseUrl(flavorAsset $flavorAsset)
 {
     $partnerId = $flavorAsset->getPartnerId();
     $subpId = $flavorAsset->getentry()->getSubpId();
     $partnerPath = myPartnerUtils::getUrlForPartner($partnerId, $subpId);
     $flavorAssetId = $flavorAsset->getId();
     $versionString = $this->getFlavorVersionString($flavorAsset);
     $urlParams = $this->params->getUrlParams();
     $url = "{$partnerPath}/serveFlavor/entryId/" . $flavorAsset->getEntryId() . "{$versionString}/flavorId/{$flavorAssetId}" . $urlParams;
     return $url;
 }
Пример #4
0
 /**
  * @param flavorAsset $flavorAsset
  * @return string
  */
 public function getFlavorAssetUrl(flavorAsset $flavorAsset)
 {
     $partnerId = $flavorAsset->getPartnerId();
     $subpId = $flavorAsset->getentry()->getSubpId();
     $flavorAssetId = $flavorAsset->getId();
     $partnerPath = myPartnerUtils::getUrlForPartner($partnerId, $subpId);
     $this->setFileExtension($flavorAsset->getFileExt());
     $this->setContainerFormat($flavorAsset->getContainerFormat());
     $url = "{$partnerPath}/serveFlavor/flavorId/{$flavorAssetId}";
     if ($this->protocol == StorageProfile::PLAY_FORMAT_APPLE_HTTP) {
         if (strpos($flavorAsset->getTags(), flavorParams::TAG_APPLEMBR) === FALSE) {
             $url = "http://" . @$this->params['hd_ios'] . "/i" . $url . "/index_0_av.m3u8";
         } else {
             $url .= "/file/playlist.m3u8";
         }
     } else {
         if ($this->clipTo) {
             $url .= "/clipTo/{$this->clipTo}";
         }
         if ($this->extention) {
             $url .= "/name/{$flavorAssetId}.{$this->extention}";
         }
         if ($this->protocol == StorageProfile::PLAY_FORMAT_RTMP) {
             $url .= '/forceproxy/true';
             if ($this->extention && strtolower($this->extention) != 'flv' || $this->containerFormat && strtolower($this->containerFormat) != 'flash video') {
                 $url = "mp4:{$url}";
             }
         } else {
             if ($this->seekFromTime > 0) {
                 $url .= '?aktimeoffset=' . floor($this->seekFromTime / 1000);
             }
         }
     }
     if ($this->protocol == "hdnetworksmil") {
         $url = "http://" . $this->params["hd_flash"] . $url;
     }
     $url = str_replace('\\', '/', $url);
     if ($this->protocol == StorageProfile::PLAY_FORMAT_HTTP && @$this->params['http_auth_salt']) {
         $window = $this->params['http_auth_seconds'];
         $param = $this->params['http_auth_param'];
         $salt = $this->params['http_auth_salt'];
         $root_dir = $this->params['http_auth_root_dir'];
         $url = $this->urlauth_gen_url($root_dir . $url, $param, $window, $salt, null, null);
     }
     return $url;
 }
Пример #5
0
 /**
  * @param flavorAsset $flavorAsset
  * @return string representing the basic url.
  */
 protected function getBaseUrl(flavorAsset $flavorAsset)
 {
     $entry = entryPeer::retrieveByPK($this->params->getEntryId());
     $partnerId = $flavorAsset->getPartnerId();
     $subpId = $entry->getSubpId();
     $partnerPath = myPartnerUtils::getUrlForPartner($partnerId, $subpId);
     $url = "{$partnerPath}/serveFlavor/entryId/" . $entry->getId();
     if ($entry->getType() == entryType::PLAYLIST) {
         $partner = $entry->getPartner();
         $entryVersion = $entry->getVersion();
         $partnerFlavorVersion = $partner->getCacheFlavorVersion();
         $url .= ($entryVersion ? "/v/{$entryVersion}" : '') . ($partnerFlavorVersion ? "/pv/{$partnerFlavorVersion}" : '');
         $url .= '/flavorParamIds/' . $flavorAsset->getFlavorParamsId();
     } else {
         $url .= $this->getFlavorVersionString($flavorAsset);
         $url .= '/flavorId/' . $flavorAsset->getId();
     }
     $url .= $this->params->getUrlParams();
     return $url;
 }
Пример #6
0
 /**
  * @param BatchJob $parentJob
  * @param flavorAsset $asset
  * @param array $files
  * @return BatchJob
  */
 public static function addConcatJob(BatchJob $parentJob = null, flavorAsset $asset, array $files, $offset = null, $duration = null)
 {
     $jobData = new kConcatJobData();
     $jobData->setSrcFiles($files);
     $jobData->setFlavorAssetId($asset->getId());
     $jobData->setOffset($offset);
     $jobData->setDuration($duration);
     $entry = $asset->getentry();
     if ($entry && $entry->getStatus() != entryStatus::READY) {
         $entry->setStatus(entryStatus::PRECONVERT);
         $entry->save();
     }
     $batchJob = null;
     if ($parentJob) {
         $batchJob = $parentJob->createChild(BatchJobType::CONCAT);
     } else {
         $batchJob = new BatchJob();
         $batchJob->setPartnerId($asset->getPartnerId());
     }
     $batchJob->setEntryId($asset->getEntryId());
     $batchJob->setObjectId($jobData->getFlavorAssetId());
     $batchJob->setObjectType(BatchJobObjectType::ASSET);
     return self::addJob($batchJob, $jobData, BatchJobType::CONCAT);
 }
 /**
  * @param flavorAsset $flavorAsset
  * @return string
  */
 protected function doGetFlavorAssetUrl(flavorAsset $flavorAsset)
 {
     $partnerId = $flavorAsset->getPartnerId();
     $subpId = $flavorAsset->getentry()->getSubpId();
     $partnerPath = myPartnerUtils::getUrlForPartner($partnerId, $subpId);
     $flavorAssetId = $flavorAsset->getId();
     $this->setFileExtension($flavorAsset->getFileExt());
     $this->setContainerFormat($flavorAsset->getContainerFormat());
     $versionString = $this->getFlavorVersionString($flavorAsset);
     $url = "{$partnerPath}/serveFlavor/entryId/" . $flavorAsset->getEntryId() . "{$versionString}/flavorId/{$flavorAssetId}";
     if ($this->seekFromTime > 0) {
         $url .= "/seekFrom/{$this->seekFromTime}";
     }
     if ($this->clipTo) {
         $url .= "/clipTo/{$this->clipTo}";
     }
     switch ($this->protocol) {
         case StorageProfile::PLAY_FORMAT_RTMP:
             $url .= '/forceproxy/true';
             if ($this->extention && strtolower($this->extention) != 'flv' || $this->containerFormat && strtolower($this->containerFormat) != 'flash video') {
                 $url = "mp4:{$url}/name/a.mp4";
             } else {
                 $url .= "/name/a.flv";
             }
             break;
         case StorageProfile::PLAY_FORMAT_APPLE_HTTP:
             $url .= "/file/playlist.m3u8";
             break;
     }
     $url = str_replace('\\', '/', $url);
     return $url;
 }