So i think you are mixing up a few things. for example, your inject is sending a https
URL and an endpoint of node-red:1880/audio/test.mp3
but your endpoint is clearly node-red:1880/endpoint/audio
etc.
For the sake of getting this resolved, I'll jump ahead to the final solution.
follow the COMMENTS and adjust the names to suit.
[{"id":"f31a598d.9fd2c8","type":"function","z":"01a5fce4debb676d","name":"Set base path","func":"//restrict to c:\\temp\\\nvar basePath = \"c:\\\\temp\\\\\"; // << update this to \"/config/node-red/audio/\"\nvar filename = msg.req.params.filename;\n\n\nif(!filename.toLowerCase().endsWith(\".mp3\")){\n msg.payload = \"Only mp3 files are permitted\";\n msg.statusCode = 405;//not allowed\n return [null, msg];//fire output 2\n} else if(filename.includes(\"..\\\\\")){\n msg.payload = \"Illegal file path\";\n msg.statusCode = 405;//not allowed\n return [null, msg];//fire output 2\n} else if(filename.includes(\"../\")){\n msg.payload = \"Illegal file path\";\n msg.statusCode = 405;//not allowed\n return [null, msg];//fire output 2\n} \n//TODO: add more checks\n\nmsg.filename = basePath + filename;\nreturn [msg, null];//fire output 1\n\n\n","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1000,"y":560,"wires":[["34dc99e5.495466"],["98261154.3006","7b839e9487429e18"]]},{"id":"98261154.3006","type":"http response","z":"01a5fce4debb676d","name":"","statusCode":"","headers":{},"x":1370,"y":600,"wires":[]},{"id":"34dc99e5.495466","type":"file in","z":"01a5fce4debb676d","name":"","filename":"","format":"","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":1200,"y":520,"wires":[["98261154.3006","dd8ab131477e6684"]]},{"id":"38d65d59.1d8aa2","type":"catch","z":"01a5fce4debb676d","name":"","scope":null,"uncaught":false,"x":820,"y":660,"wires":[["3b8014a.86ad8ec","5b18a8e7.fb8da8"]]},{"id":"3b8014a.86ad8ec","type":"function","z":"01a5fce4debb676d","name":"Set 404","func":"msg.payload = msg.error;\nmsg.statusCode = 404;//resource not found\nreturn msg;","outputs":1,"noerr":0,"x":1200,"y":660,"wires":[["98261154.3006"]]},{"id":"5b18a8e7.fb8da8","type":"debug","z":"01a5fce4debb676d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":850,"y":700,"wires":[]},{"id":"5de7cbb4.fa21a4","type":"comment","z":"01a5fce4debb676d","name":"Create endpoint http://node-red-ip:port/audio/xxx \\n where xxx is the file name to load","info":"","x":880,"y":516,"wires":[]},{"id":"b889a077e5d2e332","type":"http in","z":"01a5fce4debb676d","name":"","url":"/audio/:filename","method":"get","upload":false,"swaggerDoc":"","x":790,"y":560,"wires":[["f31a598d.9fd2c8","bcde1b6c9f0e8883"]]},{"id":"7eaa537bd18a5b65","type":"cast-to-client","z":"01a5fce4debb676d","name":"","url":"","contentType":"","message":"","language":"en","ip":"","port":"8009","volume":"50","x":1110,"y":760,"wires":[["d1a46dea9a5ba36a"]]},{"id":"93a5e2fcc495bd5e","type":"inject","z":"01a5fce4debb676d","name":"test.mp3 (open & edit ip and url)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"ip\":\"192.168.1.19\",\"url\":\"http://192.168.1.32:1880/audio/test.mp3\",\"contentType\":\"audio/mp3\",\"volume\":70}","payloadType":"json","x":850,"y":760,"wires":[["7eaa537bd18a5b65"]]},{"id":"d1a46dea9a5ba36a","type":"debug","z":"01a5fce4debb676d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1290,"y":760,"wires":[]},{"id":"23cd7569e4e894cd","type":"comment","z":"01a5fce4debb676d","name":"Set \"IP\" to cast device IP \\n Set \"url\" to your node-red PC IP e.g. 192.168.0.2","info":"","x":877,"y":846,"wires":[]},{"id":"a05859d36ec523b6","type":"inject","z":"01a5fce4debb676d","name":"test2.mp3 (open & edit ip and url)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"ip\":\"192.168.1.19\",\"url\":\"http://192.168.1.32:1880/audio/test2.mp3\",\"contentType\":\"audio/mp3\",\"volume\":70}","payloadType":"json","x":850,"y":800,"wires":[["7eaa537bd18a5b65"]]},{"id":"bcde1b6c9f0e8883","type":"debug","z":"01a5fce4debb676d","name":"req.params.filename","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"msg.req.params.filename","targetType":"msg","statusVal":"msg.req.params.filename","statusType":"auto","x":880,"y":600,"wires":[]},{"id":"dd8ab131477e6684","type":"debug","z":"01a5fce4debb676d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1370,"y":520,"wires":[]},{"id":"7b839e9487429e18","type":"debug","z":"01a5fce4debb676d","name":"bad request","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1110,"y":600,"wires":[]},{"id":"c4c7d9ec3e3a6eeb","type":"comment","z":"01a5fce4debb676d","name":"This demo expects the files test.mp3 & test2.mp3 \\n ... to be found in the base path (basepath set in function)","info":"","x":1080,"y":420,"wires":[]}]
- remove or disable other endpoints
- Import flow
- Read every comment & action them
- Update the base path in the "Set base path" function
- Update the inject nodes to match your PC IP and CAST IP