Why do you think it is necessary to insert an autoplay video on your website?

The web is in a dark place, as I plan to examine in the next several columns. If you need proof, look no further than autoplay videos, the first example.

You’re probably familiar with this horrendous experience: You are perusing a website, and suddenly an annoying voice or unfamiliar music blasts through your speakers.

You wonder, where is this coming from? You scroll up and down the webpage only to realize that a video is playing without your consent. And the noise polluting your ears is coming from an ad preceding a video you had never clicked to watch.

Autoplay videos are all over the web and inside apps. They are prominent in your Facebook and Instagram feeds. Some major news sites embed them into features and news articles.

Nobody seems to likes autoplay videos — not even people I’ve talked to in the ad industry. The indiscreet videos demand your attention while burning through your mobile data plan and sucking up your batteries. Yet they have become a necessary evil for many media publishers trying to survive in the digital age.

“I think we’ve ended up in a really crappy user experience right now with video advertising,” said Dave Morgan, the chief executive of Simulmedia, which works with advertisers on targeted television ads. “Video has been pushed into every user experience whether or not it fits, because it’s a way to make more money.”

Well, I come here bearing some good news and bad news about these abominations. The bad news is that autoplay videos are here to stay, and that the tools to combat them are far from perfect. The good news is that they are evolving to be less annoying, and that some sites let you turn them off. Here’s what you need to know about how we got here, what you can do and where autoplay videos are heading.

In digital media, video advertising was always the ultimate goal. Twenty years ago, web publishers dreamed of delivering video ads online: It was the perfect format, already proved by the TV industry to be engaging to audiences and a big revenue generator.

“Sight, sound and motion can make people laugh, make people cry, make them hug somebody,” Mr. Morgan said. “It can make them love a brand. It can make them whistle a brand’s theme song when they’re walking a dog.”

Yet publishers faced technical hurdles, like slow internet connections, that made video ads untenable. Instead, publishers served ads that were static images, which eventually evolved to become graphics with some animations and sound.

Over the last decade, fast wired and wireless connections spread, as did computers and smartphones. Consumers also became acclimated to streaming video services like Netflix and YouTube. Serving an online video became easy. So advertising firms like BrightRoll and Tremor Video, along with tech companies like Facebook, began testing video ads.

Once they got started, there was no turning back. Video ads generated 20 to 50 times more revenue than traditional display ads, and the best way to get money was to make the videos play automatically, Mr. Morgan said. Tech platforms like Facebook and Twitter liked autoplay videos, too, because they were effective at getting people to stick around on their sites, said Taylor Wiegert, a director of user experience strategy for the Martin Agency. Automatically playing videos went from a rarity a decade ago to a prominent online advertising medium today.

Many consumers have complained that autoplay videos are a nuisance. (I am one of them!) So tech companies have come up with some workarounds:

Facebook and Twitter each offer the ability to prevent videos from automatically playing in their apps and websites. On Facebook, the instructions are buried in its Accessibility page, and on the Twitter website, the controls are found in the Settings menu, under Content.

On Instagram, you cannot disable videos from automatically playing. However, in the cellular data setting, you can configure the app to use less mobile data, which makes videos load more slowly when you are on a cellular connection.

Google’s Chrome browser prevents some videos from automatically playing. The web browser allows videos to autoplay on 1,000 sites where Google has determined that people have the highest likelihood of wanting to play videos with sound. Over time, after Chrome studies the websites that you visit, the browser adapts to allow autoplaying on sites where you frequently played videos with the sound on and disables autoplay on sites where you do not.

Some software developers offer browser add-ons that prevent all videos from automatically playing. But the tools are imperfect: A Chrome add-on that I tested, for example, blocked videos when I was doing a videoconference on Google Hangouts.

As annoying as they may be, autoplay videos are here to stay — largely because the ads generate so much money. But they are thankfully becoming less obnoxious.

Increasingly, advertising firms are shifting toward making autoplay videos with the assumption that people have muted their devices. Mr. Wiegert of the Martin Agency said his firm primarily makes ads with sound off by default. It designs them to communicate a company’s branding and message without requiring sound.

Tech companies, too, are evolving their products to make autoplay videos less of a nuisance. For example, Google says that part of its criteria for allowing autoplay to work in the Chrome browser is for the videos to be muted or have no sound. And on Instagram, automatically played videos are muted by default unless you manually turn on the audio.

“Autoplay with sound on is just going to go extinct,” Mr. Wiegert said. “It’s been deemed as a poor quality experience for users. Even I’ve gotten annoyed when I’ve been on a webpage and all of a sudden I hear sound coming through my speakers.”

Yet Mr. Morgan of Simulmedia believes video ads will be forced to change more radically to give people fuller control over what they see. That’s because autoplay videos still satisfy publishers, not the consumers.

“We’re putting those ads in those places because we can — not because it is the best for the user,” he said.

Automatically starting the playback of audio (or videos with audio tracks) immediately upon page load can be an unwelcome surprise to users. While autoplay of media serves a useful purpose, it should be used carefully and only when needed. In order to give users control over this, browsers often provide various forms of autoplay blocking. In this guide, we'll cover autoplay functionality in the various media and Web Audio APIs, including a brief overview of how to use autoplay and how to work with browsers to handle autoplay blocking gracefully.

Autoplay blocking is not applied to

The term autoplay refers to any feature that causes audio to begin to play without the user specifically requesting that playback begin. This includes both the use of HTML attributes to autoplay media as well as the user of JavaScript code to start playback outside the context of handling user input.

That means that both of the following are considered autoplay behavior, and are therefore subject to the browser's autoplay blocking policy:

<audio src="/music.mp3" autoplay>

and

The following web features and APIs may be affected by autoplay blocking:

  • The HTML
  • The Web Audio API

From the user's perspective, a web page or app that spontaneously starts making noise without warning can be jarring, inconvenient, or off-putting. Because of that, browsers generally only allow autoplay to occur successfully under specific circumstances.

As a general rule, you can assume that media will be allowed to autoplay only if at least one of the following is true:

  • The audio is muted or its volume is set to 0
  • The user has interacted with the site (by clicking, tapping, pressing keys, etc.)
  • If the site has been allowlisted; this may happen either automatically if the browser determines that the user engages with media frequently, or manually through preferences or other user interface features
  • If the autoplay feature policy is used to grant autoplay support to an