本文整理汇总了PHP中entryFilter::setIsLive方法的典型用法代码示例。如果您正苦于以下问题:PHP entryFilter::setIsLive方法的具体用法?PHP entryFilter::setIsLive怎么用?PHP entryFilter::setIsLive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entryFilter
的用法示例。
在下文中一共展示了entryFilter::setIsLive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllLiveEntriesLiveNow
/**
* Returns all live entry ids that are live now by partner id
*/
protected function getAllLiveEntriesLiveNow()
{
// Partner ID condition is embeded in the default criteria.
$baseCriteria = KalturaCriteria::create(entryPeer::OM_CLASS);
$filter = new entryFilter();
$filter->setTypeEquel(KalturaEntryType::LIVE_STREAM);
$filter->setIsLive(true);
$filter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE);
$filter->attachToCriteria($baseCriteria);
$entries = entryPeer::doSelect($baseCriteria);
$entryIds = array();
foreach ($entries as $entry) {
$entryIds[] = $entry->getId();
}
return implode(",", $entryIds);
}
示例2: authenticateAction
/**
* Authenticate live-stream entry against stream token and partner limitations
*
* @action authenticate
* @param string $entryId Live stream entry id
* @param string $token Live stream broadcasting token
* @return KalturaLiveStreamEntry The authenticated live stream entry
*
* @throws KalturaErrors::ENTRY_ID_NOT_FOUND
* @throws KalturaErrors::LIVE_STREAM_INVALID_TOKEN
*/
function authenticateAction($entryId, $token)
{
$dbEntry = entryPeer::retrieveByPK($entryId);
if (!$dbEntry || $dbEntry->getType() != entryType::LIVE_STREAM) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
/* @var $dbEntry LiveStreamEntry */
if ($dbEntry->getStreamPassword() != $token) {
throw new KalturaAPIException(KalturaErrors::LIVE_STREAM_INVALID_TOKEN, $entryId);
}
$mediaServer = $dbEntry->getMediaServer(true);
if ($mediaServer) {
$url = null;
$protocol = null;
foreach (array(KalturaPlaybackProtocol::HLS, KalturaPlaybackProtocol::APPLE_HTTP) as $hlsProtocol) {
$config = $dbEntry->getLiveStreamConfigurationByProtocol($hlsProtocol, requestUtils::PROTOCOL_HTTP, null, true);
if ($config) {
$url = $config->getUrl();
$protocol = $hlsProtocol;
break;
}
}
if ($url) {
KalturaLog::info('Determining status of live stream URL [' . $url . ']');
$dpda = new DeliveryProfileDynamicAttributes();
$dpda->setEntryId($entryId);
$dpda->setFormat($protocol);
$deliveryProfile = DeliveryProfilePeer::getLiveDeliveryProfileByHostName(parse_url($url, PHP_URL_HOST), $dpda);
if ($deliveryProfile && $deliveryProfile->isLive($url)) {
throw new KalturaAPIException(KalturaErrors::LIVE_STREAM_ALREADY_BROADCASTING, $entryId, $mediaServer->getHostname());
}
}
}
// fetch current stream live params
$liveParamsIds = flavorParamsConversionProfilePeer::getFlavorIdsByProfileId($dbEntry->getConversionProfileId());
$usedLiveParamsIds = array();
foreach ($liveParamsIds as $liveParamsId) {
$usedLiveParamsIds[$liveParamsId] = array($entryId);
}
// fetch all live entries that currently are live
$baseCriteria = KalturaCriteria::create(entryPeer::OM_CLASS);
$filter = new entryFilter();
$filter->setIsLive(true);
$filter->setIdNotIn(array($entryId));
$filter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE);
$filter->attachToCriteria($baseCriteria);
$entries = entryPeer::doSelect($baseCriteria);
$maxInputStreams = $this->getPartner()->getMaxLiveStreamInputs();
if (!$maxInputStreams) {
$maxInputStreams = kConf::get('partner_max_live_stream_inputs', 'local', 10);
}
KalturaLog::debug("Max live stream inputs [{$maxInputStreams}]");
$maxTranscodedStreams = 0;
if (PermissionPeer::isValidForPartner(PermissionName::FEATURE_KALTURA_LIVE_STREAM_TRANSCODE, $this->getPartnerId())) {
$maxTranscodedStreams = $this->getPartner()->getMaxLiveStreamOutputs();
if (!$maxTranscodedStreams) {
$maxTranscodedStreams = kConf::get('partner_max_live_stream_outputs', 'local', 10);
}
}
KalturaLog::debug("Max live stream outputs [{$maxTranscodedStreams}]");
$totalInputStreams = count($entries) + 1;
if ($totalInputStreams > $maxInputStreams + $maxTranscodedStreams) {
KalturaLog::debug("Live input stream [{$totalInputStreams}]");
throw new KalturaAPIException(KalturaErrors::LIVE_STREAM_EXCEEDED_MAX_PASSTHRU, $entryId);
}
$entryIds = array($entryId);
foreach ($entries as $liveEntry) {
/* @var $liveEntry LiveEntry */
$entryIds[] = $liveEntry->getId();
$liveParamsIds = array_map('intval', explode(',', $liveEntry->getFlavorParamsIds()));
foreach ($liveParamsIds as $liveParamsId) {
if (isset($usedLiveParamsIds[$liveParamsId])) {
$usedLiveParamsIds[$liveParamsId][] = $liveEntry->getId();
} else {
$usedLiveParamsIds[$liveParamsId] = array($liveEntry->getId());
}
}
}
$liveParams = assetParamsPeer::retrieveByPKs(array_keys($usedLiveParamsIds));
$passthruEntries = null;
$transcodedEntries = null;
foreach ($liveParams as $liveParamsItem) {
/* @var $liveParamsItem LiveParams */
if ($liveParamsItem->hasTag(liveParams::TAG_INGEST)) {
$passthruEntries = array_intersect(is_array($passthruEntries) ? $passthruEntries : $entryIds, $usedLiveParamsIds[$liveParamsItem->getId()]);
} else {
$transcodedEntries = array_intersect(is_array($transcodedEntries) ? $transcodedEntries : $entryIds, $usedLiveParamsIds[$liveParamsItem->getId()]);
}
}
//.........这里部分代码省略.........