@twoavy/audio-feedback
v0.0.2
Published
Vue plugin for audio playback
Downloads
4
Keywords
Readme
audio-feedback
Vue plugin for easy feedback sound playback
Installation
yarn add @twoavy/audio-feedback
Setup
import AudioFeedback from 'audio-feedback'
Vue.use(AudioFeedback, {
gain: 1, // global default gain
pan: 0, // global default pan
sounds: [
{ id: 'sound1', url: '/audio/click.wav' },
{ id: 'success', url: require('@/assets/audio/success_sound.wav') }, // load from assets directory
{ id: 'sound1', url: '/audio/click.wav', gain: 0.5, pan: 0.75 } // individual gain and pan settings
]
})
Usage
// in Vue component
this.$sound.play('success')
// everywhere else
Vue.prototype.$sound.play('success')