本文整理汇总了PHP中entry::getStreamRemoteId方法的典型用法代码示例。如果您正苦于以下问题:PHP entry::getStreamRemoteId方法的具体用法?PHP entry::getStreamRemoteId怎么用?PHP entry::getStreamRemoteId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entry
的用法示例。
在下文中一共展示了entry::getStreamRemoteId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildRtmpLiveStreamFlavorsArray
/**
* @param string $baseUrl
* @return array
*/
private function buildRtmpLiveStreamFlavorsArray(&$baseUrl)
{
$streamId = $this->entry->getStreamRemoteId();
$streamUsername = $this->entry->getStreamUsername();
$baseUrl = $this->entry->getStreamUrl();
$baseUrl = rtrim($baseUrl, '/');
$rtmpHost = parse_url($baseUrl, PHP_URL_HOST);
$urlManager = $this->getUrlManagerByCdn($rtmpHost);
$flavors = $this->entry->getStreamBitrates();
if (count($flavors)) {
foreach ($flavors as $index => $flavor) {
$brIndex = $index + 1;
$flavors[$index]['url'] = str_replace('%i', $brIndex, $this->entry->getStreamName());
}
} else {
$flavors[0]['url'] = str_replace('%i', '1', $this->entry->getStreamName());
}
if (strpos($this->protocol, "rtmp") === 0) {
$baseUrl = $this->protocol . '://' . preg_replace('/^rtmp.*?:\\/\\//', '', $baseUrl);
}
$urlManager->finalizeUrls($baseUrl, $flavors);
$this->tokenizer = $urlManager->getTokenizer();
return $flavors;
}
示例2: serveRtmp
//.........这里部分代码省略.........
$storagesFlavors[$storage->getId()][] = $flavorAsset;
}
}
}
$maxCount = 0;
foreach ($storagesFlavors as $storageId => $storageFlavors) {
$count = count($storageFlavors);
if ($count > $maxCount) {
$maxCount = $count;
$this->storageId = $storageId;
$finalFlavors = $storageFlavors;
}
}
$flavorAssets = $finalFlavors;
} else {
foreach ($flavorAssets as $flavorAsset) {
$key = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($key);
if ($fileSync) {
$finalFlavors[] = $flavorAsset;
}
}
}
}
}
foreach ($flavorAssets as $flavorAsset) {
$mediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($flavorAsset->getId());
if ($mediaInfo && ($mediaInfo->getVideoDuration() || $mediaInfo->getAudioDuration() || $mediaInfo->getContainerDuration())) {
$duration = $mediaInfo->getVideoDuration() ? $mediaInfo->getVideoDuration() : ($mediaInfo->getAudioDuration() ? $mediaInfo->getAudioDuration() : $mediaInfo->getContainerDuration());
$duration /= 1000;
break;
}
}
$baseUrl = null;
$flavors = array();
if ($this->storageId) {
$storage = StorageProfilePeer::retrieveByPK($this->storageId);
if (!$storage) {
die;
}
$baseUrl = $storage->getDeliveryRmpBaseUrl();
// get all flavors with external urls
foreach ($flavorAssets as $flavorAsset) {
$key = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($key, $this->storageId);
if (!$fileSync) {
continue;
}
$urlManager = kUrlManager::getUrlManagerByStorageProfile($fileSync->getDc());
$urlManager->setClipTo($this->clipTo);
$urlManager->setFileExtension($flavorAsset->getFileExt());
$urlManager->setProtocol(StorageProfile::PLAY_FORMAT_RTMP);
$url = $urlManager->getFileSyncUrl($fileSync);
$url = preg_replace('/^\\//', '', $url);
$flavors[] = array('url' => $url, 'bitrate' => $flavorAsset->getBitrate(), 'width' => $flavorAsset->getWidth(), 'height' => $flavorAsset->getHeight());
}
} else {
$partnerId = $this->entry->getPartnerId();
$subpId = $this->entry->getSubpId();
$partnerPath = myPartnerUtils::getUrlForPartner($partnerId, $subpId);
$baseUrl = myPartnerUtils::getRtmpUrl($partnerId);
$urlManager = kUrlManager::getUrlManagerByCdn($this->cdnHost);
// get all flavors with kaltura urls
foreach ($flavorAssets as $flavorAsset) {
$urlManager->setClipTo($this->clipTo);
$urlManager->setFileExtension($flavorAsset->getFileExt());
$urlManager->setProtocol(StorageProfile::PLAY_FORMAT_RTMP);
$url = $urlManager->getFlavorAssetUrl($flavorAsset);
$url = preg_replace('/^\\//', '', $url);
$flavors[] = array('url' => $url, 'bitrate' => $flavorAsset->getBitrate(), 'width' => $flavorAsset->getWidth(), 'height' => $flavorAsset->getHeight());
}
}
if (!count($flavors)) {
KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND);
}
if (strpos($this->protocol, "rtmp") === 0) {
$baseUrl = $this->protocol . '://' . preg_replace('/^rtmp.*?:\\/\\//', '', $baseUrl);
}
return $this->buildXml(self::PLAY_STREAM_TYPE_RECORDED, $flavors, 'video/x-flv', $duration, $baseUrl);
case entryType::LIVE_STREAM:
$streamId = $this->entry->getStreamRemoteId();
$streamUsername = $this->entry->getStreamUsername();
$baseUrl = $this->entry->getStreamUrl();
$baseUrl = rtrim($baseUrl, '/');
$flavors = $this->entry->getStreamBitrates();
if (count($flavors)) {
foreach ($flavors as $index => $flavor) {
$brIndex = $index + 1;
$flavors[$index]['url'] = str_replace('%i', $brIndex, $this->entry->getStreamName());
}
} else {
$flavors[0]['url'] = str_replace('%i', '1', $this->entry->getStreamName());
}
if (strpos($this->protocol, "rtmp") === 0) {
$baseUrl = $this->protocol . '://' . preg_replace('/^rtmp.*?:\\/\\//', '', $baseUrl);
}
return $this->buildXml(self::PLAY_STREAM_TYPE_LIVE, $flavors, 'video/x-flv', null, $baseUrl);
}
KExternalErrors::dieError(KExternalErrors::INVALID_ENTRY_TYPE);
}
示例3: addProvisionDeleteJob
public static function addProvisionDeleteJob(BatchJob $parentJob = null, entry $entry)
{
$jobData = kProvisionJobData::getInstance($entry->getSource());
if ($jobData) {
$jobData->setStreamID($entry->getStreamRemoteId());
$subType = $entry->getSource();
$jobData->populateFromPartner($entry->getPartner());
$jobData->populateFromEntry($entry);
$batchJob = null;
if ($parentJob) {
$batchJob = $parentJob->createChild(BatchJobType::PROVISION_DELETE, $subType);
} else {
$batchJob = new BatchJob();
$batchJob->setEntryId($entry->getId());
$batchJob->setPartnerId($entry->getPartnerId());
}
$batchJob->setObjectId($entry->getId());
$batchJob->setObjectType(BatchJobObjectType::ENTRY);
return self::addJob($batchJob, $jobData, BatchJobType::PROVISION_DELETE, $subType);
}
return false;
}
示例4: addProvisionDeleteJob
public static function addProvisionDeleteJob(BatchJob $parentJob = null, entry $entry)
{
$jobData = new kProvisionJobData();
$jobData->setStreamID($entry->getStreamRemoteId());
$batchJob = null;
if ($parentJob) {
$batchJob = $parentJob->createChild();
} else {
$batchJob = new BatchJob();
$batchJob->setEntryId($entry->getId());
$batchJob->setPartnerId($entry->getPartnerId());
}
$subType = $entry->getSource();
return self::addJob($batchJob, $jobData, BatchJobType::PROVISION_DELETE, $subType);
}