# 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:** 2

<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:45 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/21 "2020-04-22T14:45:22Z")

</div>

Awesome,thanks for sharing . This really helps !

---

<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 19:12 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/22 "2020-04-22T19:12:46Z")

</div>

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

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

```

---

<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:** [23 April 2020 18:22 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/23 "2020-04-23T18:22:41Z")

</div>

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

```auto
http_node:
  username: ''
  password: ''

```

---

<div class="post-metadata">

**Author:** ![sarfer00](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@sarfer00](https://discourse.nodered.org/u/sarfer00)\
**Post date:** [25 May 2020 19:02 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/24 "2020-05-25T19:02:39Z")

</div>

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 !

---

<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:** [25 May 2020 19:25 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/25 "2020-05-25T19:25:15Z")

</div>

You can add / delete the http credentials from configuration settings

---

<div class="post-metadata">

**Author:** ![sarfer00](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@sarfer00](https://discourse.nodered.org/u/sarfer00)\
**Post date:** [25 May 2020 19:33 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/26 "2020-05-25T19:33:40Z")

</div>

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.

---

<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:** [25 May 2020 19:43 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/27 "2020-05-25T19:43:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sarfer00](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@sarfer00](https://discourse.nodered.org/u/sarfer00)\
**Post date:** [25 May 2020 20:11 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/28 "2020-05-25T20:11:47Z")

</div>

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

---

<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:** [25 May 2020 21:00 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/29 "2020-05-25T21:00:54Z")

</div>

Did you try the flow from above marked as [the solution](https://discourse.nodered.org/t/how-to-cast-videos/25039/19)?

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.

---

<div class="post-metadata">

**Author:** ![sarfer00](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@sarfer00](https://discourse.nodered.org/u/sarfer00)\
**Post date:** [26 May 2020 08:04 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/30 "2020-05-26T08:04:06Z")

</div>

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:

```auto
[{"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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/4/5446f2b1bb7f1ce68ea9ae2933dc56ecfa0864f1.jpeg)

Also I can play the video from browser with [http://127.0.0.1:1880/myVideo](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

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [26 May 2020 08:22 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/31 "2020-05-26T08:22:19Z")

</div>

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.

> **[node-red-contrib-cast](https://flows.nodered.org/node/node-red-contrib-cast)**
>
> NodeRED nodes to for Chromecast and Google Home

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 May 2020 08:49 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/32 "2020-05-26T08:49:05Z")

</div>

> [@sarfer00](#):
>
> the real video I want to cast is 5GB

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

---

<div class="post-metadata">

**Author:** ![sarfer00](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@sarfer00](https://discourse.nodered.org/u/sarfer00)\
**Post date:** [26 May 2020 09:01 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/33 "2020-05-26T09:01:19Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![sarfer00](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@sarfer00](https://discourse.nodered.org/u/sarfer00)\
**Post date:** [26 May 2020 18:29 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/34 "2020-05-26T18:29:27Z")

</div>

Hi,  
I've made it work. The error was the url of the video to cast, I was using 127.0.0.1.... instead of the ip of my PC.

But it works with a small mp4 video (1780KB). The video I need to cast is (5.300.000KB). The codec of both videos are the same, so .. I don't understadn why it works for one video and not for the another. Somebody can help me ?

Thanks

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [27 May 2020 03:28 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/35 "2020-05-27T03:28:03Z")

</div>

> [@sarfer00](#):
>
> the real video I want to cast is 5GB, and with this video I CAN'T play it from browser

Could your problem be due to this? I think, you need to figure this out first. Could the video file be damaged? Anyway, figure this out first

---

<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:** [27 May 2020 12:02 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/36 "2020-05-27T12:02:23Z")

</div>

Few things to check

Network bandwidth  
Resolution of the video  
Storage where the video file resides  
Speed of read-MB/sec

---

<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:** [27 May 2020 22:14 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/37 "2020-05-27T22:14:00Z")

</div>

I don't know how this node works and I haven't checked how the flow is configured, but often files are set to read the whole file before passing to the next node..if that is the case here then you will need at least 5gb of memory available for the file to be read into before it can be passed on.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 May 2020 06:26 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/38 "2020-05-28T06:26:00Z")

</div>

My understanding with casting is that the node should not need to access the file at all, but should just tell the Google device which url to play. I may need to be corrected though.

---

<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:** [28 May 2020 06:31 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/39 "2020-05-28T06:31:54Z")

</div>

That is mostly correct however this solution was originally to get small audio files from local file system and was achieved without modifying settings.is to expose a public folder.

So the solution simply created an endpoint and provided the file by loading it (file node) and sending it to the http out node upon request.

The op probably needs to go the other way and modify settings.js to expose a public folder to avoid the need for loading such a large file.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 May 2020 08:20 UTC](https://discourse.nodered.org/t/how-to-cast-videos/25039/40 "2020-05-28T08:20:34Z")

</div>

> [@Steve-Mcl](#):
>
> So the solution simply created an endpoint and provided the file by loading it (file node) and sending it to the http out node upon request.

OK, I had forgotten or missed that, so it may well be that part that is failing with a massive file, rather than the cast itself.

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

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