Пример #1
0
 /**
  * @return array primary URL and backup URL
  */
 private function getLiveEntryBaseUrls()
 {
     $this->initFlavorParamsIds();
     $tag = null;
     $tags = $this->deliveryAttributes->getTags();
     if (count($tags) == 1) {
         $tag = reset($tags);
     }
     $protocol = $this->deliveryAttributes->getMediaProtocol();
     if (in_array($this->deliveryAttributes->getFormat(), self::$httpFormats) && !in_array($protocol, self::$httpProtocols)) {
         $protocol = requestUtils::getProtocol();
     }
     $liveStreamConfig = $this->entry->getLiveStreamConfigurationByProtocol($this->deliveryAttributes->getFormat(), $protocol, $tag, false, $this->flavorParamsIds);
     /* @var $liveStreamConfig kLiveStreamConfiguration */
     if ($liveStreamConfig) {
         return array($liveStreamConfig->getUrl(), $liveStreamConfig->getBackupUrl());
     }
     switch ($this->deliveryAttributes->getFormat()) {
         case PlaybackProtocol::RTMP:
             $baseUrl = $this->entry->getStreamUrl();
             $baseUrl = rtrim($baseUrl, '/');
             if (strpos($this->deliveryAttributes->getMediaProtocol(), "rtmp") === 0) {
                 $baseUrl = $this->deliveryAttributes->getMediaProtocol() . '://' . preg_replace('/^rtmp.*?:\\/\\//', '', $baseUrl);
             }
             return array($baseUrl, null);
         case PlaybackProtocol::APPLE_HTTP:
             return array($this->entry->getHlsStreamUrl(), null);
             // TODO pass single tag
     }
     return array(null, null);
 }
Пример #2
0
 /**
  * @return array primary URL and backup URL
  */
 private function getLiveEntryStreamConfig()
 {
     $this->initFlavorParamsIds();
     $tag = null;
     $tags = $this->deliveryAttributes->getTags();
     if (count($tags) == 1) {
         $tag = reset($tags);
     }
     $protocol = $this->deliveryAttributes->getMediaProtocol();
     if (in_array($this->deliveryAttributes->getFormat(), self::$httpFormats) && !in_array($protocol, self::$httpProtocols)) {
         $protocol = requestUtils::getProtocol();
     }
     // use only cloud transcode flavors if timeAlignedRenditions was set
     $partnerId = $this->entry->getPartnerId();
     $partner = PartnerPeer::retrieveByPK($partnerId);
     $partnerTimeAligned = $partner->getTimeAlignedRenditions();
     if ($partnerTimeAligned && $this->getRequestParameter("playerType") === 'flash') {
         // check entry's flavors
         $entryFlavorParams = assetParamsPeer::retrieveByPKs(explode(',', $this->entry->getFlavorParamsIds()));
         $hasTranscode = false;
         foreach ($entryFlavorParams as $flavor) {
             // check if we have any transcode flavor
             if (!$flavor->hasTag("ingest")) {
                 $hasTranscode = true;
             }
         }
         // if so, use only the transcode
         if ($hasTranscode) {
             $tag = 'mbr';
         }
     }
     $liveStreamConfig = $this->entry->getLiveStreamConfigurationByProtocol($this->deliveryAttributes->getFormat(), $protocol, $tag, false, $this->flavorParamsIds);
     /* @var $liveStreamConfig kLiveStreamConfiguration */
     if ($liveStreamConfig) {
         return $liveStreamConfig;
     }
     switch ($this->deliveryAttributes->getFormat()) {
         case PlaybackProtocol::RTMP:
             $baseUrl = $this->entry->getStreamUrl();
             $baseUrl = rtrim($baseUrl, '/');
             if (strpos($this->deliveryAttributes->getMediaProtocol(), "rtmp") === 0) {
                 $baseUrl = $this->deliveryAttributes->getMediaProtocol() . '://' . preg_replace('/^rtmp.*?:\\/\\//', '', $baseUrl);
             }
             $liveStreamConfig = new kLiveStreamConfiguration();
             $liveStreamConfig->setUrl($baseUrl);
             $liveStreamConfig->setProtocol(PlaybackProtocol::RTMP);
             return $liveStreamConfig;
         case PlaybackProtocol::APPLE_HTTP:
             // TODO pass single tag
             $liveStreamConfig = new kLiveStreamConfiguration();
             $liveStreamConfig->setUrl($this->entry->getHlsStreamUrl());
             $liveStreamConfig->setProtocol(PlaybackProtocol::APPLE_HTTP);
             return $liveStreamConfig;
     }
     return null;
 }
 public function cloneAttributes(DeliveryProfileDynamicAttributes $newObj)
 {
     $this->deliveryProfileIds = $newObj->getDeliveryProfileIds();
     $this->isDeliveryProfilesBlockedList = $newObj->getIsDeliveryProfilesBlockedList();
     $this->format = $newObj->getFormat();
     $this->extension = $newObj->getFileExtension();
     $this->containerFormat = $newObj->getContainerFormat();
     $this->seekFromTime = $newObj->getSeekFromTime();
     $this->clipTo = $newObj->getClipTo();
     $this->playbackRate = $newObj->getPlaybackRate();
     $this->storageId = $newObj->getStorageId();
     $this->entryId = $newObj->getEntryId();
     $this->tags = $newObj->getTags();
     $this->flavorAssets = $newObj->getFlavorAssets();
     $this->remoteFileSyncs = $newObj->getRemoteFileSyncs();
     $this->manifestFileSync = $newObj->getManifestFileSync();
     $this->preferredBitrate = $newObj->getPreferredBitrate();
     $this->responseFormat = $newObj->getResponseFormat();
     $this->mediaProtocol = $newObj->getMediaProtocol();
     $this->usePlayServer = $newObj->getUsePlayServer();
     $this->playerConfig = $newObj->getPlayerConfig();
     $this->uiConfId = $newObj->getUiConfId();
     $this->edgeServerIds = $newObj->getEdgeServerIds();
 }