Good morning everyone,
I have created a test web app with web sockets that will play a sound in given events with this sub in the script section of the webapp in index.html :
I have tested it with this code in the given event:
It worked perfectly but when I moved the sound in a subfolder named "sounds" in the "www" directory I was not able to play it successfully with this code:
Further more when I tried everything I knew to make it work and I did not succeed I took the wav file and moved it back in the "www" directory and deleted the "sounds" subdirectory.
I have changed the code again to:
Even though I have done this it does not play any sound at all still and I cannot understand why.
Can anyone help?
I have created a test web app with web sockets that will play a sound in given events with this sub in the script section of the webapp in index.html :
Sound in Web App:
function playSound(url) {
const audio = new Audio(url);
audio.play();
};
I have tested it with this code in the given event:
B4X:
ws.RunFunction("playSound", Array As String("ding.wav"))
It worked perfectly but when I moved the sound in a subfolder named "sounds" in the "www" directory I was not able to play it successfully with this code:
B4X:
ws.RunFunction("playSound", Array As String("sounds/ding.wav"))
Further more when I tried everything I knew to make it work and I did not succeed I took the wav file and moved it back in the "www" directory and deleted the "sounds" subdirectory.
I have changed the code again to:
B4X:
ws.RunFunction("playSound", Array As String("ding.wav"))
Even though I have done this it does not play any sound at all still and I cannot understand why.
Can anyone help?
Last edited: