Play sound in linux

Hi,

I was trying to play sound from mp3 file,

dim f As FolderItem = getfolderitem("01-siren.mp3")
If f <> Nil And f.Exists Then
Try
f.launch
Catch error As IOException
MsgBox("The sound file could not be opened. Error: " + error.Message)
End Try
End If

this is work on windows, but not in linux.

is there any other solution for play sound than using folderitem?.

any helps?

thanks
arief

Launching a sound file doesn’t guarantee what will happen with the file. It simply opens the file, in the same way as would happen if you opened it in the file explorer. That could do anything from adding it to a music library, playing it or even opening it for editing.

Take a look at the Sound class to open and play sound files.
https://documentation.xojo.com/api/os/sound.html#sound

1 Like