Playing audio in uibuilder

Hello everyone,

First, sorry for my english which is not my native language !

I'm trying to create a "Control Center" for an Escape Game Room.
One of the issue I have is that I try to make an audio file (.mp3) playing when the timer is running.
Actually, I'm using "read file" and "audio out". But I think it would be better if the sound is playing in the uibuilder (that will be displayed in the room). But I don't know how it could be possible.
I think it would be better because if I refresh the dashboard page, the sound wouldn't stop in the room.

Any suggestion ?

I hope my message is understandable !

Have a great day !

Hi and welcome to the forum.

I assume that you are running Node-RED on a Pi in the room? Is that what you want to use to play the sound?

Obviously uibuilder front-end's run in the browser so you would have to transfer a file from the server to the browser or create a stream that the browser can access.

If you want to play the sound on the Pi, there are a number of nodes that may help: Library - Node-RED (

Thanks ! And also thanks for the reply.

At the moment, I'm running Node-Red on windows, and I display the uibuilder browser page on the screen in the room with an HDMI cable !

I'll try to check that nodes library, thanks.

No problem.

So similar then except that you are using Windows rather than Linux as the base OS. And in your case both the server and the client are on the same device. Still, the same principle applies.

If the nodes don't work on Windows, you could always try to find a command-line player and use the exec node.

Can you check the browser dev tools console for errors or warnings?

Also, when you use a relative path, what path are you using and where have you put the file? Remember that the browser needs to use HTTP(S) to get the file, you can't simply use a local file reference (e.g. \\\folder\file.mp3) because that won't be allowed by the browser for security reasons. To deliver via HTTP needs a server so you need to put the file somewhere that a web server can deliver it. Either in a suitable uibuilder served folder or using the static folder for Node-RED.

Can you share the HTML tag you are using to play the loop? Also, does that require a library?

In my uibuilder node, in index.html I'm using this HTML tag
<audio ref="audioRef" src="" id="audio-player" loop="true" muted="muted" autoplay></audio>
In index.js, I used that :

var app = new Vue({
	el: '#app',
	data: {
		msg: '[No Message Received Yet]',

	mounted: function() {
		var vueApp = this;
		uibuilder.onChange('msg', function(msg) {
			vueApp.msg = msg;
			if (vueApp.$refs.audioRef.src != msg.audioSrc){
			    vueApp.$refs.audioRef.src = msg.audioSrc;

And, in a function node that is "looped", when I click on a button, this happens :
msg.audioSrc = "http://localhost:1880/Capone/bandesonCapone.mp3";
This works well, and the mp3 file starts and continues until the end (it lasts 1 hour and 3 minutes).

But when I replace "http://localhost:1880/Capone/bandesonCapone.mp3" by "../Capone/bandesonCapone.mp3", the mp3 starts, and after one second starts again from the beginning, and again and again... And the path is the only change I make...

I can't get your method to work at all in either Edge or Firefox.

I think that you need to use the Audio() function in JavaScript to get what you want.

Audio() - Web APIs | MDN (
Playing audio files with Vue.js (

Ah, and also note that browsers won't play unless the user has interacted with the document!

Ok thanks, I'll read that !

Don't worry, it's to create an Escape Room Center Control. The UIBuilder with the sound is on the screen of the room, so I'll interact with it before the game.

Thanks a lot :slight_smile:

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