Urgent.News

What's breaking now, across hundreds of outlets.

Tech

How to autoplay an embedded video (and why it has to be muted)

A video that starts by itself can bring a landing page to life: a product in motion, a short loop in the header, a demo that runs while people read. But if you have ever tried it, you know browsers often refuse to start the video. Here is why, and how to get it right. Why browsers block autoplay Nobody likes a website that suddenly starts talking. That is why Chrome, Safari, Firefox and Edge all…

Videos that begin playing automatically can add life to a landing page - showcasing a product in motion, looping imagery in the header, or a demo running while visitors read. However, browsers often prevent videos from starting. This guide explains why, and how to implement autoplay correctly.

Modern browsers such as Chrome, Safari, Firefox, and Edge impose restrictions on autoplay. Muted videos can start on their own, but sound-filled videos usually cannot. They typically only play in specific scenarios, like when a user has previously engaged with the webpage or site, and the rules vary across browsers.

To ensure reliable autoplay for all users, it's essential to start the video muted. While muted, visitors can still enable sound with a single click. The embed code from Vidlify, for instance, includes the parameter "autoplay=1&muted=1" in the URL. "autoplay=1" prompts the player to begin immediately, while "muted=1" ensures the video starts without sound, complying with browser requirements.

This parameter is also present in the Vidlify iframe code, which must include "allow='autoplay'" - the permission browsers need to allow an embedded player to start.

"Autoplay=1&muted=1" can also be combined with a start time, such as "?autoplay=1&muted=1&t=15" to begin playing at the 15-second mark. When autoplay is appropriate, it can include short, silent clips like product shots, background visuals, or screen recordings. If the webpage is primarily about the video, visitors are likely there to watch it anyway.

However, long videos with speech should not be muted, as viewers won't understand the content. Similarly, multiple videos on one page should not autoplay, as it consumes data and slows down the page. Mobile users on limited data plans should also be considered, as an automatically starting video uses their data allowance.

To maximize the effectiveness of muted autoplay, the video's key message should be conveyed visually rather than audibly. If speech is vital, consider adding subtitles burned into the video so the message is still conveyed even when muted. It's also crucial to test autoplay on mobile devices, as they tend to have the most stringent autoplay and data restrictions.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Phone numbers in E.164: the formatting bugs that break SMS and calls

AI disclosure: this article was written with the help of AI and checked by a human before publishing. Most "SMS not delivered" and "call failed" tickets I have seen were not network problems.

  • Phone numbers often stored in inconsistent formats causing SMS and call failures
  • Inconsistent formats stem from dialling prefixes, duplicate country codes, CSV errors
  • E.164 format with plus sign, country code, no spaces/punctuation resolves bugs

Preinstalled Android Malware Detected on Brand-New Devices Bought by Businesses

Keenadu and Triada were detected on new Android devices purchased for work. Malware embedded in firmware can compromise the protections that isolate app data.

  • Keenadu and Triada malware found in new Android devices
  • Malware compromises Android's sandbox, risks legitimate apps
  • Alldocube released firmware updates for Japanese devices on March 4

Writing the code took a week. Trusting it took months.

Anthropic published an engineering account this week that offers a rare, detailed look at what AI-assisted development actually costs.

  • Claude wrote core request path in one week
  • Verification process took months due to weak tests
  • Significant performance improvements achieved post-migration

More from Friday 27 November →