Is avc1.66.31,mp4a.40.2 supported by the Chromecast device?

后端 未结 2 1142
闹比i
闹比i 2020-12-20 08:05

I have an m3u8 file that looks like this:

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


        
相关标签:
2条回答
  • 2020-12-20 08:48

    In the new versions of Chromecast, I had to:

    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;
    });
    

    And then I load the media information this way (removing avc1.100 format lines from the manifest):

    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');
      }
    }
    
    0 讨论(0)
  • 2020-12-20 09:02

    Some builds of Chromecast reject "avc1.66.31" so it is recommendation to use "avc1.66.30" instead either by updating the playlist or using host.processManifest workaround

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

    in a custom receiver.

    0 讨论(0)
提交回复
热议问题