本文整理汇总了PHP中requestUtils::resolve方法的典型用法代码示例。如果您正苦于以下问题:PHP requestUtils::resolve方法的具体用法?PHP requestUtils::resolve怎么用?PHP requestUtils::resolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类requestUtils
的用法示例。
在下文中一共展示了requestUtils::resolve方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkIsLive
public function checkIsLive($url)
{
$content = $this->urlExists($url, array('application/dash+xml'));
if (!$content) {
return false;
}
$mediaUrls = $this->getDashUrls($content);
foreach ($mediaUrls as $mediaUrl) {
$mediaUrl = requestUtils::resolve($mediaUrl, $url);
if ($this->urlExists($mediaUrl, array('audio/mp4', 'video/mp4'), '0-1') !== false) {
return true;
}
}
return false;
}
示例2: buildF4mFlavors
/**
* Fetch the manifest and build all flavors array
* @param string $url
*/
private function buildF4mFlavors($url, array &$flavors, array &$bootstrapInfos)
{
$manifest = KCurlWrapper::getContent($url);
if (!$manifest) {
return;
}
$manifest = preg_replace('/xmlns="[^"]+"/', '', $manifest);
$xml = new SimpleXMLElement($manifest);
$mediaElements = $xml->xpath('/manifest/media');
foreach ($mediaElements as $mediaElement) {
/* @var $mediaElement SimpleXMLElement */
$flavor = array('urlPrefix' => '');
$playlistUrl = null;
foreach ($mediaElement->attributes() as $attr => $attrValue) {
$attrValue = "{$attrValue}";
if ($attr === 'url') {
$attrValue = requestUtils::resolve($attrValue, $url);
}
if ($attr === 'bootstrapInfoId') {
$bootstrapInfoElements = $xml->xpath("/manifest/bootstrapInfo[@id='{$attrValue}']");
if (count($bootstrapInfoElements)) {
$bootstrapInfoElement = reset($bootstrapInfoElements);
/* @var $bootstrapInfoElement SimpleXMLElement */
$playlistUrl = requestUtils::resolve(strval($bootstrapInfoElement['url']), $url);
}
}
$flavor["{$attr}"] = $attrValue;
}
if ($playlistUrl) {
$playlistId = md5($playlistUrl);
$bootstrapInfo = array('id' => $playlistId, 'url' => $playlistUrl);
$bootstrapInfos[$playlistId] = $bootstrapInfo;
$flavor['bootstrapInfoId'] = $playlistId;
}
$flavors[] = $flavor;
}
}
示例3: buildM3u8Flavors
/**
* Fetch the manifest and build all flavors array
* @param string $url
*/
private function buildM3u8Flavors($url, array &$flavors)
{
$this->finalizeUrls($url, $flavors);
$manifest = KCurlWrapper::getContent($url);
if (!$manifest) {
return;
}
$manifestLines = explode("\n", $manifest);
$manifestLine = reset($manifestLines);
while ($manifestLine) {
$lineParts = explode(':', $manifestLine, 2);
if ($lineParts[0] === '#EXT-X-STREAM-INF') {
// passing the url as urlPrefix so that only the path will be tokenized
$flavor = array('url' => '', 'urlPrefix' => requestUtils::resolve(next($manifestLines), $url), 'ext' => 'm3u8');
$attributes = explode(',', $lineParts[1]);
foreach ($attributes as $attribute) {
$attributeParts = explode('=', $attribute, 2);
switch ($attributeParts[0]) {
case 'BANDWIDTH':
$flavor['bitrate'] = $attributeParts[1] / 1024;
break;
case 'RESOLUTION':
list($flavor['width'], $flavor['height']) = explode('x', $attributeParts[1], 2);
break;
}
}
$flavors[] = $flavor;
}
$manifestLine = next($manifestLines);
}
}