i8beef / node-red-contrib-castv2

MIT License
22 stars 14 forks source link

Feature Request: YouTube playlist #70

Closed dgmltn closed 3 years ago

dgmltn commented 3 years ago

I see the beginnings of being able to set a playlist id in YouTubeController.js ... I'd love for that to be exposed to this node. What can I do to help?

i8beef commented 3 years ago

Really it just requires someone willing to dig into the Youtube APIs to figure out how to do it. The YouTube support here was a proof of concept that just sort of worked and so I left it for people that needed it, but I don't know much about it.

The way the cast protocol works, it basically only handles "launch", a standard set of "media control commands", and then apps can EITHER (a) define there extension commands they support that can be sent through the cast protocol to control the app, or (b) set up a "session" and really run everything through their own website / apis after initial launch. Some apps (Spotify) lean hard into (b) and suffer for it. The YouTube app is somewhere in between... it supports most of the standard media commands directly, but they implement the playlist / media load stuff in their API.

And thats what you see in the YouTubeController. I can't vouch too much for it... for instance I think if you want to be able to add / remove items to the playlist, or start it with more than one video, you might have to keep track of the "loungueToken" between requests (or just fetch a new one every time, not completely sure). And you'd have to figure out the rest of the API there for doing that.

Its probably not HARD but Google isn't exactly known for making things beginner friendly with their dev stuff 😄 If you figure it out though, I do accept pull requests.

dgmltn commented 3 years ago

Thanks for the detailed response. I appreciate it! TIL also that YouTube Music is different than YouTube...

YouTube: has custom cast receiver in Nest Hub (but not nest mini). Accessible via web and YouTube mobile app both.

YouTube Music: has lightly branded cast receiver only accessible via YT Music mobile app, but not web.

Now it's a matter of finding the time to dig in more...