# Casting audio to google mini

**URL:** https://discourse.nodered.org/t/casting-audio-to-google-mini/36596
**Category:** General
**Created:** [26 November 2020 21:55 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596 "2020-11-26T21:55:00Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![SmokinSowbellies](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@SmokinSowbellies](https://discourse.nodered.org/u/SmokinSowbellies)
#### Post date: [26 November 2020 21:55 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/1 "2020-11-26T21:55:00Z")

</div>

I have been trying to set up a way to cast my weather. Everything works until I try to play any audio to a google mini. If I cast an audio from my web server, it all works, but nothing from the pi device, itself. I get the following in the debug panel:

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

Any help would be appreciated.

```auto
[{"id":"43091b5c.d97da4","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"a17b9ea9.6a949","type":"cast-to-client","z":"43091b5c.d97da4","name":"","url":"","contentType":"","message":"","language":"en","ip":"10.10.7.20","port":"8009","volume":"50","x":800,"y":140,"wires":[[]]},{"id":"24563bf6.d167e4","type":"inject","z":"43091b5c.d97da4","name":"Play","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":250,"y":140,"wires":[["3f5f4775.a5e218"]]},{"id":"3f5f4775.a5e218","type":"trigger","z":"43091b5c.d97da4","name":"tts + reset volume","op1":"{\"url\":\"http://10.10.7.6/home/mike/web/pi/tmp/wavenet_test.mp3\",\"contentType\":\"audio/mp3\",\"volume\":70}","op2":"{\"volume\":50}","op1type":"json","op2type":"json","duration":"7","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":540,"y":140,"wires":[["a17b9ea9.6a949"]]}]

```

---

<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: [26 November 2020 22:02 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/2 "2020-11-26T22:02:16Z")

</div>

I see you are sending `http://10.10.7.6/home/mike/web/pi/tmp/wavenet_test.mp3` to the device.

Can you verify this file is available at that URL by putting the URL in a browser?

Also, is this IP accessible to the cast device?

A good test would be to click this \>\> [http://10.10.7.6/home/mike/web/pi/tmp/wavenet\_test.mp3](http://10.10.7.6/home/mike/web/pi/tmp/wavenet_test.mp3) \<\< on your phone or a tablet on the same SSID as the google cast device to verify is URL is accessible across your wifi.

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [26 November 2020 22:05 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/3 "2020-11-26T22:05:55Z")

</div>

You can also test the rest of the flow by replacing `"url":"http://10.10.7.6/home/mike/web/pi/tmp/wavenet_test.mp3`

with

`"url": "http://www.orangefreesounds.com/wp-content/uploads/2018/11/Ding-dong-doorbell-rings.mp3",`

and see if it works

---

<div class="post-metadata">

### Author: ![SmokinSowbellies](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@SmokinSowbellies](https://discourse.nodered.org/u/SmokinSowbellies)
#### Post date: [26 November 2020 23:38 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/4 "2020-11-26T23:38:45Z")

</div>

10.10.7.6 is the pi that node-red is also on. I changed the permissions to 777 on the mp3 file just in case. My webserver is not local, but on a hosted machine. I tried the url above for the doorbells, and they work. The 10.10.7.6 from the statement above doe not. I have tried to place the mp3 file in different locations, from root /tmp , /data , home/pi/tmp , and others.  
When I try to use a browser to get to [http://10.10.7.6/home/mike/web/pi/tmp/wavenet\_test.mp3](http://10.10.7.6/home/mike/web/pi/tmp/wavenet_test.mp3) , it shows not found. It's funny I can write an mp3 file to the system, but cannot read it

---

<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: [26 November 2020 23:55 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/5 "2020-11-26T23:55:19Z")

</div>

Do you have a web server running on port 80 hosting the file?

You do know you cannot just access via http without a web server right?

You can however, present the file via a http endpoint in node-red.

---

<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: [26 November 2020 23:58 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/6 "2020-11-26T23:58:23Z")

</div>

try this

> [@How to cast videos](https://discourse.nodered.org/t/how-to-cast-videos/25039/19):
>
> 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] [{"id":"d5a6dd33.a0e28","ty…

---

<div class="post-metadata">

### Author: ![SmokinSowbellies](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@SmokinSowbellies](https://discourse.nodered.org/u/SmokinSowbellies)
#### Post date: [27 November 2020 00:01 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/7 "2020-11-27T00:01:47Z")

</div>

Wellll, Something I never thought of. Time to remove the apache2 server. Thanks for all the help

---

<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: [27 November 2020 00:02 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/8 "2020-11-27T00:02:22Z")

</div>

Its really amazing what you can achieve with just node-red 🙂

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [27 November 2020 14:17 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/9 "2020-11-27T14:17:23Z")

</div>

You can also place the files in the http static folder of node-red, and the url would be `http://ip_of_node-red:1880/wavenet_test.mp3`

> **[Configuration : Node-RED](https://nodered.org/docs/user-guide/runtime/configuration)**

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [27 November 2020 14:46 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/10 "2020-11-27T14:46:46Z")

</div>

> [@E1cid](#):
>
> You can also place the files in the http static folder of node-red,

I assume that would only work if you have left your http endpoints unsecured.

---

<div class="post-metadata">

### Author: ![SmokinSowbellies](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@SmokinSowbellies](https://discourse.nodered.org/u/SmokinSowbellies)
#### Post date: [27 November 2020 18:43 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/11 "2020-11-27T18:43:12Z")

</div>

And there-in lies the problem. I uninstalled apache2, but it still does not allow for reading of the file. I can be saved, just not read. I think I'll reinstall the OS on the Pi and start again.

---

<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: [27 November 2020 18:57 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/12 "2020-11-27T18:57:08Z")

</div>

> [@SmokinSowbellies](#):
>
> I uninstalled apache2, but it still does not allow for reading of the file

what does that mean?

you dont need apache - did you try the solution I linked to?

---

<div class="post-metadata">

### Author: ![SmokinSowbellies](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@SmokinSowbellies](https://discourse.nodered.org/u/SmokinSowbellies)
#### Post date: [27 November 2020 19:34 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/13 "2020-11-27T19:34:51Z")

</div>

I have tried all the solution provided. I cannot list an file under the 10.10.7.6:1880, or any folder in the .node-red folder.  
I did something to foul this up. I added Peter Scargills' script a while back, and am starting to wonder if some setting, somewhere, has changed. I checked the settings.js, and all the settings are at default.

---

<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: [27 November 2020 19:42 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/14 "2020-11-27T19:42:02Z")

</div>

ok, follow this...

1. copy your mp3 to `~/.node-red` folder & name it `bell.mp3`
2. paste the below flow into node-red (ctrl+i)...  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/5/557e57e3fc79f650d5a1abe809c32a836e9ae9ea.png)

```auto
[{"id":"d5a6dd33.a0e28","type":"http in","z":"553814a2.1248ec","name":"","url":"/bell","method":"get","upload":false,"swaggerDoc":"","x":260,"y":1200,"wires":[["d59c8c4.b480d7","e7ed07e7.97da58"]]},{"id":"d59c8c4.b480d7","type":"file in","z":"553814a2.1248ec","name":"","filename":"bell.mp3","format":"","chunk":false,"sendError":false,"encoding":"none","x":500,"y":1200,"wires":[["87b9c5b8.526558","49056e53.5a32b"]]},{"id":"87b9c5b8.526558","type":"http response","z":"553814a2.1248ec","name":"","statusCode":"","headers":{"contentType":"audio/mp3"},"x":730,"y":1200,"wires":[]},{"id":"e7ed07e7.97da58","type":"debug","z":"553814a2.1248ec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":370,"y":1240,"wires":[]},{"id":"49056e53.5a32b","type":"debug","z":"553814a2.1248ec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":610,"y":1240,"wires":[]},{"id":"b72151a6.617e3","type":"cast-to-client","z":"553814a2.1248ec","name":"","url":"","contentType":"","message":"","language":"en","ip":"","port":"","volume":"","x":730,"y":1300,"wires":[[]]},{"id":"2dbcc2cc.94f80e","type":"inject","z":"553814a2.1248ec","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"ip\":\"10.10.7.20\",\"url\":\"http://10.10.7.6:1880/bell\",\"contentType\":\"audio/mp3\",\"volume\":50}","payloadType":"json","x":250,"y":1300,"wires":[["b72151a6.617e3"]]}]

```

1. Double click the `INJECT` node & set ip / url accordingly...  
e.g..

```auto
{
    "ip": "10.10.7.20",
    "url": "http://10.10.7.6:1880/bell",
    "contentType": "audio/mp3",
    "volume": 50
}

```

ip - this should be the ip of the google device  
url - this should be ip of your PI

if you follow the above correctly, you should get the mp3 by clicking this \>\> [http://10.10.7.6:1880/bell](http://10.10.7.6:1880/bell) \<\<

---

<div class="post-metadata">

### Author: ![SmokinSowbellies](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@SmokinSowbellies](https://discourse.nodered.org/u/SmokinSowbellies)
#### Post date: [27 November 2020 20:01 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/15 "2020-11-27T20:01:09Z")

</div>

Same error:  
Error: ENOENT: no such file or directory, open 'bell.mp3'

---

<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: [27 November 2020 20:34 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/16 "2020-11-27T20:34:45Z")

</div>

> [@SmokinSowbellies](#):
>
> ENOENT means `Error NO ENTity` this means the file is not being found.

You must not have the file in the right place.

Can you list your directory...

```auto
cd ~/.node-red
ls

```

---

<div class="post-metadata">

### Author: ![SmokinSowbellies](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@SmokinSowbellies](https://discourse.nodered.org/u/SmokinSowbellies)
#### Post date: [27 November 2020 20:45 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/17 "2020-11-27T20:45:45Z")

</div>

![ls](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/e/8ea0743ff2487af5b72035c04eebf70ae418b4ed.jpeg)  
changed settings.js to force userDir: /home/mike/.node-red just in case

---

<div class="post-metadata">

### Author: ![puncardteg](https://avatars.discourse-cdn.com/v4/letter/p/8797f3/32.png) [@puncardteg](https://discourse.nodered.org/u/puncardteg)
#### Post date: [2 December 2020 19:52 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/18 "2020-12-02T19:52:02Z")

</div>

You must not have the file in the right place

---

<div class="post-metadata">

### Author: ![SmokinSowbellies](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@SmokinSowbellies](https://discourse.nodered.org/u/SmokinSowbellies)
#### Post date: [2 December 2020 23:44 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/19 "2020-12-02T23:44:41Z")

</div>

I re-built the pi, with only node-red and a web server. With the mp3 files under /var/www/html/ directory, I can access those audio files

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [31 January 2021 23:44 UTC](https://discourse.nodered.org/t/casting-audio-to-google-mini/36596/20 "2021-01-31T23:44:43Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
