This PR implements a component for triggering sound effects in the user's browser
Implementation
The UI component itself SoundEffect.sound_effect/1 is a simple button which toggles the user preference for sound effects. The SoundEffect module also exposes a play_sound/1 function, which can be called from the parent Liveview to trigger sounds to be played in a user's browser purely from Elixir land!
Outside of the scope of Bloom, but I'm imagining this component to be hooked up to the consuming app's PubSub system, so this LiveComponent can ping sound effects for users when backend events take place.
[!Note]
Storybook does not allow for custom :live_views, so the triggering of sound effects is somewhat limited. You can see that it works by toggling the button itself - the pop.mp3 file will play/
Changes
This PR implements a component for triggering sound effects in the user's browser
Implementation
The UI component itself
SoundEffect.sound_effect/1
is a simple button which toggles the user preference for sound effects. TheSoundEffect
module also exposes aplay_sound/1
function, which can be called from the parent Liveview to trigger sounds to be played in a user's browser purely from Elixir land!Outside of the scope of Bloom, but I'm imagining this component to be hooked up to the consuming app's PubSub system, so this LiveComponent can ping sound effects for users when backend events take place.