I have a little python script that is supposed to cast any provided media file and display that on whichever device I specify. It was running just fine the other day, however after some testing the following morning, the script is no longer casting. There are not any runtime errors that pop up in my terminal nor any stated problems in the problem tab of Visual Studio Code. So other than overviewing the code to see if I had fat-fingered something that doesn't belong, I'm not too sure what other information I could provide that would be helpful.
import time
import pychromecast
#List chromecasts on the network, but don't connect
services, browser = pychromecast.discovery.discover_chromecasts()
#print(*services, sep='\n')
#print(browser, sep='\n')
#Shut down discovery
pychromecast.discovery.stop_discovery(browser)
#Discover and connect to chromecasts named Waiting Area TV
chromecasts, browser = pychromecast.get_listed_chromecasts(friendly_names=['Atlas Conference TV'])
#print(chromecasts)
#print('\n')
#print(browser)
#print('\n')
#print([cc.name for cc in chromecasts])
for cast in chromecasts:
# Start worker thread and wait for cast device to be ready
cast.wait()
#DeviceStatus(friendly_name='Atlas Conference TV', model_name='Chromecast', manufacturer='Google Inc.', uuid=UUID('df6944da-f016-4cb8-97d0-3da2ccaa380b'), cast_type='cast')
print(cast.status)
#CastStatus(is_active_input=True, is_stand_by=False, volume_level=1.0, volume_muted=False, app_id='CC1AD845', display_name='Default Media Receiver', namespaces=['urn:x-cast:com.google.cast.player.message', 'urn:x-cast:com.google.cast.media'], session_id='CCA39713-9A4F-34A6-A8BF-5D97BE7ECA5C', transport_id='web-9', status_text='')
mc = cast.media_controller
mc.play_media('http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4', 'video/mp4')
print(mc.status)
#MediaStatus(current_time=42.458322, content_id='http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4', content_type='video/mp4', duration=596.474195, stream_type='BUFFERED', idle_reason=None, media_session_id=1, playback_rate=1, player_state='PLAYING', supported_media_commands=15, volume_level=1, volume_muted=False)
time.sleep(10)
time.sleep(20)
for cast in chromecasts:
cast.wait()
mc = cast.media_controller
mc.stop()
print('\n')
print(f"Cast: [{cast}]... \nShould be playing... \ntime to stop it.")
print(cast.status)
time.sleep(2)
cast.wait()
cast.quit_app()
print(cast.status)
# # Shut down discovery
pychromecast.discovery.stop_discovery(browser)