Play sound in Retool!

Hey folks, we just launched a utils.playSound() API. You can demo it with this code:

utils.playSound('https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/success.mp3')

Thanks!

Feel free to post feedback here.

10 Likes

Any sites where these sounds can be accessed royalty free?

I honestly did my fair share of digging attempting to find a royalty free library that provides links to an MP3, but unfortunately no luck :smiling_face_with_tear:. Probably the easiest thing to do here would probably to sign up for a free cloud-storage that supports uploading MP3 files and grab the public link. I've had success with Cloudinary for projects in the past: Audio Transformations | Cloudinary

2 Likes

@Kenny Can this be used for a file stored locally on an android device?

Is this function available in a self-hosted Retool instance? When I try to use it I'm getting a "is not a function" error in the console.

Hasn't made it to a Stable release yet, but it should be in Edge releases 3.50, 3.52. What are you running?

Gotcha, that makes sense. We're running 3.33.26

Is it possible to point the file source to be dynamic? I uploaded a CSV into Retool Storage, and an each item/row has an item and a column with a weblink to audio. I want to create a button in a detail view (on Mobile App) of an inventory view that actions the utils.playSound() and draw the link from the relevant item item.

if we wanted to add like 'default_audio_mode' w 'mute' to users should this preferably be done as a user attribute or is storing it separately in like our own 'user_settings' table the more common and/or secure solution?