Search code examples
androidgoogle-castchromecast

Is there a way to manually set the ApplicationSession network timeout for Android Chromecasting?


I'm sending a MediaProtocolMessageStream.loadMedia command to my receiver. After a few seconds my session ends with a "network I/O timeout" with channel=SessionError.CATEGORY_DISCONNECT_CHANNEL and code=SessionError.CODE_TIMEOUT. This only happens for longer videos in the range of over 200 minutes so I'm assuming there's a legitimate timeout going on. Is there anyway to tweak the timeout time in a session so I can load larger movies? I see there's a final DEFAULT_TIMEOUT in the underlying NetworkRequest, but I have no way of accessing it.


Solution

  • Timeout value cannot be adjusted by application. It would help us to understand what is causing the timeout in your case. Timeout happens when either the sender does not reply to the receiver's ping requests in a timely manner, or when the sender has not received a ping from the receiver for a certain length of time. It might be the case that the media you are trying to load is tying up the CPU on the receiver so that it can't send its ping request to the sender. Do you see anything in the sender's log similar to "timeout waiting for ping" or so?