on Play Sound wav file 404 error occurs

Hi,


I need to play a sound alert on certain condition.

For this I have loaded a Resources.WindowsNotifyEmail_wav file in the resources folder.

Deploy action : Deploy to Target Directory.

Then in outsystems I have added HTTPRequestHandler RunJavascript server action and calling the  following action.

"$(this).click(function(){

   var snd = new  Audio('Resources.WindowsNotifyEmail_wav.Content');  
    snd.play();
});"


I am getting the following error :
Failed to load resource: the server responded with a status of 404 ()
ContactCentre.aspx:1 Uncaught (in promise) DOMException

Trying to figure out why the sound file is not loading.


Thanks and Regards,

Ramya S

Hi Ramya,

Please try following code in your javascript, it should work.

"$(this).click(function(){
    var snd = new Audio('piano2.wav');  
    snd.play();
});"

Here, piano2.wav is the file which I used as my audio file in Resource folder.


And following is Button OnClick Action where I have my Javascript code. 



If you are using dynamic file names, then you can pass it using expression.

Thanks & Regards,