Пример #1
0
 private function serveVodEntry()
 {
     $this->initFlavorIds();
     if ($this->entry->getPartner()->getForceCdnHost()) {
         $this->cdnHost = myPartnerUtils::getCdnHost($this->entry->getPartnerId(), $this->protocol);
     }
     $this->initFlavorAssetArray();
     $this->initEntryDuration();
     if ($this->duration && $this->duration < 10 && $this->deliveryAttributes->getFormat() == PlaybackProtocol::AKAMAI_HDS) {
         // videos shorter than 10 seconds cannot be played with HDS, fall back to HTTP
         $this->deliveryAttributes->setFormat(PlaybackProtocol::HTTP);
         $flavorAssets = $this->deliveryAttributes->getFlavorAssets();
         $flavorAsset = reset($flavorAssets);
         $this->deliveryAttributes->setFlavorAssets(array($flavorAsset));
     }
     $this->initStorageProfile();
     // Fixing ALL kinds of historical bugs.
     if ($this->deliveryAttributes->getFormat() == self::URL) {
         if (is_null($this->deliveryAttributes->getResponseFormat())) {
             $this->deliveryAttributes->setResponseFormat('redirect');
         }
         $this->deliveryAttributes->setFormat(PlaybackProtocol::HTTP);
     } else {
         if ($this->deliveryAttributes->getFormat() == PlaybackProtocol::AKAMAI_HD) {
             // This is a hack to return an f4m that has a URL of a smil
             return $this->serveHDNetwork();
         } else {
             if ($this->deliveryAttributes->getFormat() == self::HDNETWORKSMIL) {
                 // Translate to playback protocol format
                 $this->deliveryAttributes->setFormat(PlaybackProtocol::AKAMAI_HD);
             } else {
                 if ($this->deliveryAttributes->getFormat() == PlaybackProtocol::RTMP) {
                     if (strpos($this->deliveryAttributes->getMediaProtocol(), "rtmp") !== 0) {
                         $this->deliveryAttributes->setMediaProtocol("rtmp");
                     }
                 } else {
                     if ($this->deliveryAttributes->getFormat() == PlaybackProtocol::HTTP) {
                         if (strpos($this->deliveryAttributes->getMediaProtocol(), "http") !== 0) {
                             $this->deliveryAttributes->setMediaProtocol("http");
                         }
                     }
                 }
             }
         }
     }
     // <--
     $this->deliveryProfile = $this->initDeliveryProfile();
     if (!$this->deliveryProfile) {
         return null;
     }
     $this->enforceAudioVideoEntry();
     $this->deliveryProfile->setDynamicAttributes($this->deliveryAttributes);
     return $this->deliveryProfile->serve();
 }
Пример #2
0
 protected function getRenderer($flavors)
 {
     $class = null;
     if ($this->params->getResponseFormat()) {
         $formatMapping = array('f4m' => 'kF4MManifestRenderer', 'f4mv2' => 'kF4Mv2ManifestRenderer', 'smil' => 'kSmilManifestRenderer', 'm3u8' => 'kM3U8ManifestRenderer', 'jsonp' => 'kJSONPManifestRenderer', 'redirect' => 'kRedirectManifestRenderer');
         if (isset($formatMapping[$this->params->getResponseFormat()])) {
             $class = $formatMapping[$this->params->getResponseFormat()];
         }
     }
     if (!$class) {
         $class = $this->getRendererClass();
     }
     $renderer = new $class($flavors, $this->params->getEntryId());
     return $renderer;
 }
 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();
 }