I have replicated the issue on Chrome and Edge (on Android). Although don't appear to have the issue on Chrome and Edge (Windows). I have tried Chrome v83 and latest v98.0.4758.101 - same issue. I can successfully cast and disconnect.
However, if the network drops, router powers off, wifi unit powers off, cast receiver is unplugged - then the browser window on the Android also crashes (closes). We have included further debugging, android debugging, usb debuggin but there is no evidence of why the browser is crashing / closing.
What can I try to resolve this?
We use Google Chromecast session.sendMessage to communicate from our web app to our casted web app. I found when there was a network issue on an Android device using google chrome, calling session.sendMessage would crash Chrome. No errors or events received the webrowser would just exit.
There were 3 separate instances; Internet outage, chromeCast powered off, wifi was turned off.
The workaround was to run some basic checks before sending a message to the API.
The casting session is alive The status of navigator.onLine is true and a simple network check (API Call) == 200
all 3 checks must pass before sending a message. If one or more checks failed kill the session.
This does result in slightly slower cast speeds.