本文整理汇总了PHP中assetPeer::retrieveReadyFlavorsByEntryIdAndTag方法的典型用法代码示例。如果您正苦于以下问题:PHP assetPeer::retrieveReadyFlavorsByEntryIdAndTag方法的具体用法?PHP assetPeer::retrieveReadyFlavorsByEntryIdAndTag怎么用?PHP assetPeer::retrieveReadyFlavorsByEntryIdAndTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assetPeer
的用法示例。
在下文中一共展示了assetPeer::retrieveReadyFlavorsByEntryIdAndTag方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$widgetId = $this->getRequestParameter("wid");
$widget = widgetPeer::retrieveByPK($widgetId);
if (!$widget) {
KalturaLog::err("Widget id [{$widgetId}] not found");
die;
}
$entry = $widget->getentry();
$entryId = $widget->getEntryId();
if (!$entry) {
KalturaLog::err("Entry id [{$entryId}] not found");
die;
}
$uiConf = $widget->getuiConf();
$uiConfId = $widget->getUiConfId();
if (!$uiConf) {
KalturaLog::err("UI Conf id [{$uiConfId}] not found");
die;
}
$this->entry_name = $entry->getName();
$this->entry_description = $entry->getDescription();
$this->entry_thumbnail_url = $entry->getThumbnailUrl();
$this->entry_thumbnail_secure_url = $entry->getThumbnailUrl(null, 'https');
$this->entry_duration = $entry->getDuration();
$flavor_tag = $this->getRequestParameter('flavor_tag', 'iphone');
$flavor_assets = assetPeer::retrieveReadyFlavorsByEntryIdAndTag($entryId, $flavor_tag);
$flavor_asset = reset($flavor_assets);
$flavorId = null;
if ($flavor_asset) {
$flavorId = $flavor_asset->getId();
}
$embed_host = kConf::hasParam('cdn_api_host') ? kConf::get('cdn_api_host') : kConf::get('www_host');
$embed_host_https = kConf::hasParam('cdn_api_host_https') ? kConf::get('cdn_api_host_https') : kConf::get('www_host');
$https_enabled = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? true : false;
$protocol = $https_enabled ? 'https' : 'http';
$port = $_SERVER["SERVER_PORT"] != "80" ? ":" . $_SERVER["SERVER_PORT"] : '';
$partnerId = $widget->getPartnerId();
$this->widget = $widget;
$this->entry = $entry;
$this->uiConf = $uiConf;
// Build SWF Path
$swfPath = "/index.php/kwidget/wid/" . $widgetId . "/uiconf_id/" . $uiConfId . "/entry_id/" . $entryId;
// Set SWF URLs
$this->swfUrl = 'http://' . $embed_host . $swfPath;
$this->swfSecureUrl = 'https://' . $embed_host_https . $swfPath;
// set player url
$this->playerUrl = 'https://' . $embed_host_https . '/p/' . $this->partner_id . '/sp/' . $this->partner_id . '00/embedIframeJs/uiconf_id/' . $this->uiconf_id . '/partner_id/' . $this->partner_id . '?iframeembed=true&entry_id=' . $this->entry_id . '&flashvars[streamerType]=auto';
$host = $https_enabled ? $embed_host_https : $embed_host;
$this->html5Url = $protocol . "://" . $host . "/p/" . $partnerId . "/sp/" . $partnerId . "00/embedIframeJs/uiconf_id/" . $uiConfId . "/partner_id/" . $partnerId;
$this->pageURL = $protocol . '://' . $_SERVER["SERVER_NAME"] . $port . $_SERVER["REQUEST_URI"];
$this->flavorUrl = null;
if (isset($flavorId)) {
$this->flavorUrl = 'https://' . $embed_host_https . '/p/' . $partnerId . '/sp/' . $partnerId . '00/playManifest/entryId/' . $entryId . '/flavorId/' . $flavorId . '/format/url/protocol/' . $protocol . '/a.mp4';
}
}
示例2: execute
public function execute()
{
$this->uiconf_id = $this->getRequestParameter('uiconf_id');
if (!$this->uiconf_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'uiconf_id');
}
$this->uiConf = uiConfPeer::retrieveByPK($this->uiconf_id);
if (!$this->uiConf) {
KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND);
}
$this->partner_id = $this->getRequestParameter('partner_id', $this->uiConf->getPartnerId());
if (!$this->partner_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'partner_id');
}
// Single Player parameters
$this->entry_id = $this->getRequestParameter('entry_id');
if ($this->entry_id) {
$entry = entryPeer::retrieveByPK($this->entry_id);
if ($entry) {
$this->entry_name = $entry->getName();
$this->entry_description = $entry->getDescription();
$this->entry_thumbnail_url = $entry->getThumbnailUrl();
$flavor_tag = $this->getRequestParameter('flavor_tag', 'iphone');
$flavor_assets = assetPeer::retrieveReadyFlavorsByEntryIdAndTag($this->entry_id, $flavor_tag);
$flavor_asset = reset($flavor_assets);
/* @var $flavor_asset flavorAsset */
$this->flavor_asset_id = null;
if ($flavor_asset) {
$this->flavor_asset_id = $flavor_asset->getId();
}
} else {
$this->entry_id = null;
}
}
$this->delivery_type = $this->getRequestParameter('delivery');
// Playlist Parameters
$this->playlist_id = $this->getRequestParameter('playlist_id');
$this->playlist_name = $this->getRequestParameter('playlist_name');
$this->partner_host = myPartnerUtils::getHost($this->partner_id);
$this->partner_cdnHost = myPartnerUtils::getCdnHost($this->partner_id);
$this->secure_host = kConf::get('cdn_host_https');
}
示例3: execute
//.........这里部分代码省略.........
$seek_from_timestamp = -1;
// backward compatibility
if ($flavor === "0") {
// for edit version
$flavor = "edit";
}
if ($flavor === "1" || $flavor === 1) {
// for play version
$flavor = null;
}
// when flavor is null, we will get a default flavor
if ($flavor == "edit") {
$flavorAsset = assetPeer::retrieveBestEditByEntryId($entry->getId());
} elseif (!is_null($flavor)) {
$flavorAsset = assetPeer::retrieveById($flavor);
// when specific asset was request, we don't validate its tags
if ($flavorAsset && ($flavorAsset->getEntryId() != $entry->getId() || $flavorAsset->getStatus() != flavorAsset::FLAVOR_ASSET_STATUS_READY)) {
$flavorAsset = null;
}
// we will throw an error later
} elseif (is_null($flavor) && !is_null($flavor_param_id)) {
$flavorAsset = assetPeer::retrieveByEntryIdAndParams($entry->getId(), $flavor_param_id);
if ($flavorAsset && $flavorAsset->getStatus() != flavorAsset::FLAVOR_ASSET_STATUS_READY) {
$flavorAsset = null;
}
// we will throw an error later
} else {
if ($entry->getSource() == entry::ENTRY_MEDIA_SOURCE_WEBCAM) {
$flavorAsset = assetPeer::retrieveOriginalByEntryId($entry->getId());
} else {
$flavorAsset = assetPeer::retrieveBestPlayByEntryId($entry->getId());
}
if (!$flavorAsset) {
$flavorAssets = assetPeer::retrieveReadyFlavorsByEntryIdAndTag($entry->getId(), flavorParams::TAG_WEB);
if (count($flavorAssets) > 0) {
$flavorAsset = $flavorAssets[0];
}
}
}
if (is_null($flavorAsset)) {
KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND);
}
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::file_exists($syncKey, false)) {
$path = kFileSyncUtils::getReadyLocalFilePathForKey($syncKey);
} else {
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
if (is_null($fileSync)) {
KalturaLog::log("Error - no FileSync for flavor [" . $flavorAsset->getId() . "]");
KExternalErrors::dieError(KExternalErrors::FILE_NOT_FOUND);
}
if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_URL) {
$urlManager = DeliveryProfilePeer::getRemoteDeliveryByStorageId(DeliveryProfileDynamicAttributes::init($fileSync->getDc(), $flavorAsset->getEntryId()), null, $flavorAsset);
if (!$urlManager) {
KalturaLog::log("Error - failed to find an HTTP delivery for storage profile [" . $fileSync->getDc() . "]");
KExternalErrors::dieError(KExternalErrors::FILE_NOT_FOUND);
}
$url = rtrim($urlManager->getUrl(), '/') . '/' . ltrim($urlManager->getFileSyncUrl($fileSync), '/');
header('location: ' . $url);
die;
}
$remoteUrl = kDataCenterMgr::getRedirectExternalUrl($fileSync);
$this->redirect($remoteUrl);
}
$flv_wrapper = new myFlvHandler($path);
$isFlv = $flv_wrapper->isFlv();
示例4: execute
public function execute()
{
$this->uiconf_id = intval($this->getRequestParameter('uiconf_id'));
if (!$this->uiconf_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'uiconf_id');
}
$this->uiConf = uiConfPeer::retrieveByPK($this->uiconf_id);
if (!$this->uiConf) {
KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND);
}
$this->partner_id = intval($this->getRequestParameter('partner_id', $this->uiConf->getPartnerId()));
if (!$this->partner_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'partner_id');
}
// Single Player parameters
$this->entry_id = htmlspecialchars($this->getRequestParameter('entry_id'));
if ($this->entry_id) {
$entry = entryPeer::retrieveByPK($this->entry_id);
if ($entry) {
$this->entry_name = $entry->getName();
$this->entry_description = $entry->getDescription();
$this->entry_thumbnail_url = $entry->getThumbnailUrl();
$this->entry_thumbnail_secure_url = $entry->getThumbnailUrl(null, 'https');
$this->entry_duration = $entry->getDuration();
$flavor_tag = $this->getRequestParameter('flavor_tag', 'iphone');
$flavor_assets = assetPeer::retrieveReadyFlavorsByEntryIdAndTag($this->entry_id, $flavor_tag);
$flavor_asset = reset($flavor_assets);
/* @var $flavor_asset flavorAsset */
$this->flavor_asset_id = null;
if ($flavor_asset) {
$this->flavor_asset_id = $flavor_asset->getId();
}
} else {
$this->entry_id = null;
}
}
$playlist_name = null;
$playlist_description = null;
$embed_host = kConf::hasParam('cdn_api_host') ? kConf::get('cdn_api_host') : kConf::get('www_host');
$embed_host_https = kConf::hasParam('cdn_api_host_https') ? kConf::get('cdn_api_host_https') : kConf::get('www_host');
// Check if HTTPS enabled and set protocol
$https_enabled = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? true : false;
$protocol = $https_enabled ? 'https' : 'http';
$this->framed = isset($_GET['framed']) ? true : false;
$this->embedType = $this->getRequestParameter('embed') ? $this->getRequestParameter('embed') : 'legacy';
$cacheSt = time() + 60 * 15;
// Basic embed options
$embedParams = array('host' => $embed_host, 'securedHost' => $embed_host_https, 'partnerId' => $this->partner_id, 'protocol' => $protocol, 'embedType' => $this->embedType, 'uiConfId' => $this->uiconf_id, 'width' => $this->uiConf->getWidth(), 'height' => $this->uiConf->getHeight(), 'includeKalturaLinks' => true, 'cacheSt' => $cacheSt);
// Add entry Id and Metadata
if ($this->entry_id) {
$embedParams['entryId'] = $this->entry_id;
$embedParams['includeSeoMetadata'] = true;
$embedParams['entryMeta'] = array('name' => $this->entry_name, 'description' => $this->entry_description, 'thumbnailUrl' => $this->entry_thumbnail_url, 'duration' => $this->entry_duration);
}
// Add flashVars
if (isset($_GET['flashvars'])) {
$flashVars = array();
if (is_array($_GET['flashvars'])) {
foreach ($_GET['flashvars'] as $key => $val) {
if ($this->isJson($val)) {
$val = json_decode($val, true);
}
$flashVars[$key] = $val;
}
}
//Check for playlist name
if (isset($_GET['flashvars']['playlistAPI.kpl0Name'])) {
$playlist_name = htmlspecialchars($_GET['flashvars']['playlistAPI.kpl0Name']);
}
// Get playlist name from playlist id
if (isset($_GET['flashvars']['playlistAPI.kpl0Id'])) {
$playlistId = htmlspecialchars($_GET['flashvars']['playlistAPI.kpl0Id']);
$playlist = entryPeer::retrieveByPK($playlistId);
if ($playlist) {
$playlist_name = $playlist->getName();
$playlist_description = $playlist->getDescription();
}
}
} else {
$this->partner_host = myPartnerUtils::getHost($this->partner_id);
$this->playlist_id = htmlspecialchars($this->getRequestParameter('playlist_id'));
// Get delivery types from player.ini
$map = kConf::getMap('players');
$deliveryTypes = $map['delivery_types'];
$flashVars = array();
if (isset($deliveryTypes[$this->getRequestParameter('delivery')]) && isset($deliveryTypes[$this->getRequestParameter('delivery')]['flashvars'])) {
$flashVars = $deliveryTypes[$this->getRequestParameter('delivery')]['flashvars'];
}
if ($this->playlist_id && $this->playlist_id != 'multitab_playlist') {
// build playlist url
$playlist_url = $this->partner_host . "/index.php/partnerservices2/executeplaylist?";
$playlist_url .= "partner_id=" . $this->partner_id . "&subp_id=" . $this->partner_id . "00&format=8&ks={ks}&playlist_id=" . $this->playlist_id;
$playlist_name = htmlspecialchars($this->getRequestParameter('playlist_name'));
// Add playlist flashVars
$flashVars["playlistAPI.kpl0Name"] = $playlist_name;
$flashVars["playlistAPI.kpl0Url"] = urlencode($playlist_url);
}
}
// Don't include flashvars if empty array
if (count($flashVars)) {
//.........这里部分代码省略.........