本文整理汇总了PHP中requestUtils::getApiCdnHost方法的典型用法代码示例。如果您正苦于以下问题:PHP requestUtils::getApiCdnHost方法的具体用法?PHP requestUtils::getApiCdnHost怎么用?PHP requestUtils::getApiCdnHost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类requestUtils
的用法示例。
在下文中一共展示了requestUtils::getApiCdnHost方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDataUrl
public function getDataUrl($version = NULL)
{
if ($this->getType() == entryType::PLAYLIST) {
return myPlaylistUtils::getExecutionUrl($this);
}
$current_version = $this->getVersion();
$entryId = $this->getId();
$media_type = $this->getMediaType();
if ($media_type == self::ENTRY_MEDIA_TYPE_VIDEO || $media_type == self::ENTRY_MEDIA_TYPE_AUDIO) {
$protocolStr = infraRequestUtils::getProtocol();
$url = requestUtils::getApiCdnHost();
$url .= myPartnerUtils::getUrlForPartner($this->getPartnerId(), $this->getSubpId());
$url .= "/playManifest/entryId/{$entryId}/format/url/protocol/{$protocolStr}";
} else {
if ($media_type == self::ENTRY_MEDIA_TYPE_IMAGE) {
$width = self::DEFAULT_IMAGE_WIDTH;
$height = self::DEFAULT_IMAGE_HEIGHT;
$url = myPartnerUtils::getCdnHost($this->getPartnerId());
$url .= myPartnerUtils::getUrlForPartner($this->getPartnerId(), $this->getSubpId());
if (!$version) {
$version = $current_version;
}
$url .= "/thumbnail/entry_id/{$entryId}/def_height/{$height}/def_width/{$width}/version/{$version}/type/1";
} else {
return null;
}
}
return $url;
}
示例2: getFlavorAssetUrl
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;
}
示例3: getExternalStorageUrl
private static function getExternalStorageUrl(Partner $partner, asset $asset, FileSyncKey $key, $servePlayManifest = false, $playManifestClientTag = null, $storageId = null)
{
if (!$partner->getStorageServePriority() || $partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY) {
return null;
}
if (is_null($storageId) && $partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_FIRST) {
if (kFileSyncUtils::getReadyInternalFileSyncForKey($key)) {
// check if having file sync on kaltura dcs
return null;
}
}
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($key, $storageId);
if (!$fileSync) {
return null;
}
$storage = StorageProfilePeer::retrieveByPK($fileSync->getDc());
if (!$storage) {
return null;
}
if ($servePlayManifest) {
// in case of an https request, if a delivery profile which supports https doesn't exist use an http cdn api host
if (infraRequestUtils::getProtocol() == infraRequestUtils::PROTOCOL_HTTPS && DeliveryProfilePeer::getRemoteDeliveryByStorageId(DeliveryProfileDynamicAttributes::init($fileSync->getDc(), $asset->getEntryId(), PlaybackProtocol::HTTP, "https"))) {
$url = requestUtils::getApiCdnHost();
} else {
$url = infraRequestUtils::PROTOCOL_HTTP . "://" . kConf::get("cdn_api_host");
}
$url .= $asset->getPlayManifestUrl($playManifestClientTag, $storageId);
} else {
$urlManager = DeliveryProfilePeer::getRemoteDeliveryByStorageId(DeliveryProfileDynamicAttributes::init($fileSync->getDc(), $asset->getEntryId()));
if ($urlManager) {
$dynamicAttrs = new DeliveryProfileDynamicAttributes();
$dynamicAttrs->setFileExtension($asset->getFileExt());
$dynamicAttrs->setStorageId($fileSync->getDc());
$urlManager->setDynamicAttributes($dynamicAttrs);
$url = ltrim($urlManager->getFileSyncUrl($fileSync), '/');
if (strpos($url, "://") === false) {
$url = rtrim($urlManager->getUrl(), "/") . "/" . $url;
}
} else {
KalturaLog::debug("Couldn't determine delivery profile for storage id");
$url = null;
}
}
return $url;
}
示例4: getFlavorAssetUrl
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;
}