How to cast videos

Well if the File node says it can't find the file, then it can't find the file.

Just to double check, you have the file in /tmp/alavp.mp3 on the machine running Node-RED and not the device you are using to access the editor (in case they are different).

Yes the file exists on the server where nod-red is running

Then potentially the account that runs node-red doesn't have access to that file. Try checking & if necessary adjusting the MP3 files permissions

Yeah I changed he permissions but no avail . I am checking from the home-assistant side now .May be there could be some configs on that I missed .

Since you are running Home Assistant, you might want to look into I did it, I defeated the horrible Google Home cast start prompt sound. I have not found a way to not get the annoying sound with any of the cast nodes in NR.

I'm not certain what home-assistant has to do with this?

I cant imagine what setting up a URL to host an MP3 has to do with anything outside of node-red.

The first test in my mind is - can you access the MP3 in your browser? If you cant, then there is no way the cast device is gonna.

On the same machine where node-red is running, what happens if you point your browser at http://localhost:1880/endpoint/alavp ?
do you get anything?

PS - it works for me...
image

[{"id":"d5a6dd33.a0e28","type":"http in","z":"c70ba4a4.e7fb58","name":"","url":"/endpoint/alavp","method":"get","upload":false,"swaggerDoc":"","x":110,"y":120,"wires":[["d59c8c4.b480d7","e7ed07e7.97da58"]]},{"id":"d59c8c4.b480d7","type":"file in","z":"c70ba4a4.e7fb58","name":"","filename":"alavp.mp3","format":"","chunk":false,"sendError":false,"encoding":"none","x":180,"y":160,"wires":[["87b9c5b8.526558","49056e53.5a32b"]]},{"id":"87b9c5b8.526558","type":"http response","z":"c70ba4a4.e7fb58","name":"","statusCode":"","headers":{"contentType":"audio/mp3"},"x":360,"y":160,"wires":[]},{"id":"e7ed07e7.97da58","type":"debug","z":"c70ba4a4.e7fb58","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":320,"y":80,"wires":[]},{"id":"49056e53.5a32b","type":"debug","z":"c70ba4a4.e7fb58","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":340,"y":120,"wires":[]},{"id":"b72151a6.617e3","type":"cast-to-client","z":"c70ba4a4.e7fb58","name":"","url":null,"contentType":"","message":null,"language":"en","ip":"","port":"","volume":null,"x":360,"y":220,"wires":[[]]},{"id":"2dbcc2cc.94f80e","type":"inject","z":"c70ba4a4.e7fb58","name":"","topic":"","payload":"{\"ip\":\"192.168.0.55\",\"url\":\"http://192.168.0.81:1880/endpoint/alavp\",\"contentType\":\"audio/mp3\",\"volume\":50}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":80,"y":220,"wires":[["b72151a6.617e3"]]}]

NOTES:

  • put an MP3 called alavp.mp3 in the .node-red folder (or adjust the path of the file in node)
  • change the 2 IP addresses in the inject node
    • change "ip" to your cast device IP
    • change "url" to your node-red PC IP
1 Like

I have used /share in home assistant to save the mp3 file and that worked . Node red cannot read files from /tmp in home assistant . I appreciate your response and thanks for your time .

Awesome,thanks for sharing . This really helps !

UPDATE: After placing the file in /share , I was able to play the file from browser @ http://192.168.XX.XX:1880/endpoint/alavp. However the cast node is unable to play . Still getting this error

"Not able to load media:Load failed Not able to load the media."

UPDATE : Removed username/pass from the node-red configs and it works now .

http_node:
  username: ''
  password: ''

Hello.
I'm trying to cast a local video to Chromecast through Node Red with "node-red-contrib-cast" (OS Win10). The problem is that I get the following error "Not able to load media:Load failed Not able to load the media."
I've read all the posts but I haven't resolved the error. For example, this update of @Auto101 "Removed username/pass from the node-red configs and it works now" Where I can find this option to change it?
Thanks !

You can add / delete the http credentials from configuration settings

If you refer in http node, I don't have any credentials configurated.

Is it possible that the problem is where I've stored the video .mp4 I want to stream? Where I should locate the .mp4 video to allow Node-Red serve it?

Thanks.

I was referring to the configuration settings from node-red .

Pls refer to Steve’s response from April 22. You can import that flow and make modifications as needed.

Hi @Steve-Mcl
I'm trying to cast a local video to Chromecast through Node Red with "node-red-contrib-cast" (OS Win10). The problem is that I get the following error "Not able to load media:Load failed Not able to load the media."
I'v read all the posts, but I can't fix it. Could you help me, please?

Thanks

Did you try the flow from above marked as the solution?

Did you read the thread? There are lots of helpful notes that could potentially solve this.

Show us your flow and debug message showing this error and any other debug node outputs showing the file name etc.

Yes, I've tried that flow and not works for me, besides that I want to cast a .mp4 video not audio. I also read all the thread, but I can't make it work.

This is my flow:

[{"id":"e2b4811b.1cd0e","type":"cast-to-client","z":"948b0244.fb211","name":"","url":"","contentType":"video/mp4","message":"","language":"de","ip":"","port":"","volume":"","x":530,"y":480,"wires":[["76a8afb7.13159"]]},{"id":"76a8afb7.13159","type":"debug","z":"948b0244.fb211","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":690,"y":480,"wires":[]},{"id":"4e34322.f96becc","type":"http in","z":"948b0244.fb211","name":"","url":"/myVideo","method":"get","upload":false,"swaggerDoc":"","x":210,"y":420,"wires":[["ed25f4b3.55e2f8","e6fc7dd4.e375c"]]},{"id":"b0676984.a910f8","type":"http response","z":"948b0244.fb211","name":"","statusCode":"","headers":{"content-type":"video/mp4"},"x":610,"y":420,"wires":[]},{"id":"ed25f4b3.55e2f8","type":"file in","z":"948b0244.fb211","name":"UnderWater.mp4","filename":"C:\\Users\\David y Sara\\.node-red\\underWater.mp4","format":"","chunk":false,"sendError":false,"x":430,"y":420,"wires":[["b0676984.a910f8","a4921095.b5c51"]]},{"id":"46341e37.a7271","type":"inject","z":"948b0244.fb211","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":480,"wires":[["a80b5206.8dcee"]]},{"id":"a80b5206.8dcee","type":"change","z":"948b0244.fb211","name":"","rules":[{"t":"set","p":"ip","pt":"msg","to":"192.168.0.50","tot":"str"},{"t":"set","p":"url","pt":"msg","to":"/myVideo","tot":"str"},{"t":"set","p":"contentType","pt":"msg","to":"video/mp4","tot":"str"},{"t":"set","p":"streamType","pt":"msg","to":"BUFFERED","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":480,"wires":[["e2b4811b.1cd0e"]]},{"id":"a4921095.b5c51","type":"debug","z":"948b0244.fb211","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":630,"y":360,"wires":[]},{"id":"e6fc7dd4.e375c","type":"debug","z":"948b0244.fb211","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":390,"y":360,"wires":[]}]

And this is the debug node outputs:
Captura

Also I can play the video from browser with http://127.0.0.1:1880/myVideo but I have another problem: this is a test video (1780KB) because the real video I want to cast is 5GB, and with this video I CAN'T play it from browser, I don't know why.

Finally say that my chromecast works fine: I've send a YouTube video from Node-Red with "node-red-contrib-cast" and works perfectly. The problem is with local files.

I am very thankfull for your help

If you read through the Example - Play local files (for the cast node) it explains how to do it.
There is also a demo NR flow which should help.

Is that of the same video type as the one that works? Check the codec.

@dynamicdave I already read all the Example - Play local files and I've used the demo flow. But it doesn't work for me. In the example uses a audio mp3 file and I need video mp4 file.

@Colin The codec is the same: H263 - MPEG-4 AVC (part10) (avc1)

Thanks