本文整理汇总了PHP中assetPeer::retrieveBestPlayByEntryId方法的典型用法代码示例。如果您正苦于以下问题:PHP assetPeer::retrieveBestPlayByEntryId方法的具体用法?PHP assetPeer::retrieveBestPlayByEntryId怎么用?PHP assetPeer::retrieveBestPlayByEntryId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assetPeer
的用法示例。
在下文中一共展示了assetPeer::retrieveBestPlayByEntryId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fixMetadataImpl
/**
* here we'll manipulate the video asset and set the from_byte & to_byte from the milliseconds
*
*/
private static function fixMetadataImpl(&$xml_doc, &$total_duration, $timeline)
{
self::log(__METHOD__);
/*
$xml_doc = new DOMDocument();
$xml_doc->loadXML( $content );
*/
// $meatadata_elem_list = $xml_doc->getElementsByTagName( "MetaData" );
// if ( $meatadata_elem_list != null && $meatadata_elem_list->length > 0 )
$duration_list = $xml_doc->getElementsByTagName("SeqDuration");
if ($duration_list != null && $duration_list->length > 0) {
$total_duration = $duration_list->item(0)->nodeValue;
}
$xpath = new DOMXPath($xml_doc);
$assets = $xpath->query($timeline == "video" ? "//VideoAssets/vidAsset" : ($timeline == "audio" ? "//AudioAssets/AudAsset" : "//VoiceAssets/voiAsset"));
$lastTimestamp = 0;
$real_start_byte = 0;
// the start byte of the current clip in the final merged stream
$calculated_total_bytes = 0;
// use the entryPool and a 2-pass iteration to reduce the hits to the DB
$id_list = array();
$entry_pool = new entryPool();
// first pass - populate the entryPool in a single request to the DB
self::log(__METHOD__, "Before assets");
foreach ($assets as $asset) {
$type = $asset->getAttribute("type");
if ($type != "VIDEO" && $type != "AUDIO") {
continue;
}
// fetch the file name from the DB
$asset_id = $asset->getAttribute("k_id");
$id_list[] = $asset_id;
}
self::log(__METHOD__, "After assets", count($id_list), $id_list);
if ($id_list) {
$entry_pool->addEntries(entryPeer::retrieveByPKsNoFilter($id_list));
}
// second pass - the entryPool is supposed to already be populated
$was_modified = false;
foreach ($assets as $asset) {
// fix only VIDEO assets
$type = $asset->getAttribute("type");
if ($type != "VIDEO" && $type != "AUDIO") {
continue;
}
// fetch the file name from the DB
$asset_id = $asset->getAttribute("k_id");
self::log(__METHOD__, "in loop", $asset_id);
//$entry = entryPeer::retrieveByPKNoFilter( $asset_id );
$entry = $entry_pool->retrieveByPK($asset_id);
// is supposed to exist already in the pool
if ($entry == NULL) {
// set an error on the asset element
$asset->setAttribute("fix_status", "error in k_id [{$asset_id}]");
$was_modified = true;
continue;
} elseif ($entry->getStatus() == entryStatus::DELETED) {
// set an error on the asset element
$asset->setAttribute("fix_status", "error in k_id [{$asset_id}] - asset was deleted");
$was_modified = true;
continue;
}
$file_name = null;
//TODO: need to work on only an FLV asset
$flavor_asset_play = assetPeer::retrieveBestPlayByEntryId($entry->getId());
if (!$flavor_asset_play) {
KalturaLog::log(__METHOD__ . ' ' . __LINE__ . ' no play flavor asset for entry ' . $entry->getId());
} else {
$file_name = kFileSyncUtils::getReadyLocalFilePathForKey($flavor_asset_play->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET));
}
$use_multi_flavor = false;
$flv_file_name_edit = false;
$flavor_asset_edit = assetPeer::retrieveBestEditByEntryId($entry->getId());
if (!$flavor_asset_edit) {
KalturaLog::log(__METHOD__ . ' ' . __LINE__ . ' no edit flavor asset for entry ' . $entry->getId());
} else {
$flv_file_name_edit = kFileSyncUtils::getReadyLocalFilePathForKey($flavor_asset_edit->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET));
$use_multi_flavor = $flv_file_name_edit && file_exists($flv_file_name_edit) && $timeline == "video";
}
if (!$flv_file_name_edit && !$file_name) {
KalturaLog::log(__METHOD__ . ' ' . __LINE__ . ' no edit & play flavor assets for entry ' . $entry->getId());
continue;
}
$flv_file_name = kFile::fixPath($file_name);
$stream_info_list = $asset->getElementsByTagName("StreamInfo");
foreach ($stream_info_list as $stream_info) {
$file_name = "?";
try {
$stream_info->setAttribute("file_name", kFileSyncUtils::getReadyLocalFilePathForKey($flavor_asset_play->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET)));
// replaced__getDataPath
$start_byte = $stream_info->getAttribute("start_byte");
$end_byte = $stream_info->getAttribute("end_byte");
$total_bytes = $stream_info->getAttribute("total_bytes");
if ($start_byte == NULL) {
$start_byte = self::MISSING_VALUE;
}
//.........这里部分代码省略.........
示例2: getDownloadFileSyncAndLocal
/**
*
* @param $version
* @param $format
* @return FileSync
*/
public function getDownloadFileSyncAndLocal($version = NULL, $format = null, $sub_type = null)
{
$sync_key = null;
if ($this->getType() == entryType::MEDIA_CLIP) {
if ($this->getMediaType() == self::ENTRY_MEDIA_TYPE_VIDEO || $this->getMediaType() == self::ENTRY_MEDIA_TYPE_AUDIO) {
$flavor_assets = assetPeer::retrieveBestPlayByEntryId($this->getId());
// uset the format as the extension
if ($flavor_assets) {
$sync_key = $flavor_assets->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
}
} elseif ($this->getMediaType() == self::ENTRY_MEDIA_TYPE_IMAGE) {
$sync_key = $this->getSyncKey(self::FILE_SYNC_ENTRY_SUB_TYPE_DATA, $version);
}
} elseif ($this->getType() == entryType::MIX) {
// if roughcut - the version should be used
$sync_key = $this->getSyncKey(self::FILE_SYNC_ENTRY_SUB_TYPE_DOWNLOAD, $version);
} else {
// if not roughcut - the format should be used
$sync_key = $this->getSyncKey(self::FILE_SYNC_ENTRY_SUB_TYPE_DOWNLOAD, $format);
}
if (!$sync_key) {
return null;
}
return kFileSyncUtils::getReadyFileSyncForKey($sync_key, true, false);
}
示例3: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
$entryId = $this->getRequestParameter("entry_id");
$flavorId = $this->getRequestParameter("flavor");
$fileName = $this->getRequestParameter("file_name");
$fileName = basename($fileName);
$ksStr = $this->getRequestParameter("ks");
$referrer = $this->getRequestParameter("referrer");
$referrer = base64_decode($referrer);
if (!is_string($referrer)) {
// base64_decode can return binary data
$referrer = "";
}
$entry = null;
if ($ksStr) {
try {
kCurrentContext::initKsPartnerUser($ksStr);
} catch (Exception $ex) {
KExternalErrors::dieError(KExternalErrors::INVALID_KS);
}
} else {
$entry = kCurrentContext::initPartnerByEntryId($entryId);
if (!$entry) {
KExternalErrors::dieError(KExternalErrors::ENTRY_NOT_FOUND);
}
}
kEntitlementUtils::initEntitlementEnforcement();
if (!$entry) {
$entry = entryPeer::retrieveByPK($entryId);
if (!$entry) {
KExternalErrors::dieError(KExternalErrors::ENTRY_NOT_FOUND);
}
} else {
if (!kEntitlementUtils::isEntryEntitled($entry)) {
KExternalErrors::dieError(KExternalErrors::ENTRY_NOT_FOUND);
}
}
myPartnerUtils::blockInactivePartner($entry->getPartnerId());
$securyEntryHelper = new KSecureEntryHelper($entry, $ksStr, $referrer, accessControlContextType::DOWNLOAD);
$securyEntryHelper->validateForDownload($entry, $ksStr);
$flavorAsset = null;
if ($flavorId) {
// get flavor asset
$flavorAsset = assetPeer::retrieveById($flavorId);
if (is_null($flavorAsset) || $flavorAsset->getStatus() != flavorAsset::FLAVOR_ASSET_STATUS_READY) {
KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND);
}
// the request flavor should belong to the requested entry
if ($flavorAsset->getEntryId() != $entryId) {
KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND);
}
} else {
$flavorAsset = assetPeer::retrieveBestPlayByEntryId($entry->getId());
}
// Gonen 26-04-2010: in case entry has no flavor with 'mbr' tag - we return the source
if (!$flavorAsset && ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_VIDEO || $entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_AUDIO)) {
$flavorAsset = assetPeer::retrieveOriginalByEntryId($entryId);
}
if ($flavorAsset) {
$syncKey = $this->getSyncKeyAndForFlavorAsset($entry, $flavorAsset);
} else {
$syncKey = $this->getBestSyncKeyForEntry($entry);
}
if (is_null($syncKey)) {
KExternalErrors::dieError(KExternalErrors::FILE_NOT_FOUND);
}
$this->handleFileSyncRedirection($syncKey);
$filePath = kFileSyncUtils::getReadyLocalFilePathForKey($syncKey);
$wamsAssetId = kFileSyncUtils::getWamsAssetIdForKey($syncKey);
$wamsURL = kFileSyncUtils::getWamsURLForKey($syncKey);
list($fileBaseName, $fileExt) = $this->getFileName($entry, $flavorAsset);
if (!$fileName) {
$fileName = $fileBaseName;
}
if ($fileExt && !is_dir($filePath)) {
$fileName = $fileName . '.' . $fileExt;
}
//enable downloading file_name which inside the flavor asset directory
if (is_dir($filePath)) {
$filePath = $filePath . DIRECTORY_SEPARATOR . $fileName;
}
$this->dumpFile($filePath, $fileName, $wamsAssetId, $wamsURL);
die;
// no view
}
示例4: 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;
//.........这里部分代码省略.........
示例5: execute
//.........这里部分代码省略.........
}
$this->dump_from_byte = 0;
// reset accurate seek from timestamp
$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);
示例6: array
/**
return array('status' => $status, 'message' => $message, 'objects' => $objects);
objects - array of
'thumb'
'title'
'description'
'id' - unique id to be passed to getMediaInfo
*/
public function searchMedia($media_type, $searchText, $page, $pageSize, $authData = null, $extraData = null)
{
$page_size = $pageSize > 20 ? 20 : $pageSize;
$page--;
if ($page < 0) {
$page = 0;
}
$status = "ok";
$message = '';
$objects = array();
$should_serach = true;
if (kCurrentContext::isApiV3Context()) {
$kuser = kuserPeer::getKuserByPartnerAndUid(self::$partner_id, self::$puser_id);
$should_serach = true;
$kuser_id = $kuser->getId();
} else {
$puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid(self::$partner_id, self::$subp_id, self::$puser_id, true);
if (!$puser_kuser) {
// very bad - does not exist in system
$should_serach = false;
} else {
$kuser = $puser_kuser->getKuser();
if (!$kuser) {
$should_serach = false;
} else {
$kuser_id = $kuser->getId();
}
}
}
// echo "[" . self::$partner_id . "],[". self::$subp_id . "],[" . self::$puser_id . "],[$kuser_id]";
if ($should_serach) {
$c = KalturaCriteria::create(entryPeer::OM_CLASS);
$c->add(entryPeer::KUSER_ID, $kuser_id);
$c->add(entryPeer::MEDIA_TYPE, $media_type);
$c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
// $keywords_array = mySearchUtils::getKeywordsFromStr ( $searchText );
$filter = new entryFilter();
$filter->setPartnerSearchScope(self::$partner_id);
$filter->addSearchMatchToCriteria($c, $searchText, entry::getSearchableColumnName());
$c->setLimit($pageSize);
$c->setOffset($page * $pageSize);
$entry_results = entryPeer::doSelect($c);
//JoinAll( $c );
$number_of_results = $c->getRecordsCount();
$number_of_pages = (int) ($number_of_results / $pageSize);
if ($number_of_results % $pageSize != 0) {
$number_of_pages += 1;
}
// if there are some left-overs - there must be a nother page
// add thumbs when not image or video
$should_add_thumbs = $media_type != entry::ENTRY_MEDIA_TYPE_AUDIO;
foreach ($entry_results as $entry) {
/* @var $entry entry */
// send the id as the url
$object = array("id" => $entry->getId(), "url" => $entry->getDataUrl(), "tags" => $entry->getTags(), "title" => $entry->getName(), "description" => $entry->getDescription(), "flash_playback_type" => $entry->getMediaTypeName());
if ($should_add_thumbs) {
$object["thumb"] = $entry->getThumbnailUrl();
}
//Find the flavor sent over the dataUrl in order to send its extension
$playedAsset = assetPeer::retrieveBestPlayByEntryId($entry->getId());
if ($playedAsset) {
$object["file_ext"] = $playedAsset->getFileExt();
}
$objects[] = $object;
}
}
return array('status' => $status, 'message' => $message, 'objects' => $objects, "needMediaInfo" => self::$NEED_MEDIA_INFO);
}
示例7: execute
//.........这里部分代码省略.........
//$archive_file = $entry->getArchiveFile();
$media_type = $entry->getMediaType();
if ($media_type == entry::ENTRY_MEDIA_TYPE_IMAGE) {
// image - use data for entry
$file_sync = $this->redirectIfRemote($entry, entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA, null);
$key = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
kFile::dumpFile(kFileSyncUtils::getLocalFilePathForKey($key, true));
} elseif ($media_type == entry::ENTRY_MEDIA_TYPE_VIDEO || $media_type == entry::ENTRY_MEDIA_TYPE_AUDIO) {
$format = $this->getRequestParameter("format");
if ($type == "download" && $format) {
// this is a video for a specifc extension - use the proper flavorAsset
$flavor_asset = assetPeer::retrieveByEntryIdAndExtension($entry_id, $format);
if ($flavor_asset && $flavor_asset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_READY) {
$file_sync = $this->redirectIfRemote($flavor_asset, flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET, null, true);
} else {
header('KalturaRaw: no flavor asset for extension');
die;
}
$archive_file = $file_sync->getFullPath();
} else {
// flavorAsset of the original
$flavor_asset = assetPeer::retrieveOriginalByEntryId($entry_id);
if ($flavor_asset && $flavor_asset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_READY) {
$file_sync = $this->redirectIfRemote($flavor_asset, flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET, null, false);
// NOT strict - if there is no archive, get the data version
if ($file_sync) {
$wams_asset_id = $file_sync->getWamsAssetId();
$archive_file = $file_sync->getFullPath();
}
}
if (!$flavor_asset || !$file_sync || $flavor_asset->getStatus() != flavorAsset::FLAVOR_ASSET_STATUS_READY) {
// either no archive asset or no fileSync for archive asset
// use fallback flavorAsset
$flavor_asset = assetPeer::retrieveBestPlayByEntryId($entry_id);
if (!$flavor_asset) {
header('KalturaRaw: no original flavor asset for entry, no best play asset for entry');
die;
}
$file_sync = $this->redirectIfRemote($flavor_asset, flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET, null, false);
// NOT strict - if there is no archive, get the data version
$archive_file = $file_sync->getFullPath();
}
}
} elseif ($media_type == entry::ENTRY_MEDIA_TYPE_SHOW) {
// in this case "raw" is a bad name
// TODO - add the ability to fetch the actual XML by flagging "xml" or something
$version = $this->getRequestParameter("version");
// hotfix - links sent after flattening is done look like:
// http://cdn.kaltura.com/p/387/sp/38700/raw/entry_id/0_ix99151g/version/100001
// while waiting for flavor-adaptation in flattening, we want to find at least one file to return.
$try_formats = array('mp4', 'mov', 'avi', 'flv');
if ($format) {
$key = array_search($format, $try_formats);
if ($key !== FALSE) {
unset($try_formats[$key]);
}
$file_sync = $this->redirectIfRemote($entry, entry::FILE_SYNC_ENTRY_SUB_TYPE_DOWNLOAD, $format, false);
}
if (!isset($file_sync) || !$file_sync || !file_exists($file_sync->getFullPath())) {
foreach ($try_formats as $ext) {
KalturaLog::log("raw for mix - trying to find filesync for extension: [{$ext}] on entry [{$entry->getId()}]");
$file_sync = $this->redirectIfRemote($entry, entry::FILE_SYNC_ENTRY_SUB_TYPE_DOWNLOAD, $ext, false);
if ($file_sync && file_exists($file_sync->getFullPath())) {
KalturaLog::log("raw for mix - found flattened video of extension: [{$ext}] continuing with this file {$file_sync->getFullPath()}");
break;
}