FR: Prevent HTML Audio Tag Injection (lazyload option)
See original GitHub issueHi,
This is a follow-up a the issue discussed on the Bug: Browsers don’t respect setting preload to “none” in wavesurfer.load() issue.
Context
This issue concerns using MediaElement backend and Cached Peaks.
Problem
Some browsers ignore the preload=none attribute of audio tags. This means that in some cases, audio files are loaded even if not needed.
Proposition
Only inject audio HTML tags when needed (aka, after a custom event).
For this, we can imagine having a lazyload
wavesurfer init option attribute, to init the object.
Initializing the object also require knowing its length before hand. (attribute integration proposition by @mspae : https://github.com/katspaugh/wavesurfer.js/commit/1025d7263e32f087a3404012dbf0301e5f95b383 )
This will not be a problem with cached data (the length can be added in the cache file).
This will increase wavesurfer performance and some browser/OS (like Safari+MacOS) a lot ! 😃 Thanks for taking a look !
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top GitHub Comments
@X-Raym I’ve opened a PR on the duration parameter.
@thijstriemstra What I meant is that I don’t know how to implement this
lazyload
option, wavesurfer.js is a pretty complex script.