vishen / go-chromecast

cli for Google Chromecast, Home devices and Cast Groups
Apache License 2.0
854 stars 84 forks source link

configure pause timeout #141

Open vredesbyyrd opened 2 years ago

vredesbyyrd commented 2 years ago

Hi, thanks for sharing go-chromecast - its great!

If you pause the playing content for greater than 20min, chromecasts "ambient" mode kicks in and begins displaying a slideshow. This would be great if there was a way to keep the connection alive - but attempting to unpause the stream results in nothing, and I do not see any errors in the go-chromecast ui log section of the tui.

Running go-chromecast -v -u uuid load sample.mp4 shows that after 20min the connections heartbeat stops, and "isIdleScreen":true. I am casting to a gen 3 dongle

DEBU[1285] (-1)Tr@n$p0rt-0 <- Tr@n$p0rt-0 [urn:x-cast:com.google.cast.tp.heartbeat]: {"type":"PING"}  package=cast
DEBU[1285] (-1)Tr@n$p0rt-0 -> Tr@n$p0rt-0 [urn:x-cast:com.google.cast.tp.heartbeat]: {"type":"PONG"}  package=cast
DEBU[1288] (-1)* <- receiver-0 [urn:x-cast:com.google.cast.receiver]: {"requestId":0,"status":{"userEq":{},"volume":{"controlType":"attenuation","level":1.0,"muted":false,"stepInterval":0.05000000074505806}},"type":"RECEIVER_STATUS"}  package=cast
INFO[1288] method=GET, headers=map[Accept:[*/*] Accept-Encoding:[identity;q=1, *;q=0] Accept-Language:[en-US,en;q=0.9] Cast-Device-Capabilities:[{"bluetooth_supported":true,"display_supported":true,"hi_res_audio_supported":false,"remote_control_input_supported":false,"touch_input_supported":false}] Connection:[keep-alive] Range:[bytes=24510464-] User-Agent:[Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.225 Safari/537.36 CrKey/1.56.500000 DeviceType/Chromecast]], reponse_headers=map[Accept-Ranges:[bytes] Content-Length:[789838565] Content-Range:[bytes 24510464-814349028/814349029] Content-Type:[video/mp4] Last-Modified:[Mon, 17 Jun 2019 22:34:53 GMT]]  package=application
DEBU[1288] (-1)sender-0 <- 4ca85f54-7e28-4006-98c2-46cb5e10510a [urn:x-cast:com.google.cast.tp.connection]: {"type":"CLOSE"}  package=cast
DEBU[1293] (-1)* <- receiver-0 [urn:x-cast:com.google.cast.receiver]: {"requestId":0,"status":{"applications":[{"appId":"E8C28D3C","appType":"WEB","displayName":"Backdrop","iconUrl":"","isIdleScreen":true,"launchedFromCloud":false,"namespaces":[{"name":"urn:x-cast:com.google.cast.debugoverlay"},{"name":"urn:x-cast:com.google.cast.cac"},{"name":"urn:x-cast:com.google.cast.sse"},{"name":"urn:x-cast:com.google.cast.remotecontrol"}],"sessionId":"58002892-7dea-469e-877f-e72b0f59a828","statusText":"","transportId":"58002892-7dea-469e-877f-e72b0f59a828","universalAppId":"E8C28D3C"}],"userEq":{},"volume":{"controlType":"attenuation","level":1.0,"muted":false,"stepInterval":0.05000000074505806}},"type":"RECEIVER_STATUS"}  package=cast

I assumed timeout could be configured from the chromecast side, but was not so surprised to find out it's not possible - at least without enabling "developer mode" via adb (maybe). Even then people appear to have mixed results.

Do you have thoughts on potentially working around this? Yes, screen burn in needs to be considered - but 20min is too short imo.

Thanks for your time.

EDIT: Not sure how accurate this info is, but it references configuring the various timeouts from the app side, specifically the first comment. Ideally we could keep the connection alive regardless of chromecasts ambient mode - but I assume its not possible?

chromecast timeout

vishen commented 2 years ago

I don't quite understand how the idle timeout works, but I believe that thread is saying it is set by the "app developer" which will be whoever built the chromecast application (I think) eg; Netflix, Youtube, etc. There may be some APIs to control this, although I am not too familiar with any of them, and it might depend on if the app developer implemented the APIs:

I don't know if we can control the heartbeat from our end since the "PING" comes from the chromecast and we always reply with "PONG". I don't know if it is possible to force a heartbeat by sending our own "PING".