本文整理汇总了PHP中assetPeer::retrieveReadyByEntryIdAndTag方法的典型用法代码示例。如果您正苦于以下问题:PHP assetPeer::retrieveReadyByEntryIdAndTag方法的具体用法?PHP assetPeer::retrieveReadyByEntryIdAndTag怎么用?PHP assetPeer::retrieveReadyByEntryIdAndTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assetPeer
的用法示例。
在下文中一共展示了assetPeer::retrieveReadyByEntryIdAndTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContextData
/**
* This action delivers entry-related data, based on the user's context: access control, restriction, playback format and storage information.
* @action getContextData
* @param string $entryId
* @param KalturaEntryContextDataParams $contextDataParams
* @return KalturaEntryContextDataResult
*/
public function getContextData($entryId, KalturaEntryContextDataParams $contextDataParams)
{
$dbEntry = entryPeer::retrieveByPK($entryId);
if (!$dbEntry) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
$ks = $this->getKs();
$isAdmin = false;
if ($ks) {
$isAdmin = $ks->isAdmin();
}
$accessControl = $dbEntry->getAccessControl();
/* @var $accessControl accessControl */
$result = new KalturaEntryContextDataResult();
$result->isAdmin = $isAdmin;
$result->isScheduledNow = $dbEntry->isScheduledNow($contextDataParams->time);
if ($dbEntry->getStartDate() && abs($dbEntry->getStartDate(null) - time()) <= 86400 || $dbEntry->getEndDate() && abs($dbEntry->getEndDate(null) - time()) <= 86400) {
KalturaResponseCacher::setConditionalCacheExpiry(600);
}
if ($accessControl && $accessControl->hasRules()) {
$disableCache = true;
if (kConf::hasMap("optimized_playback")) {
$partnerId = $accessControl->getPartnerId();
$optimizedPlayback = kConf::getMap("optimized_playback");
if (array_key_exists($partnerId, $optimizedPlayback)) {
$params = $optimizedPlayback[$partnerId];
if (array_key_exists('cache_kdp_acccess_control', $params) && $params['cache_kdp_acccess_control']) {
$disableCache = false;
}
}
}
$accessControlScope = $accessControl->getScope();
$contextDataParams->toObject($accessControlScope);
$accessControlScope->setEntryId($entryId);
$result->isAdmin = $accessControlScope->getKs() && $accessControlScope->getKs()->isAdmin();
$dbResult = new kEntryContextDataResult();
if ($accessControl->applyContext($dbResult) && $disableCache) {
KalturaResponseCacher::disableCache();
}
$result->fromObject($dbResult);
}
$partner = PartnerPeer::retrieveByPK($dbEntry->getPartnerId());
if (PermissionPeer::isValidForPartner(PermissionName::FEATURE_REMOTE_STORAGE_DELIVERY_PRIORITY, $dbEntry->getPartnerId()) && $partner->getStorageServePriority() != StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY) {
if (is_null($contextDataParams->flavorAssetId)) {
if ($contextDataParams->flavorTags) {
$assets = assetPeer::retrieveReadyByEntryIdAndTag($entryId, $contextDataParams->flavorTags);
$asset = reset($assets);
} else {
$asset = assetPeer::retrieveBestPlayByEntryId($entryId);
}
if (!$asset) {
throw new KalturaAPIException(KalturaErrors::NO_FLAVORS_FOUND, $entryId);
}
} else {
$asset = assetPeer::retrieveByPK($contextDataParams->flavorAssetId);
if (!$asset) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $contextDataParams->flavorAssetId);
}
}
if (!$asset) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $entryId);
}
$assetSyncKey = $asset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
$fileSyncs = kFileSyncUtils::getAllReadyExternalFileSyncsForKey($assetSyncKey);
$storageProfilesXML = new SimpleXMLElement("<StorageProfiles/>");
foreach ($fileSyncs as $fileSync) {
$storageProfileId = $fileSync->getDc();
$storageProfile = StorageProfilePeer::retrieveByPK($storageProfileId);
if (!$storageProfile->getDeliveryRmpBaseUrl() && (!$contextDataParams->streamerType || $contextDataParams->streamerType == StorageProfile::PLAY_FORMAT_AUTO)) {
$contextDataParams->streamerType = StorageProfile::PLAY_FORMAT_HTTP;
$contextDataParams->mediaProtocol = StorageProfile::PLAY_FORMAT_HTTP;
}
$storageProfileXML = $storageProfilesXML->addChild("StorageProfile");
$storageProfileXML->addAttribute("storageProfileId", $storageProfileId);
$storageProfileXML->addChild("Name", $storageProfile->getName());
$storageProfileXML->addChild("SystemName", $storageProfile->getSystemName());
}
$result->storageProfilesXML = $storageProfilesXML->saveXML();
}
if ($contextDataParams->streamerType && $contextDataParams->streamerType != StorageProfile::PLAY_FORMAT_AUTO) {
$result->streamerType = $contextDataParams->streamerType;
$result->mediaProtocol = $contextDataParams->mediaProtocol ? $contextDataParams->mediaProtocol : $contextDataParams->streamerType;
} else {
$result->streamerType = $this->getPartner()->getStreamerType();
if (!$result->streamerType) {
$result->streamerType = StorageProfile::PLAY_FORMAT_HTTP;
}
$result->mediaProtocol = $this->getPartner()->getMediaProtocol();
if (!$result->mediaProtocol) {
$result->mediaProtocol = StorageProfile::PLAY_FORMAT_HTTP;
}
}
return $result;
//.........这里部分代码省略.........