Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New rule: Never preload video in the <video> tag #7

Open
JulienWilhelm opened this issue Jul 18, 2024 · 0 comments
Open

New rule: Never preload video in the <video> tag #7

JulienWilhelm opened this issue Jul 18, 2024 · 0 comments
Assignees
Labels
💡 rule-idea Rule not already specified, but a good starting point

Comments

@JulienWilhelm
Copy link

When the <video> tag is used, the video source is loaded at the same time as the page. However, it is never certain that the user will consult this content.

To prevent downloading of the video, you must use the "preload" attribute with the value "none".

Please note that the use of "preload=none" should be supplemented with the "poster" attribute to provide an (optimized) preview image of the video content.

<!-- Bad: "preload" is not specified, so the video is automatically downloaded. -->
<video>
	<source src="/path/to/video.m4v" type="video/mp4">
</video>

<!-- Almost good: "preload=none" is specified, so the video will only be downloaded if the user asks to play it. But there is no preview. -->
<video preload="none">
	<source src="/path/to/video.m4v" type="video/mp4">
</video>

<!-- Good: "preload=none" is specified AND "poster" too -->
<video preload="none" poster="/path/to/poster.webp">
	<source src="/path/to/video.m4v" type="video/mp4">
</video>

Note: when the "autoplay" attribute is specified, "preload=none" will be ignored.

@JulienWilhelm JulienWilhelm changed the title New rule: Never preload video New rule: Never preload video in <video> Jul 18, 2024
@JulienWilhelm JulienWilhelm changed the title New rule: Never preload video in <video> New rule: Never preload video in the <video> tag Jul 18, 2024
@olegoaer olegoaer added the 💡 rule-idea Rule not already specified, but a good starting point label Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💡 rule-idea Rule not already specified, but a good starting point
Projects
None yet
Development

No branches or pull requests

3 participants