2

we are trying to play a HLS Live stream that is Audio-only. It looks ok spec-wise and we're able to play it on all browsers and native player that we have, but it fails to play on Chromecast.

Url: http://rcavliveaudio.akamaized.net/hls/live/2006635/P-2QMTL0_MTL/playlist.m3u8

Content-Type: vnd.apple.mpegURL

Steps to reproduce Force this content url and content type into the Chromecast player.

Expected To hear audio playing like on any other player we try.

Actual result There is no playback. The master playlist is fetched, the chunk playlist is fetched and the first chunks are fetched, but there is no playback. It stops after a few chunk. The player is stuck in the "processing segment" phase, and it stops.

2 Answers2

1

Please change the Content type to audio/mp4 and set AAC to segment format mediaInfo.hlsSegmentFormat = cast.framework.messages.HlsSegmentFormat.AAC;

  • 1
    @MarcDesharnais can you please tell me where to put this or have an example? I just started with a custom receiver and have no clue where to put this. – Boy Apr 28 '20 at 15:23
  • @AnjaneeshRayapati Can you elaborate on this answer? Where are you getting `mediaInfo`? Using the reference code, there is only `mediaInfo` on the sender, but `cast.framework.messages.HlsSegmentFormat.AAC` is only defined on the receiver. In my case, I set `mediaInfo.hlsSegmentFormat = 'ts_aac'` on my *sender* (using the string value, not the defined constant), and I was able to get my stream to work. But, this seems wonky, and different than what you're suggesting here. – Brad Nov 13 '20 at 23:37
0

Using Anjaneesh's comment, here's how I ended up solving this. On the receiver's JavaScript:

  const instance = cast.framework.CastReceiverContext.getInstance();

  const options = new cast.framework.CastReceiverOptions();
  options.disableIdleTimeout = true;
  options.supportedCommands = cast.framework.messages.Command.ALL_BASIC_MEDIA;

  instance.start(options);

  const playerManager = instance.getPlayerManager();
  playerManager.setMessageInterceptor(cast.framework.messages.MessageType.LOAD, (req) => {
    req.media.hlsSegmentFormat = cast.framework.messages.HlsSegmentFormat.TS_AAC;
    req.media.streamType = cast.framework.messages.StreamType.LIVE;
    return req;
  });

The key is setting the message interceptor callback for the LOAD event/message. There, you can override hlsSegmentFormat from the client. In my case, I needed to indicate that my segments were in TS format.

I'm not entirely sure why this is necessary. It isn't necessary when there is a video track... only when video is missing.

Brad
  • 159,648
  • 54
  • 349
  • 530