pychromecast icon indicating copy to clipboard operation
pychromecast copied to clipboard

Slideshow is stopping after about 20 minutes on Google Next Hub

Open dmitryelj opened this issue 5 years ago • 2 comments

Hi,

First, thanks for the cool product :)

I have Google Next Hub, that is compatible with Chromecast and I want to display a slide show on it. I'm using this code:

images = ["http://192.168.1.106:5000/img01.jpg", "http://192.168.1.106:5000/img02.jpg", "http://192.168.1.106:5000/img03.jpg"]

casts = pychromecast.get_chromecasts()
if len(casts) == 0:
    logging.debug("No Chromecast devices found")
    return

cast = casts[0]
cast.start()

time.sleep(1)

if not cast.is_idle:
    logging.debug("Killing current running app")
    cast.quit_app()
    time.sleep(5)

try:
    while True:
        for img_url in images:
            print("Show %s" % img_url)

            cast.play_media(img_url, 'image/jpg')
            time.sleep(10.0)
except KeyboardInterrupt:
    pass

cast.quit_app()

Is this code correct? It works, but after 20-25 minutes Google Hub is stopping changing the pictures and returning to its main screen.

Is it a known issue, or I am doing something wrong?

Thanks.

dmitryelj avatar Oct 14 '19 18:10 dmitryelj

@dmitryelj Though I did not have a Google Next Hub, I tried running your code on Chromecast. Unfortunately i was not able to simulate the error. Can you tell me more on the behavior of your python script. Does it get disconnected from the hub in between? Since you are trying to play the image files with the default media player, if there is an active connection with the media hub the script should be able to play the image. Can you figure out the status of the socket connection during the timeout. _can_read, , _ = select.select([cast.socket_client.get_socket()], [], [], poll_time) Use the above piece of code to find out the status of socket connection with the media hub.

Hope the machine where you are running the script is not going into sleep mode. Please note that you are triggering a media playback of an image every 10 seconds from a machine running the script. This machine has to continuously do it.

karthikpanicker avatar Oct 22 '19 08:10 karthikpanicker

Thanks for checking. I also tested the code on the Chromecast, it works good. So, the problem is only with the Nest Hub displays.

dmitryelj avatar Nov 17 '19 11:11 dmitryelj