How would I go about playing a sound (when a butto...
# compose-web
y
How would I go about playing a sound (when a button is clicked for example) with compose wasm? Is there an example somewhere?
a
If you can access the browser apis you can use Audio API
z
It's very simple,
Copy code
Button(
    onClick = {
        Audio("<https://www.soundjay.com/buttons/beep-01a.wav>").play()
    }
) {
    Text("Hi")
}
y
Thank you @zt. Would you know how to use a sound that would be bundled with the app (as a resource)?
t
@zt Unable to resolve “Audio”. Any dependency I need to add?