question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FR: Prevent HTML Audio Tag Injection (lazyload option)

See original GitHub issue

Hi,

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:open
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mspaecommented, Oct 31, 2017

@X-Raym I’ve opened a PR on the duration parameter.

0reactions
X-Raymcommented, Dec 21, 2017

@thijstriemstra What I meant is that I don’t know how to implement this lazyload option, wavesurfer.js is a pretty complex script.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug: Browsers don't respect setting preload to "none ... - GitHub
With preload set to none it works if we check for 'none' in the _load function, but peaks will not load and audio...
Read more >
How to prevent HTML5 audio from predownload / streaming ...
Is there a way I can prevent the browsers from predownloading the audio files and only work when they click play? <audio controls="controls" ......
Read more >
HTML audio preload Attribute - W3Schools
The preload attribute specifies if and how the author thinks that the audio file should be loaded when the page loads. The preload...
Read more >
How To Fix Cumulative Layout Shift (CLS) Issues
Another option is to ensure the sections are appropriately sized (e.g. with min-height ) so while the text in them may shift a...
Read more >
The ultimate guide to iframes - LogRocket Blog
The iframe element (short for inline frame) is probably among the oldest HTML tags and was introduced in 1997 with HTML 4.01 by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found