【问题标题】:Is avc1.66.31,mp4a.40.2 supported by the Chromecast device?Chromecast 设备是否支持 avc1.66.31,mp4a.40.2?
【发布时间】:2015-09-24 04:57:46
【问题描述】:

我有一个如下所示的 m3u8 文件:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=2048805,CODECS="avc1.66.31,mp4a.40.2",RESOLUTION=1280x720
chunklist_w517510829.m3u8

我在尝试播放时收到以下错误:

Uncaught NotSupportedError: Failed to execute 'addSourceBuffer' on 'MediaSource': The type provided ('video/mp2t; codecs="avc1.66.31,mp4a.40.2"') is unsupported.
player.js:1682 Uncaught TypeError: undefined is not a function

奇怪的是,如果我删除 avc1.66.31,mp4a.40.2,它在 Chromecast 上运行良好。我正在将此示例用作播放器https://github.com/googlecast/Cast-Player-Sample

谢谢。

【问题讨论】:

    标签: chromecast google-cast


    【解决方案1】:

    Chromecast 的某些版本拒绝“avc1.66.31”,因此建议通过更新播放列表或使用 host.processManifest 解决方法来改用“avc1.66.30”

    host.processManifest = function(manifest) {
      return manifest.replace(/CODECS=\"avc1.66.([0-9]*)/g, 'CODECS=\"avc1.66.30');
    };
    

    在自定义接收器中。

    【讨论】:

    • 我会在player.js 文件上这样做吗?
    • 是的,如果您在该文件中搜索“主机”,就会找到它。
    【解决方案2】:

    在新版本的 Chromecast 中,我必须:

    context.getPlayerManager().setMediaPlaybackInfoHandler((loadRequest, playbackConfig) => {
    
      if (loadRequest.media.customData &&
          loadRequest.media.customData.playbackConfig && 
          loadRequest.media.customData.playbackConfig.manifestHandler) {
    
         playbackConfig.manifestHandler = loadRequest.media.customData.playbackConfig.manifestHandler;
      }
    
      return playbackConfig;
    });
    

    然后我以这种方式加载媒体信息(从清单中删除avc1.100 格式行):

    const mediaInformation = new window.cast.framework.messages.MediaInformation();
    
    ...
    
    mediaInformation.hlsSegmentFormat = window.cast.framework.messages.HlsSegmentFormat.TS;
    
    mediaInformation.customData = {
    
      manifestHandler: manifest => {
    
          const lines = manifest.split(/\n/);
          const result = [];
    
          let i = 0;
          while(i < lines.length) {
          if (lines[i].match(/avc1\.100\./)) {
            i += 2;
          } else {
            result.push(lines[i]);
            i++;
          }
         }
    
         return result.join('\n');
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2017-01-09
      • 1970-01-01
      • 2017-01-23
      • 2013-11-03
      • 1970-01-01
      • 2015-03-16
      • 2013-03-23
      • 2021-10-30
      • 1970-01-01
      相关资源
      最近更新 更多