Save wavesurfer state and preload on reload
See original GitHub issueWavesurfer.js version(s):
2.0.2
Browser version(s):
Google Chrome Version 63.0.3239.132 (Official Build) (64-bit)
Problem
Hey there! I have a popup where I load an audio using the wavesurfer, the audio is about 20 minutes long so it takes some time for it to fully load.
I’m trying to achieve that when the wavesurfer finishes loading for the first time it saves the state so if you close the popup and open it back again it will just use the saved data.
I read all the documentation, issues and the code but I’m still not being able to achieve this even though it seems simple.
I suppose the code should be something like this, but actually the method “preload” doesn’t exist and I don’t find the way to preload the OfflineAudioContext
Any ideas?
this.waveSurfer = WaveSurfer.create({
container: $waveForm,
waveColor: 'purple',
renderer: 'MultiCanvas',
height: 80
});
this.waveSurfer.on('ready', () => {
window.savedWavesurfer = this.waveSurfer.WebAudio.getOfflineAudioContext();
});
if (window.savedWavesurfer) {
this.waveSurfer.preload(window.savedWavesurfer);
} else {
this.waveSurfer.load('//example.com/audio.mp3');
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:10
Top Results From Across the Web
Save wavesurfer state and preload on reload - Bountysource
I have a popup where I load an audio using the wavesurfer, the audio is about 20 minutes long so it takes some...
Read more >WaveSurfer Methods
load(url, peaks, preload) – Loads audio from URL via XHR. Optional array of peaks . Optional preload parameter [none|metadata|auto] , passed to the...
Read more >The render does not reload after a wavesurfer event
For that wavesurfer provides the event region-in. After the execution of my method the render is not reloaded, while I change a state....
Read more >Preloading/Lazy-loading of external media assets - help
For the first that needs to load right away I would use the template's template-variable to set a loading state to true, init...
Read more >A curated list of awesome things related to Vue.js
Keep the Vuex state with localStorage. vuex-action-reload - A vuex plugin that reloads actions when a condition is met. vuejs-storage - Vue.js ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That event doesn’t trigger as I’m using webaudio. I read in the documentation that:
waveform-ready
– Fires after the waveform is drawn when using the MediaElement backend. If you’re using the WebAudio backend, you can useready
.@oxmanroman why don’t you use window.sessionStorage instead and just load it from there? Even better use window.localStorage so when the user closes and opens the browser again it remembers.