private function getFlavorAssetUrl($kalturaEntry) { $partner = PartnerPeer::retrieveByPK($this->syndicationFeed->partnerId); if (!$partner) { return null; } $flavorAsset = assetPeer::retrieveByEntryIdAndParams($kalturaEntry->id, $this->syndicationFeed->flavorParamId); if (!$flavorAsset) { return null; } $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET); $externalStorageUrl = $this->getExternalStorageUrl($partner, $flavorAsset, $syncKey); if ($externalStorageUrl) { return $externalStorageUrl; } if ($partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY) { return null; } if ($this->syndicationFeedDb->getServePlayManifest()) { $cdnHost = requestUtils::getApiCdnHost(); $clientTag = 'feed:' . $this->syndicationFeedDb->getId(); $url = $cdnHost . $flavorAsset->getPlayManifestUrl($clientTag); } else { $urlManager = DeliveryProfilePeer::getDeliveryProfile($flavorAsset->getEntryId()); $urlManager->initDeliveryDynamicAttributes(null, $flavorAsset); $url = "http://" . $urlManager->getFullAssetUrl($flavorAsset); } return $url; }
private function getFlavorAssetUrl($kalturaEntry) { $partner = PartnerPeer::retrieveByPK($this->syndicationFeed->partnerId); if (!$partner) { return null; } $flavorAsset = assetPeer::retrieveByEntryIdAndParams($kalturaEntry->id, $this->syndicationFeed->flavorParamId); if (!$flavorAsset) { return null; } $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET); $externalStorageUrl = $this->getExternalStorageUrl($partner, $flavorAsset, $syncKey); if ($externalStorageUrl) { return $externalStorageUrl; } if ($partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY) { return null; } if ($this->syndicationFeedDb->getServePlayManifest()) { $shouldAddKtToken = false; if ($this->syndicationFeed->type == KalturaSyndicationFeedType::ITUNES) { $entry = $flavorAsset->getentry(); $accessControl = $entry->getaccessControl(); if ($accessControl && $accessControl->hasRules()) { $shouldAddKtToken = true; } } $cdnHost = requestUtils::getApiCdnHost(); $clientTag = 'feed:' . $this->syndicationFeedDb->getId(); $url = $cdnHost . $flavorAsset->getPlayManifestUrl($clientTag, null, PlaybackProtocol::HTTP, $shouldAddKtToken); } else { $urlManager = DeliveryProfilePeer::getDeliveryProfile($flavorAsset->getEntryId()); $urlManager->initDeliveryDynamicAttributes(null, $flavorAsset); $protocol = requestUtils::getProtocol(); if (!$urlManager->isProtocolSupported($protocol)) { $protocol = $protocol == 'http' ? 'https' : 'http'; if (!$urlManager->isProtocolSupported($protocol)) { $protocol = 'http'; } } $url = $protocol . '://' . $urlManager->getFullAssetUrl($flavorAsset); } return $url; }
/** * @param $entry * @param $syndicationFeed * @return string */ private function getMrssEntryXml(entry $entry, syndicationFeed $syndicationFeed = null, $link = null) { if ($syndicationFeed->getMrssParameters()) { $mrssParams = clone $syndicationFeed->getMrssParameters(); } else { $mrssParams = new kMrssParameters(); } $mrssParams->setLink($link); $mrssParams->setFilterByFlavorParams($syndicationFeed->getFlavorParamId()); $mrssParams->setIncludePlayerTag(true); $mrssParams->setPlayerUiconfId($syndicationFeed->getPlayerUiconfId()); $mrssParams->setStorageId($syndicationFeed->getStorageId()); $mrssParams->setServePlayManifest($syndicationFeed->getServePlayManifest()); $mrssParams->setPlayManifestClientTag('feed:' . $syndicationFeed->getId()); $mrss = kMrssManager::getEntryMrssXml($entry, null, $mrssParams); if (!$mrss) { KalturaLog::err("No MRSS returned for entry [" . $entry->getId() . "]"); return null; } return $mrss->asXML(); }
/** * @param $entry * @param $syndicationFeed * @return string */ private function getMrssEntryXml(entry $entry, syndicationFeed $syndicationFeed = null, $link = null) { if ($syndicationFeed->getMrssParameters()) { $mrssParams = clone $syndicationFeed->getMrssParameters(); } else { $mrssParams = new kMrssParameters(); } $mrssParams->setLink($link); $mrssParams->setFilterByFlavorParams($syndicationFeed->getFlavorParamId()); $mrssParams->setIncludePlayerTag(true); $mrssParams->setPlayerUiconfId($syndicationFeed->getPlayerUiconfId()); $mrssParams->setStorageId($syndicationFeed->getStorageId()); $mrssParams->setServePlayManifest($syndicationFeed->getServePlayManifest()); $mrssParams->setPlayManifestClientTag('feed:' . $syndicationFeed->getId()); $features = null; if ($syndicationFeed->getUseCategoryEntries()) { KalturaLog::info("Getting entry's associated categories from the category_entry table"); $features = array(ObjectFeatureType::CATEGORY_ENTRIES); } $mrss = kMrssManager::getEntryMrssXml($entry, null, $mrssParams, $features); if (!$mrss) { KalturaLog::err("No MRSS returned for entry [" . $entry->getId() . "]"); return null; } return $mrss->asXML(); }