/**
  * @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;
 }
コード例 #2
0
ファイル: DeliveryProfile.php プロジェクト: AdiTal/server
 /**
  * Derives the delivery profile dynamic attributes from the file sync and the flavor asset.
  * @param FileSync $fileSync
  * @param flavorAsset $flavorAsset
  */
 public function initDeliveryDynamicAttributes(FileSync $fileSync = null, flavorAsset $flavorAsset = null)
 {
     if ($flavorAsset) {
         $this->params->setContainerFormat($flavorAsset->getContainerFormat());
     }
     if ($flavorAsset && $flavorAsset->getFileExt() !== null) {
         // if the extension is missing use the one from the actual path
         $this->params->setFileExtension($flavorAsset->getFileExt());
     } else {
         if ($fileSync) {
             $this->params->setFileExtension(pathinfo($fileSync->getFilePath(), PATHINFO_EXTENSION));
         }
     }
 }
 /**
  * @param kUrlManager $urlManager
  * @param FileSync $fileSync
  * @param flavorAsset $flavorAsset
  * @param string $format
  */
 private function setupUrlManager($urlManager, FileSync $fileSync = null, flavorAsset $flavorAsset = null, $format = null)
 {
     $urlManager->setClipTo($this->clipTo);
     if ($flavorAsset) {
         $urlManager->setContainerFormat($flavorAsset->getContainerFormat());
     }
     if ($flavorAsset && $flavorAsset->getFileExt() !== null) {
         // if the extension is missig use the one from the actual path
         $urlManager->setFileExtension($flavorAsset->getFileExt());
     } else {
         if ($fileSync) {
             $urlManager->setFileExtension(pathinfo($fileSync->getFilePath(), PATHINFO_EXTENSION));
         }
     }
     if (!$format) {
         $format = $this->format;
     }
     $urlManager->setProtocol($format);
 }
コード例 #4
0
 /**
  * @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;
 }
コード例 #5
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;
 }