当前位置: 首页>>代码示例>>PHP>>正文


PHP requestUtils::resolve方法代码示例

本文整理汇总了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;
 }
开发者ID:DBezemer,项目名称:server,代码行数:15,代码来源:DeliveryProfileLiveDash.php

示例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;
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:41,代码来源:DeliveryProfileLiveHds.php

示例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);
     }
 }
开发者ID:AdiTal,项目名称:server,代码行数:35,代码来源:DeliveryProfileLiveAppleHttp.php


注:本文中的requestUtils::resolve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。