1

I'm developing an iOS app and have it Casting video to my Chromecast. I'm using the latest Cast SDK, the Default Receiver app, the stock Cast Button and Device Selection Dialog, etc.

I can successfully cast an HLS VOD playlist to the Chromecast and it plays fine. When I try to cast an HLS Livestream playlist, I get a disconnect after 3-5 minutes of play.

What happens is that my GCKSessionManagerListener receives the call sessionManager(_ sessionManager: GCKSessionManager, didSuspend session: GCKSession, with reason: GCKConnectionSuspendReason) with a suspend reason of -1 which...is not even in the enum?

I also get this in the log in Xcode, although I can't tell if it's an effect or a precipitation:

2018-04-10 09:43:58.414377-0700 iOS[4968:4491455] [] <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_None (client: iOS)

This is not caused by my iPhone app going to background, as most "disconnection problems" seem to be; in fact, it can go to background just fine because I configured the context options with suspendSessionsWhenBackgrounded = false. It just dies after about 4 minutes.

If I switch to a stock Receiver app and debug it via chrome://inspect, I saw only one error near the start of playing (something about an Item ID not supposed to be set) and then about 4 minutes later I get Debugging connection closed. Reason: Connection was lost.

How can I debug this or get more information about why my session is disconnecting?

Matt Mc
  • 8,882
  • 6
  • 53
  • 89

1 Answers1

1

Something is mismatching in the media stream you are using and the required specifications for your stream.

Try playing some sample videos (which works properly with casting examples) with your device and see if you are facing the same problem.
If you are able to play some videos properly with same code then try making changes in your stream as per the specification provided by chromecast.

https://developers.google.com/cast/docs/media

Abhishek
  • 3,304
  • 4
  • 30
  • 44
  • This seems like a pretty safe conclusion, especially since the VOD I'm playing is working just fine. However, the behavior of abruptly *disconnecting the session* entirely with no observable error codes is not very helpful. My HLS stream is validating per [Apple's validator](https://developer.apple.com/library/content/technotes/tn2235/_index.html#//apple_ref/doc/uid/DTS40010221-CH1-VALIDATORTOOL) and runs on other players. How could I discover what the issue is? – Matt Mc Apr 11 '18 at 16:16
  • I agree it’s difficult to find out that’s why I have posted the link of chromecast guidelines as well. – Abhishek Apr 11 '18 at 16:19
  • But I am sure that it can be solved only on stream level. Any source code change is not going to help you. – Abhishek Apr 11 '18 at 16:41
  • Is that list of codecs the *only* supported codecs for Chromecast? That's a *very slim* list compared to what I've seen out in the wild. Only about half of my HLS variants fit into that list anywhere. – Matt Mc Apr 11 '18 at 17:15