本文整理汇总了PHP中entry::getLiveStreamConfigurationByProtocol方法的典型用法代码示例。如果您正苦于以下问题:PHP entry::getLiveStreamConfigurationByProtocol方法的具体用法?PHP entry::getLiveStreamConfigurationByProtocol怎么用?PHP entry::getLiveStreamConfigurationByProtocol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entry
的用法示例。
在下文中一共展示了entry::getLiveStreamConfigurationByProtocol方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLiveEntryBaseUrls
/**
* @return array primary URL and backup URL
*/
private function getLiveEntryBaseUrls()
{
$this->initFlavorParamsIds();
$tag = null;
$tags = $this->deliveryAttributes->getTags();
if (count($tags) == 1) {
$tag = reset($tags);
}
$protocol = $this->deliveryAttributes->getMediaProtocol();
if (in_array($this->deliveryAttributes->getFormat(), self::$httpFormats) && !in_array($protocol, self::$httpProtocols)) {
$protocol = requestUtils::getProtocol();
}
$liveStreamConfig = $this->entry->getLiveStreamConfigurationByProtocol($this->deliveryAttributes->getFormat(), $protocol, $tag, false, $this->flavorParamsIds);
/* @var $liveStreamConfig kLiveStreamConfiguration */
if ($liveStreamConfig) {
return array($liveStreamConfig->getUrl(), $liveStreamConfig->getBackupUrl());
}
switch ($this->deliveryAttributes->getFormat()) {
case PlaybackProtocol::RTMP:
$baseUrl = $this->entry->getStreamUrl();
$baseUrl = rtrim($baseUrl, '/');
if (strpos($this->deliveryAttributes->getMediaProtocol(), "rtmp") === 0) {
$baseUrl = $this->deliveryAttributes->getMediaProtocol() . '://' . preg_replace('/^rtmp.*?:\\/\\//', '', $baseUrl);
}
return array($baseUrl, null);
case PlaybackProtocol::APPLE_HTTP:
return array($this->entry->getHlsStreamUrl(), null);
// TODO pass single tag
}
return array(null, null);
}
示例2: getLiveEntryStreamConfig
/**
* @return array primary URL and backup URL
*/
private function getLiveEntryStreamConfig()
{
$this->initFlavorParamsIds();
$tag = null;
$tags = $this->deliveryAttributes->getTags();
if (count($tags) == 1) {
$tag = reset($tags);
}
$protocol = $this->deliveryAttributes->getMediaProtocol();
if (in_array($this->deliveryAttributes->getFormat(), self::$httpFormats) && !in_array($protocol, self::$httpProtocols)) {
$protocol = requestUtils::getProtocol();
}
// use only cloud transcode flavors if timeAlignedRenditions was set
$partnerId = $this->entry->getPartnerId();
$partner = PartnerPeer::retrieveByPK($partnerId);
$partnerTimeAligned = $partner->getTimeAlignedRenditions();
if ($partnerTimeAligned && $this->getRequestParameter("playerType") === 'flash') {
// check entry's flavors
$entryFlavorParams = assetParamsPeer::retrieveByPKs(explode(',', $this->entry->getFlavorParamsIds()));
$hasTranscode = false;
foreach ($entryFlavorParams as $flavor) {
// check if we have any transcode flavor
if (!$flavor->hasTag("ingest")) {
$hasTranscode = true;
}
}
// if so, use only the transcode
if ($hasTranscode) {
$tag = 'mbr';
}
}
$liveStreamConfig = $this->entry->getLiveStreamConfigurationByProtocol($this->deliveryAttributes->getFormat(), $protocol, $tag, false, $this->flavorParamsIds);
/* @var $liveStreamConfig kLiveStreamConfiguration */
if ($liveStreamConfig) {
return $liveStreamConfig;
}
switch ($this->deliveryAttributes->getFormat()) {
case PlaybackProtocol::RTMP:
$baseUrl = $this->entry->getStreamUrl();
$baseUrl = rtrim($baseUrl, '/');
if (strpos($this->deliveryAttributes->getMediaProtocol(), "rtmp") === 0) {
$baseUrl = $this->deliveryAttributes->getMediaProtocol() . '://' . preg_replace('/^rtmp.*?:\\/\\//', '', $baseUrl);
}
$liveStreamConfig = new kLiveStreamConfiguration();
$liveStreamConfig->setUrl($baseUrl);
$liveStreamConfig->setProtocol(PlaybackProtocol::RTMP);
return $liveStreamConfig;
case PlaybackProtocol::APPLE_HTTP:
// TODO pass single tag
$liveStreamConfig = new kLiveStreamConfiguration();
$liveStreamConfig->setUrl($this->entry->getHlsStreamUrl());
$liveStreamConfig->setProtocol(PlaybackProtocol::APPLE_HTTP);
return $liveStreamConfig;
}
return null;
}
示例3: setContextDataStreamerTypeAndMediaProtocol
private function setContextDataStreamerTypeAndMediaProtocol(accessControlScope $scope, $flavorTags)
{
if ($this->streamerType && $this->streamerType != PlaybackProtocol::AUTO) {
$this->mediaProtocol = $this->mediaProtocol ? $this->mediaProtocol : $this->streamerType;
} elseif ($this->entry instanceof LiveEntry) {
$protocols = array();
if (!in_array($this->entry->getSource(), LiveEntry::$kalturaLiveSourceTypes)) {
$protocols[] = PlaybackProtocol::AKAMAI_HDS;
}
$protocols[] = PlaybackProtocol::HDS;
if ($this->entry->getStreamName()) {
$this->streamerType = PlaybackProtocol::RTMP;
}
foreach ($protocols as $protocol) {
$config = $this->entry->getLiveStreamConfigurationByProtocol($protocol, requestUtils::getProtocol());
if ($config) {
$this->streamerType = $protocol;
break;
}
}
if (in_array($this->entry->getSource(), array(EntrySourceType::LIVE_STREAM, EntrySourceType::LIVE_STREAM_ONTEXTDATA_CAPTIONS))) {
$this->streamerType = PlaybackProtocol::HDS;
}
if ($this->entry->getSource() == EntrySourceType::AKAMAI_LIVE) {
$this->streamerType = PlaybackProtocol::RTMP;
}
if ($this->entry->getSource() == EntrySourceType::AKAMAI_UNIVERSAL_LIVE) {
$this->streamerType = PlaybackProtocol::AKAMAI_HDS;
}
} else {
$this->isSecured = $this->isSecured || PermissionPeer::isValidForPartner(PermissionName::FEATURE_ENTITLEMENT_USED, $this->entry->getPartnerId());
$forcedDeliveryTypeKey = kDeliveryUtils::getForcedDeliveryTypeKey($this->selectedTag);
if ($forcedDeliveryTypeKey) {
$defaultDeliveryTypeKey = $forcedDeliveryTypeKey;
} else {
$defaultDeliveryTypeKey = $this->partner->getDefaultDeliveryType();
}
if (!$defaultDeliveryTypeKey || $defaultDeliveryTypeKey == PlaybackProtocol::AUTO) {
$deliveryType = $this->selectDeliveryTypeForAuto();
} else {
$deliveryType = kDeliveryUtils::getDeliveryTypeFromConfig($defaultDeliveryTypeKey);
}
if (!$deliveryType) {
$deliveryType = array();
}
$this->streamerType = kDeliveryUtils::getStreamerType($deliveryType);
$this->mediaProtocol = kDeliveryUtils::getMediaProtocol($deliveryType);
}
$httpStreamerTypes = array(PlaybackProtocol::HTTP, PlaybackProtocol::HDS, PlaybackProtocol::HLS, PlaybackProtocol::SILVER_LIGHT, PlaybackProtocol::MPEG_DASH);
if (in_array($this->streamerType, $httpStreamerTypes)) {
$this->mediaProtocol = infraRequestUtils::getProtocol();
}
if ($this->streamerType == PlaybackProtocol::AKAMAI_HD || $this->streamerType == PlaybackProtocol::AKAMAI_HDS) {
$this->mediaProtocol = PlaybackProtocol::HTTP;
}
//If a plugin can determine the streamerType and mediaProtocol, prefer plugin result
$pluginInstances = KalturaPluginManager::getPluginInstances('IKalturaContextDataHelper');
foreach ($pluginInstances as $pluginInstance) {
/* @var $pluginInstance IKalturaContextDataHelper */
$this->streamerType = $pluginInstance->getContextDataStreamerType($scope, $flavorTags, $this->streamerType);
$this->mediaProtocol = $pluginInstance->getContextDataMediaProtocol($scope, $flavorTags, $this->streamerType, $this->mediaProtocol);
}
}