---
title: "Tech Tip #52: Load video only when someone presses play (video)"
description: "Autoloaded video can outweigh the rest of the page."
url: https://greencode.ai/shorts/52-load-video-on-play/
---

# Tech Tip #52: Load video only when someone presses play (video)

## Tech Tip #52: Load video only when someone presses play

**Autoloaded video can outweigh the rest of the page.**

[Watch the video](https://media.greencode.ai/shorts/load-video-on-play-1c88481e1c10.mp4)

Video created by [explainapaper.com](https://explainapaper.com/?utm_source=greencode.ai&utm_medium=film&utm_campaign=made-by)

### The problem

Pages embed video players that fetch the video, or a heavy player script, as soon as the page opens, whether anyone watches or not.

### The fix you can use today

- Show a poster image and fetch the video only on click.
- Use preload="none" on video elements.
- Swap a lightweight placeholder for third-party players until they are used.

GreenCode's own website loads its films only when someone presses play.

### Tools that help

- [Lighthouse](https://developer.chrome.com/docs/lighthouse/overview?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode): audits a page for total byte weight, unused JavaScript and CSS, image formats and offscreen images
- [WebPageTest](https://www.webpagetest.org/?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode): loads a real page and shows every request, its size and when it loaded

### How GreenCode helps

GreenCode helps tackle this by practising it on greencode.ai: films load only when someone presses play, and static pages, WebP images and scripts only where they are used cut the home page's first view from 6,766 KB to 1,719 KB. [More on this](https://greencode.ai/green-hosting/).

### Tags

#video#web-performance#frontend

### Sources

- [Green hosting: films delivered only when wanted](https://greencode.ai/green-hosting/)
- [HTTP Archive, Web Almanac 2024, Sustainability: video preload and autoplay](https://almanac.httparchive.org/en/2024/sustainability?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode)
- [W3C, Web Sustainability Guidelines: disable autoplay, use facades for heavy media](https://www.w3.org/TR/web-sustainability-guidelines/#user-controlled-media)

### Transcript

Autoloaded video can outweigh the rest of the page. Many pages embed a video player that starts loading straight away. It fetches the video, or a heavy player script, the moment the page opens. Whether anyone watches or not. Every one of those bytes uses energy, on the network and the device. Here is the fix you can use today. First, show a poster image, and fetch the video only on click. Next, tell video elements not to preload. Then use a light placeholder for other sites' players, until someone uses them. Check what still loads, using tools like Lighthouse and WebPageTest. GreenCode's own website loads its films only when someone presses play. A two to three minute film there is around ten megabytes. Visitors who never press play never download it. GreenCode helps tackle this by practising it on its own website. Static pages, lighter images, and scripts only where they are used. That was GreenCode Tech Tip number fifty-two. Follow for the next tip, and find more on greencode.ai/tech-tips.

[The tip in full](https://greencode.ai/tech-tips/52-load-video-on-play/)

[« Tech Tip #51: Ask AI for less](https://greencode.ai/shorts/51-shorter-prompts-shorter-answers/)[Tech Tip #53: Test your workload on other CPU architectures »](https://greencode.ai/shorts/53-try-arm-instances/)

[All GreenCode Tech Tips](https://greencode.ai/tech-tips/) · [All GreenCode videos](https://greencode.ai/videos/)

#### Key Facts

- Tip **#52**
- For **Developers**
- Length **1:05**
- Category **Web and front-end**
![GreenCode](https://greencode.ai/wp-content/uploads/2024/12/greencode-logo-website-small-colours-2.webp)

Want this checked on your own system? Talk to the GreenCode team.

[Get in touch](https://greencode.ai/contact/)
