How to solve issue where the CAF receiver gets initialized with the wrong audio segment format with HLS streams?

In some cases, the CAFv3 receiver (powered by Shaka Player), fails with the following error, when trying to play a HLS stream with TS segments:

Neither ID3 nor ADTS header was found at 0

This might be because Shaka Player gets initialized with the wrong audio segment format (MPEG2_TS), instead of TS.

One solution to this is to intercept the Load request and force the HlsSegmentFormat to TS.

(source and details : Google Issue Tracker)

The Bitmovin CAFv3 receiver is available open source on Github, so it is possible to apply this fix directly by replacing the init() function with the following :

 public init() {
    // cast.framework.CastReceiverContext.getInstance().setLoggerLevel(cast.framework.LoggerLevel.DEBUG);

    this.attachEvents();
// intercept the LOAD request
this.player.setMessageInterceptor(cast.framework.messages.MessageType.LOAD, loadRequestData => {
            loadRequestData.media.hlsSegmentFormat = cast.framework.messages.HlsSegmentFormat.TS;
            return loadRequestData;
});
    this.context.start();
  }

Once this is done, you can follow the build instructions and publish your custom receiver through the chromecast developer console.

After a few minutes, your receiver should be ready to use.

Example :

var conf = {
  key: '<YOUR PLAYER KEY HERE>',
  remotecontrol: {
    type: 'googlecast',
// replace the ID of the  Bitmovin default receiver application with the one you just created
    receiverApplicationId: 'FFE417E5',
    receiverVersion: 'v3',
    messageNamespace: 'urn:x-cast:com.bitmovin.player.caf',
  },
};

Very useful, thanks for sharing Ludo!

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.