home-assistant-libs / pychromecast

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

Playing Reddit HLS or Dash videos back #280

Open christianselig opened 5 years ago

christianselig commented 5 years ago

I can't for the life of me figure out how to playback Reddit videos with pychromecast. They're available either as HLS or DASH. Here's one of each https://v.redd.it/3hyw7hwoajn21/HLSPlaylist.m3u8 (HLS) and https://v.redd.it/3hyw7hwoajn21/DASHPlaylist.mpd (DASH).

If I try mc.play_media('https://v.redd.it/3hyw7hwoajn21/HLSPlaylist.m3u8', 'video/m3u8'), no luck. If I try mc.play_media('https://v.redd.it/3hyw7hwoajn21/DASHPlaylist.mpd', 'application/dash+xml') also no luck. I've also tried the content type application/x-mpegURL to no avail.

How would I accomplish this?

balloob commented 5 years ago

application/vnd.apple.mpegurl is the right content type of HLS.

christianselig commented 5 years ago

@balloob Tried that unfortunately.

mc.play_media('https://v.redd.it/3hyw7hwoajn21/HLSPlaylist.m3u8', 'application/vnd.apple.mpegurl')

Still does not play.

christianselig commented 5 years ago

@balloob I see it's possible with the DASH URL to separate the video and audio streams (https://v.redd.it/3hyw7hwoajn21/DASH_720 and https://v.redd.it/3hyw7hwoajn21/audio respectively).

Is there a way then to play the video with a separate audio track?