Is there an API to play audio using compose desktop? I got an mp3 file that I'd like to play on the background when a button click occurs.
j
jim
04/12/2021, 3:00 AM
Nothing specific to Compose. I think you would just play audio as you would in a normal java application.
👍 1
m
moz
04/12/2021, 3:03 AM
Oh okay. Anyway, I got it to work now using:
val audioInputStream = AudioSystem.getAudioInputStream(Thread.currentThread().contextClassLoader.getResource("starwars.wav"))
val clip = AudioSystem.getClip()
clip.open(audioInputStream)
clip.loop(Clip.LOOP_CONTINUOUSLY)