staskobzar / vue-audio-visual

VueJS audio visualization components
MIT License
686 stars 109 forks source link

AVBars Component's audio address, unable to use local audio files dynamically #129

Open loneyao opened 1 year ago

loneyao commented 1 year ago
       <AVBars
                              v-if='myAudio'
                              ref="player"
                              :src="myAudio"
                              caps-color="#FFF"
                              :bar-color="['#f00', '#ff0', '#0f0']"
                              canv-fill-color="#000"
                              :brick-height="6"
                              :bar-width="10"
                              :caps-height="2"
                          ></AVBars>

Here is my way to dynamically obtain audio files:

const uint8Buffer = Uint8Array.from(value); const wav = new Blob([uint8Buffer]); myAudio = window.URL.createObjectURL(wav);

image

staskobzar commented 1 year ago

If you are trying to load local file from the disk then there is something with the way you do it. I do not think it has anything to do with the plugin. It is designed to work with URLs. Anything that works with <audio/> standard HTML element should work with the plugin.