home-assistant-libs / pychromecast

Library for Python 3 to communicate with the Google Chromecast.
MIT License
2.54k stars 379 forks source link

youtube "seek" not working #311

Open thedaynos opened 5 years ago

thedaynos commented 5 years ago

i've tried the following...

cast = next(cc for cc in chromecasts if cc.device.friendly_name=="my chromecast name")
cast.wait()
ytc=YouTubeController()
cast.register_handler(ytc1)

that works fine to get my chromecast.

then

ytc.play_video(vLink1)    #vLink1 is my variable for the video

this also works fine for me. I have no problem playing videos whenever i want.

my only problem is I cannot figure out the proper syntax after this to "seek" to 30 seconds.

I've seen a note from you that the following should work:

cast.media_controller.seek(30)

but that command does nothing for me when the video is playing. it just keeps playing as normal. It doesn't error out either though, which is confusing.

Any ideas?

Thanks

karthikpanicker commented 5 years ago

@thedaynos I think the media controller seek function works only with the default media player in chromecast. Youtube controller in this project relies on casttube (https://github.com/ur1katz/casttube) for creating a player session from the device, though casttube doesn't offer an api for the seek functionality.