Is there an API to play audio using compose deskto...
# compose-desktop
m
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
Nothing specific to Compose. I think you would just play audio as you would in a normal java application.
👍 1
m
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)
👍 2
p
where should be placed the audio file to be readed like that?
506 Views