import time
import pychromecast
cast = pychromecast.Chromecast('192.168.1.86')
# Start worker thread and wait for cast device to be ready
cast.wait()
print(cast.device)
print(cast.status)
mc = cast.media_controller
mc.play_media('http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4', 'video/mp4')
mc.block_until_active()
print(mc.status)
mc.pause()
time.sleep(1)
mc.play()
If I run it on a up to date python I get:
Traceback (most recent call last):
File "/home/pi/welcome.py", line 5, in <module>
cast = pychromecast.Chromecast('192.168.1.86')
File "/home/pi/.local/lib/python3.9/site-packages/pychromecast/__init__.py", line 269, in __init__
if not cast_info.cast_type:
AttributeError: 'str' object has no attribute 'cast_type'
I'm trying this simple code:
If I run it on a up to date python I get:
But if I do:
pip install PyChromecast==1.0.3 zeroconf==0.19.1 protobuf==3.20.0
Then everything works fine.