Webpage plays simple sound

Hi guys,
Is there a way that a web page plays a simple sound (chimes, beep, something simmilar)? Small file that can be selected on the server. Thanks in advance.

https://documentation.xojo.com/api/user_interface/web/webaudioplayer.html#webaudioplayer

I read that, I just can not find a way lo load file to play. How do I set the file I want to play?

You set the URL property.

to get a URL, you load the sound file into a WebFile object on the server, storing that property somewhere (like on a page or in a module) and then get the url from that.

If it’ll be the same sound for all of your users, put the property in a module and set its Session property to Nil.

2 Likes

What for?

Remember that the xojo web framework dont have client side capabilities. This means that EVERY event has to make a round trip to the server. Playing a sound from a user generated event will have a really anoying delay making your app feel sluggish

We are talking about sound length 1-2 seconds, so we are talking 200 kilobytes at most, and it is quite nessesary. Event will happen at most once in about 5 minutes.

Thanks Greg, that was what I need.

1 Like