# How to cast videos

**URL:** <https://discourse.nodered.org/t/how-to-cast-videos/25039>\
**Category:** General\
**Created:** [17 April 2020 21:31 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039 "2020-04-17T21:31:41Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Auto101](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/auto101/32/20157_2.png) [@Auto101](https://discourse.nodered.org/u/Auto101)\
**Post date:** [17 April 2020 21:31 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/1 "2020-04-17T21:31:41Z")

</div>

HI ,

Is there a way to cast local / youtube videos in a node red flow ?

Thanks !

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [17 April 2020 21:33 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/2 "2020-04-17T21:33:13Z")

</div>

did you try the search option in this forum to look for cast ?  
or [flows.nodered.org](http://flows.nodered.org) for any flows and nodes ?

---

<div class="post-metadata">

**Author:** ![Auto101](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/auto101/32/20157_2.png) [@Auto101](https://discourse.nodered.org/u/Auto101)\
**Post date:** [17 April 2020 21:47 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/3 "2020-04-17T21:47:36Z")

</div>

Thanks for the response .I tried using "node-red-contrib-cast" . There is a sample flow in the documentation to play local files. When I import it , I"m missing a node .Not sure what that that is .

Here is a screenshot from example

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/a/9a2d978d157579a1a0891b64aecd9ee8fb111140.png)

Here is the screenshot when I import it  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/2/f2158684ac889860f28557d3837839af8ca0e6df.png)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [17 April 2020 23:08 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/4 "2020-04-17T23:08:07Z")

</div>

I'm guessing that is an amazon dash button... in which case it's just sending any msg you like in to trigger the next nodes - so just try replacing it with an inject sending a 1 or a "" string.

---

<div class="post-metadata">

**Author:** ![Auto101](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/auto101/32/20157_2.png) [@Auto101](https://discourse.nodered.org/u/Auto101)\
**Post date:** [18 April 2020 03:17 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/5 "2020-04-18T03:17:33Z")

</div>

I tried that and now I get this error . The flow is unable to load the media file .

Appreciate any help .

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/2/125cdf055705527448d529f18d59579ada43fca9.png)

Thanks !

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [18 April 2020 08:30 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/6 "2020-04-18T08:30:13Z")

</div>

You simply don't understand what's happening.

You should probably spend some time reading up on node red. Perhaps watch some videos.

Chromecast only plays media from a URL

The top line of this flow creates a URL

That URL serves a file (the brown node named "doorbell.mp3")

Do you have a file called doorbell.mp3 ?

Have you tested the endpoint (URL) [http://localhost:1880/endpoint/alavp](http://localhost:1880/endpoint/alavp)

Have you checked the cast node settings?

Perhaps the dash button was sending the URL to the cast node - you might need to mimic that.

---

<div class="post-metadata">

**Author:** ![Auto101](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/auto101/32/20157_2.png) [@Auto101](https://discourse.nodered.org/u/Auto101)\
**Post date:** [19 April 2020 01:14 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/7 "2020-04-19T01:14:12Z")

</div>

Sorry, I should have provided more details . The endpoint is not reachable . Error : Cannot get /alavp

The files exist and the cast configs are correct .

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 April 2020 01:16 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/8 "2020-04-19T01:16:48Z")

</div>

Put a debug node after the `get` and a 2nd debug node after the brown file node.

The 1st debug node will let you know if you anything is hitting the endpoint. The 2nd debug will tell you if the file is being found and loaded.

---

<div class="post-metadata">

**Author:** ![Auto101](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/auto101/32/20157_2.png) [@Auto101](https://discourse.nodered.org/u/Auto101)\
**Post date:** [19 April 2020 01:36 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/9 "2020-04-19T01:36:13Z")

</div>

Looks like nothing is hitting the end point .

When I click the inject , I can see that it can pass the signal to my cast device . But as the end point is not reachable ,it's unable to load the media .

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/7/0745e67417f49ccf8d6b07261f27d22de2efe833.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 April 2020 02:01 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/10 "2020-04-19T02:01:24Z")

</div>

What is the config of the cast node. Post a screen shot.

My guess is...

> [@Steve-Mcl](#):
>
> the dash button was sending the URL to the cast node - you might need to mimic that.

Ps...  
Don't send localhost to the Chromecast. It won't know where localhost is.

---

<div class="post-metadata">

**Author:** ![Auto101](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/auto101/32/20157_2.png) [@Auto101](https://discourse.nodered.org/u/Auto101)\
**Post date:** [19 April 2020 02:38 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/11 "2020-04-19T02:38:49Z")

</div>

I tried installing the dash button but the installation is failing . My node red is running on home assistant instance .The trigger node will send the message to the cast node . The cast node settings are empty.Note that I replaced my IP with XX for the screen shot purpose

--Screenshot of trigger node  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/1/c1fd5fe8aef651aaa46ca9a68427870477c0e5c6.png)

The below are being sent from trigger node . The ip here is the IP address of my cast device

```auto
{
    "ip": "192.168.XX.XX",
    "url": "http://192.168.XX.XX:1880/alavp",
    "contentType": "audio/mp3",
    "volume": 50
}

```

screenshot of cast node

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/7/07686a08ecaa4f43296a6503758e7beb64512887.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [19 April 2020 07:19 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/12 "2020-04-19T07:19:18Z")

</div>

The HTTP In node in your screenshot is configured with the path `/endpoint/alavp`. The URL you are passing in doesn't have the `/endpoint` part.

Remember you can test the URL directly in your browser without sending it to the cast node.

---

<div class="post-metadata">

**Author:** ![Auto101](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/auto101/32/20157_2.png) [@Auto101](https://discourse.nodered.org/u/Auto101)\
**Post date:** [19 April 2020 14:45 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/13 "2020-04-19T14:45:06Z")

</div>

Thanks for the response .I tried adding the /endpoint part in the URL and tested in browser but still can't get it .The debug from file node shows below message

```auto
"Error: ENOENT: no such file or directory, open '/tmp/alavp.mp3'"

```

The file physically exists in the /tmp directory. Am I missing any configs. here ?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [19 April 2020 15:24 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/14 "2020-04-19T15:24:28Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![Auto101](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/auto101/32/20157_2.png) [@Auto101](https://discourse.nodered.org/u/Auto101)\
**Post date:** [19 April 2020 22:00 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/15 "2020-04-19T22:00:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 April 2020 22:40 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/16 "2020-04-19T22:40:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Auto101](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/auto101/32/20157_2.png) [@Auto101](https://discourse.nodered.org/u/Auto101)\
**Post date:** [20 April 2020 00:12 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/17 "2020-04-20T00:12:42Z")

</div>

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 .

---

<div class="post-metadata">

**Author:** ![lsaranto](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lsaranto/32/16502_2.png) [@lsaranto](https://discourse.nodered.org/u/lsaranto)\
**Post date:** [22 April 2020 08:55 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/18 "2020-04-22T08:55:32Z")

</div>

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](https://community.home-assistant.io/t/i-did-it-i-defeated-the-horrible-google-home-cast-start-prompt-sound/36123). I have not found a way to not get the annoying sound with any of the cast nodes in NR.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 April 2020 09:41 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/19 "2020-04-22T09:41:31Z")

</div>

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](http://localhost:1880/endpoint/alavp) ?  
do you get anything?

PS - it works for me...  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/7/4733422448e5f7c86d1f9d7456a04c736102deb5.png)

```auto
[{"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

---

<div class="post-metadata">

**Author:** ![Auto101](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/auto101/32/20157_2.png) [@Auto101](https://discourse.nodered.org/u/Auto101)\
**Post date:** [22 April 2020 14:44 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/20 "2020-04-22T14:44:44Z")

</div>

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 .

[Next page](https://discourse.nodered.org/t/how-to-cast-videos/25039.md?page=2)
