Comments (8)
Actually i fixed this by giving only av-waveform a key and not av-bars :) Dynamic changing of the track is totally doable. Just give the audio element an id and change its src with regular js wait for the canplay callback and play it.
from vue-audio-visual.
Hi Stas, using v-if
based on the src
value is exactly what I've ended up doing.
All working perfectly now, thank-you!
from vue-audio-visual.
Using key can help to reload the component when audio source changes.
<av-waveform :audio-src="file" :cors-anonym="true" :key="audioindex"> </av-waveform>
This worked Perfectly for me. In my case each audio file had some audioindex. cors-anonym can be set true if you are fetching Audio from other origin that was in my case else that is not required
from vue-audio-visual.
You can dynamically change the audio in the $ref audio player by giving it a unique :key="some.id" but when I do this I can only get one of the av things to work.
from vue-audio-visual.
@galipmedia thank you. I will test it and document your idea in README
from vue-audio-visual.
Thanks for the info here, very helpful.
One caveat here seems to be that under the condition that the value provided for the src leads to an error when the component is mounted (this includes an empty string, undefined
, of if the request returns 404), future changes to the src won't work.
A possible workaround would be to provide a placeholder/empty audio file as the source.
from vue-audio-visual.
Hello Tim,
In my projects I use conditional rendering with v-if or v-show. It allows dynamically change audio sources for the same component.
It works fine and I do not know yet the better solution for the component. But I keep this issue opened in case if I come up with something better.
Have a good day
from vue-audio-visual.
Hi,pankaj, I wonder if the "audioindex"
is a list or something?
from vue-audio-visual.
Related Issues (20)
- MediaStream is not defined HOT 1
- Visualizer not visualizing audio with a url HOT 7
- How can i import vue-audio-visual to my project HOT 2
- Switch the local audio file and play it. Do you need to convert the file to blob? HOT 1
- AVBars Component's audio address, unable to use local audio files dynamically HOT 1
- Error with command: npm run dev HOT 1
- AVBars bar coloring depending on bars x axis position
- AVWave wrong slider positioning on short audio HOT 7
- AVWave playtime fixed position HOT 2
- waveform overwrites another when 2 wavforms are on screen. HOT 9
- [Vue warn]: Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function. HOT 1
- How to set width of av-line width to 100%? HOT 2
- Hide controls? HOT 2
- Events playing, paused , how to emit them? HOT 2
- Extraneous non-props attributes (ref-link) HOT 1
- When AVWaveform's src uses ref variables, the waveform cannot be displayed normally HOT 5
- Help me!!! Why can firefox display normally but chrome cannot? HOT 6
- For vue 2, after pausing and replaying, the music plays slower in a low key. HOT 9
- Failed to decode audio array buffer: DOMException: Failed to execute 'decodeAudioData' on 'BaseAudioContext': Unable to decode audio data HOT 2
- CDN ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-audio-visual.