Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Chromecast unable to stream this HLS video? "Neither ID3 nor ADTS header was found" / Error NETWORK/315

I'm trying to stream some URLs to my Chromecast through a sender app. They're HLS/m3u8 URLs.

Here's one such example URL: https://qa-apache-php7.dev.kaltura.com/p/1091/sp/109100/playManifest/entryId/0_wifqaipd/protocol/https/format/applehttp/flavorIds/0_h65mfj7f,0_3flmvnwc,0_m131krws,0_5407xm9j/a.m3u8

However they never seem to load on the Chromecast, despite other HLS/m3u8 URLs working (example of an HLS stream that does work).

It's not related to CORS as they indeed have the proper CORS headers.

I notice they have separate audio groups in the root HLS manifest file.

When I hook it up to a custom receiver app, I get the following logs:

enter image description here

The relevant bits being (I think): Neither ID3 nor ADTS header was found at 0 and cast.player.api.ErrorCode.NETWORK/315 (which I believe is a result of the first)

These are perfectly valid/working HLS URLs. They play back in Safari on iOS and desktop perfectly, as well as VLC.

Is there something I need to be doing (either in my sender app or my receiver app) to enable something like the audio tracks? The docs seem to indicate something about that.

I also found this Google issue where a person had a similar issue, but solved it somehow that I can't understand. https://issuetracker.google.com/u/1/issues/112277373

How would I playback this URL on Chromecast properly? Am I to do something in code?

like image 417
Doug Smith Avatar asked Mar 27 '19 19:03

Doug Smith


People also ask

Why did they discontinue chromecast audio?

The official reason Google provided for discontinuing the Audio line was that they already had many products for users to enjoy their music and podcasts. They informed customers the Chromecast Audio would still be supported but no longer manufactured.

What is a HLS manifest?

The individual manifest files detail the profile used during encoding so the player will only select and retrieve compatible streams. This allows producers to create a single set of HLS files that will serve iPhone/iPod touch devices with Baseline streams and iPads with streams encoded using the Main profile.

Why is my Chromecast not connecting to Google Home?

Common Chromecast issues include being unable to cast from a phone or computer, being unable to find your device in Google Home, and Chromecast not connecting to WiFi. You can solve many Chromecast issues using simple troubleshooting tactics. If all else fails, a factory reset might be your best bet.

What are the most common Chromecast issues?

Common Chromecast issues include being unable to connect to WiFi, being unable to find the Chromecast device in the Google Home app, and Chromecast not casting to the TV screen. In many cases, the causes are loose connections or network issues.

How do I know which network my Chromecast is connected to?

Follow the steps below to find out which network your Chromecast is connected to. Make sure your Chromecast is connected to the TV’s HDMI port and plugged in before starting. Open up the Google Home app and tap your device. Then, tap on the “settings” icon in the top-right corner.

Why does my Dacast live stream fail?

One thing that can cause a live stream to fail is a lack of bandwidth. Any Dacast plan comes with a limited amount of bandwidth. To check if you’ve hit your limit, visit your Dacast account. In the section “Upgrade my plan,” you will see the bandwidth you have remaining.


2 Answers

This already has a solution here but I will add this answer in case someone looks up the exact error message / code.

The problem lies in the hlsSegmentFormat which is initialized to TS for multiplexed segments but currently defaults to packed audio for HLS with alternate audio tracks.

The solution is to intercept the CAF LOAD request and set the correct segment format:

const context = cast.framework.CastReceiverContext.getInstance();
const playerManager = context.getPlayerManager();
// intercept the LOAD request
playerManager.setMessageInterceptor(cast.framework.messages.MessageType.LOAD, loadRequestData => {
            loadRequestData.media.hlsSegmentFormat = cast.framework.messages.HlsSegmentFormat.TS;
            return loadRequestData;
});
context.start();


Source: Google Cast issue tracker

like image 172
aergistal Avatar answered Oct 23 '22 02:10

aergistal


For those who manage multiple video sources in various formats and who don't want to arbitrarily force the HLS fragment format to TS, I suggest to track the error and set a flag that force the format at the next retry (by default, the receiver tries 3 times before giving up).

First, have a global flag to enable the HLS segments format override:

setHlsSegmentFormat = false;

Then detect the error:

playerManager.addEventListener(cast.framework.events.EventType.ERROR, 
  event => {
    if (event.detailedErrorCode == cast.framework.events.DetailedErrorCode.HLS_NETWORK_INVALID_SEGMENT) {
      // Failed parsing HLS fragments. Will retry with HLS segments format set to 'TS'
      setHlsSegmentFormat = true;
    }
  }
);

Finally, handle the flag when intercepting the playback request:

playerManager.setMediaPlaybackInfoHandler(
  (loadRequest, playbackConfig) => {
    if (setHlsSegmentFormat) {
      loadRequest.media.hlsSegmentFormat = cast.framework.messages.HlsSegmentFormat.TS;
      // clear the flag to not force the format for subsequent playback requests
      setHlsSegmentFormat = false;
    }
  }
);

The playback will quickly fail the first time and will succeed at the next attempt. The loading time is a bit longer but the HLS segment format is only set when required.

like image 1
Aurelien Avatar answered Oct 23 '22 03:10

Aurelien