Load audio waveform, but load the audio file ONLY when the user clicks 'Play' button? #3578
Unanswered
danielmat3
asked this question in
Q&A
Replies: 2 comments 12 replies
-
Wavesurfer needs to download the entire audio to render the waveform. It then also uses the downloaded blob for playback. The only way to avoid loading the audio is to pre-decode peaks: const media = new Audio()
media.preload = 'none'
const wavesurfer = WaveSurfer.create({
container: '..,',
media,
peaks: [ 0.1, 0.2, 0.3 ],
duration: 123,
}) |
Beta Was this translation helpful? Give feedback.
11 replies
-
Is it possible to replace the prerendered peaks when the audio file does download? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
How do I load just the audio waveform and make it so the audio file downloads only when the user clicks 'Play'? I'm not sure how to set the 'Preload' option to "none".
I've researched online on many forums from other people, but there's no explanation for that... ?
Specifically I'm looking how to set the audio settings to preload="none".
Similar discussions:
https://stackoverflow.com/questions/38918909/how-can-i-load-only-waveform-and-wait-to-user-click-play-to-download-the-audio
My website where I want to solve the problem:
https://unwav.com/product/groove-premium-tech-house-sample-pack/
I have integrated WaveSurfer-WP plugin from X-Raym:
https://wordpress.org/plugins/wavesurfer-wp/
The following plugin uses your WaveSurfer.js script but from how much I can see it is "outdated". I reached out to X-Raym (plugin creator) and he told me that I need to edit the wavesurfer.js parameters to achieve the result.
=========
There's a similar website that uses the same WaveSurfer-WP plugin like me and integrated CDN for the audio files, but if you compare his wavesurfer.js & wavesurfer-wp.js files the code is nothing similar to mine.
Please see: https://stickz.co/sentio/
On this website above ^ he managed to make this work and the audio is set to - preload="none"
Since you are the "god" of wavesurfer and you know what you are doing, I am reaching out to you for a solution for this...
Beta Was this translation helpful? Give feedback.
All reactions