i8beef / node-red-contrib-castv2

MIT License
22 stars 14 forks source link

YouTube videoId example #100

Closed guyluz11 closed 6 months ago

guyluz11 commented 6 months ago

Adding a real VideoIdFromYouTube link example would be nice.

I am not sure what parts do I need to inset, is it just the part after the v=id_of_video, will it take time parameter &t=36s, or maybe it sais id but require the full URL including the id https://www.youtube.com/watch?v=`id_of_video`&t=36s

A real video URL example would be nice

The exmaple flow looks like this

[{"id":"7e5bfb8fa4c126e8","type":"castv2-sender","z":"ee650b50714e44e9","name":"","connection":"","x":660,"y":380,"wires":[["9321ebf9139067ac","cbaa0aac7d363c5b"]]},{"id":"9e5878b11fc8abbd","type":"inject","z":"ee650b50714e44e9","name":"GET_CAST_STATUS","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"type\":\"GET_CAST_STATUS\"}","payloadType":"json","x":280,"y":140,"wires":[["7e5bfb8fa4c126e8"]]},{"id":"9321ebf9139067ac","type":"debug","z":"ee650b50714e44e9","name":"debug msg.platform","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"platform","targetType":"msg","statusVal":"","statusType":"auto","x":900,"y":380,"wires":[]},{"id":"cbaa0aac7d363c5b","type":"debug","z":"ee650b50714e44e9","name":"debug msg.payload","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":890,"y":320,"wires":[]},{"id":"65589ec9b74f963c","type":"inject","z":"ee650b50714e44e9","name":"GET_VOLUME","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"type\":\"GET_VOLUME\"}","payloadType":"json","x":300,"y":200,"wires":[["7e5bfb8fa4c126e8"]]},{"id":"c19ca1604a229ffa","type":"inject","z":"ee650b50714e44e9","name":"MUTE","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"type\":\"MUTE\"}","payloadType":"json","x":330,"y":260,"wires":[["7e5bfb8fa4c126e8"]]},{"id":"ff049222e4b05c89","type":"inject","z":"ee650b50714e44e9","name":"VOLUME 50%","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"type\":\"VOLUME\",\"volume\":\"50\"}","payloadType":"json","x":300,"y":320,"wires":[["7e5bfb8fa4c126e8"]]},{"id":"56d1cbd9c2798510","type":"inject","z":"ee650b50714e44e9","name":"STOP","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"type\":\"STOP\"}","payloadType":"json","x":330,"y":380,"wires":[["7e5bfb8fa4c126e8"]]},{"id":"8bb43659cf392ff6","type":"inject","z":"ee650b50714e44e9","name":"SEEK","props":[{"p":"payload"},{"p":"port","v":"8009","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"type\":\"SEEK\",\"time\":100}","payloadType":"json","x":330,"y":440,"wires":[["7e5bfb8fa4c126e8"]]},{"id":"adfae184dee17e71","type":"inject","z":"ee650b50714e44e9","name":"DefaultMediaReceiver test.mp3","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"app\":\"DefaultMediaReceiver\",\"type\":\"MEDIA\",\"media\":{\"url\":\"http://test.com/media.mp3\",\"contentType\":\"audio/mp3\",\"streamType\":\"BUFFERED\",\"metadata\":{\"title\":\"Song Name\"}}}","payloadType":"json","x":250,"y":500,"wires":[["7e5bfb8fa4c126e8"]]},{"id":"919e0da9ee0596ee","type":"inject","z":"ee650b50714e44e9","name":"TTS","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"app\":\"DefaultMediaReceiver\",\"type\":\"TTS\",\"text\":\"Something to say\",\"speed\":\"1\",\"language\":\"en\",\"metadata\":{\"title\":\"Media title\"}}","payloadType":"json","x":330,"y":560,"wires":[["7e5bfb8fa4c126e8"]]},{"id":"c612e62bbaf9208c","type":"inject","z":"ee650b50714e44e9","name":"DashCast","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"app\":\"DashCast\",\"type\":\"LOAD\",\"url\":\"http://www.google.com\",\"force\":\"true\",\"reload\":\"0\"}","payloadType":"json","x":320,"y":620,"wires":[["7e5bfb8fa4c126e8"]]},{"id":"6ca703c9a6b880e4","type":"inject","z":"ee650b50714e44e9","name":"YouTube","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"app\":\"YouTube\",\"type\":\"MEDIA\",\"videoId\":\"VideoIdFromYoutube\"}","payloadType":"json","x":320,"y":680,"wires":[[]]}]

And the media example looks like this

MEDIA Example

Loads media for YouTube.

{
  payload: {
    app: "YouTube",
    type: "MEDIA",
    videoId: "VideoIdFromYouTube"
  }
}
i8beef commented 6 months ago

Correct, its just the ID of the video, and no, it doesn't take any other parameters at this time. I think that was a holdover from the old cast node that I tried to replicate here to be familiar for some people. There actually is an example on the bottom of the README page here. What would make that example more clear for you? Just an explanation of where that ID comes from?

guyluz11 commented 6 months ago

In the example flow just insert some ID, that will be good :)

i8beef commented 6 months ago

Done.

guyluz11 commented 6 months ago

@i8beef I am building a project that requires this functionality in dart programming language which similar to JavaScript in the syntax. The basic casting logic is already working but I am missing DashCast, TTS, YouTub (especially the YouTube). Here is the current package code https://github.com/guyluz11/flutter_cast/tree/multicast_version multicast_version branch is my latest.

Will you be willing to work on it for a fee?

i8beef commented 6 months ago

Sorry my friend, I simply don't have the time to dedicate to such an effort right now. I'm not even the author of the original underlying library, and that's more the kind of person I would think you need. I will point out the original JS library isn't incredibly complicated, though it also isn't the most well organized and has some long standing bugs... I'd use it for inspiration, but not an example of how to implement if I were to rewrite it.

guyluz11 commented 6 months ago

Hmm bummer

I will take inspection from your YouTube controller, it need loungeToken which is little different from just casting https://github.com/i8beef/node-red-contrib-castv2/blob/master/lib/YouTubeController.js

I see on your profile that you are creating a lot of integrations to smart devices and I am creating smart home open source project so it catch my eyes. May I ask what are you working on?