Autoplay policy in Chrome - Chrome Developers (2023)

The Autoplay Policy launched in Chrome 66 for audio and video elements and is effectively blocking roughly half of unwanted media autoplays in Chrome. For the Web Audio API, the autoplay policy launched in Chrome 71. This affects web games, some WebRTC applications, and other web pages using audio features. More details can be found in the Web Audio API section below.

Chrome's autoplay policies changed in April of 2018 and I'm here to tell you why and how this affects video playback with sound. Spoiler alert: users are going to love it!

Autoplay policy in Chrome - Chrome Developers (1)

Autoplay policy in Chrome - Chrome Developers (2)

# New behaviors

As you may have noticed, web browsers are moving towards stricter autoplay policies in order to improve the user experience, minimize incentives to install ad blockers, and reduce data consumption on expensive and/or constrained networks. These changes are intended to give greater control of playback to users and to benefit publishers with legitimate use cases.

Chrome's autoplay policies are simple:

  • Muted autoplay is always allowed.
  • Autoplay with sound is allowed if:
    • The user has interacted with the domain (click, tap, etc.).
    • On desktop, the user's Media Engagement Index threshold has been crossed, meaning the user has previously played video with sound.
    • The user has added the site to their home screen on mobile or installed the PWA on desktop.
  • Top frames can delegate autoplay permission to their iframes to allow autoplay with sound.

# Media Engagement Index

The Media Engagement Index (MEI) measures an individual's propensity to consume media on a site. Chrome's approach is a ratio of visits to significant media playback events per origin:

  • Consumption of the media (audio/video) must be greater than seven seconds.
  • Audio must be present and unmuted.
  • The tab with the video is active.
  • Size of the video (in px) must be greater than 200x140.

From that, Chrome calculates a media engagement score, which is highest on sites where media is played on a regular basis. When it is high enough, media is allowed to autoplay on desktop only.

(Video) Autoplay Policy : CRITICAL info for developers - Web Audio API

A user's MEI is available at the about://media-engagement internal page.

Autoplay policy in Chrome - Chrome Developers (3)

# Developer switches

As a developer, you may want to change Chrome autoplay policy behavior locally to test your website for different levels of user engagement.

# Iframe delegation

A permissions policy allows developers to selectively enable and disable browser features and APIs. Once an origin has received autoplay permission, it can delegate that permission to cross-origin iframes with the permissions policy for autoplay. Note that autoplay is allowed by default on same-origin iframes.


<iframe src="https://cross-origin.com/myvideo.html" allow="autoplay">


<iframe src="https://cross-origin.com/myvideo.html" allow="autoplay; fullscreen">

When the permissions policy for autoplay is disabled, calls to play() without a user gesture will reject the promise with a NotAllowedError DOMException. And the autoplay attribute will also be ignored.

Warning

(Video) How to Re-enable Autoplay in Chrome

Older articles incorrectly recommend using the attribute gesture=media which is not supported.

# Examples

Example 1: Every time a user visits VideoSubscriptionSite.com on their laptop they watch a TV show or a movie. As their media engagement score is high, autoplay is allowed.

Example 2: GlobalNewsSite.com has both text and video content. Most users go to the site for text content and watch videos only occasionally. Users' media engagement score is low, so autoplay wouldn't be allowed if a user navigates directly from a social media page or search.

Example 3: LocalNewsSite.com has both text and video content. Most people enter the site through the homepage and then click on the news articles. Autoplay on the news article pages would be allowed because of user interaction with the domain. However, care should be taken to make sure users aren't surprised by autoplaying content.

Example 4: MyMovieReviewBlog.com embeds an iframe with a movie trailer to go with a review. Users interacted with the domain to get to the blog, so autoplay is allowed. However, the blog needs to explicitly delegate that privilege to the iframe in order for the content to autoplay.

# Chrome enterprise policies

It is possible to change the autoplay behavior with Chrome enterprise policies for use cases such as kiosks or unattended systems. Check out the Policy List help page to learn how to set the autoplay related enterprise policies:

  • The AutoplayAllowed policy controls whether autoplay is allowed or not.
  • The AutoplayAllowlist policy allows you to specify an allowlist of URL patterns where autoplay will always be enabled.

# Best practices for web developers

# Audio/Video elements

Here's the one thing to remember: Don't ever assume a video will play, and don't show a pause button when the video is not actually playing. It is so important that I'm going to write it one more time below for those who simply skim through that post.

Gotchas

Don't assume a video will play, and don't show a pause button when the video is not actually playing.

(Video) HTML : Google Chrome 66 autoplay policy change

You should always look at the Promise returned by the play function to see if it was rejected:

var promise = document.querySelector('video').play();

if (promise !== undefined) {
promise.then(_ => {

}).catch(error => {


});
}

One cool way to engage users is to use muted autoplay and let them chose to unmute. (See the example below.) Some websites already do this effectively, including Facebook, Instagram, Twitter, and YouTube.

<video id="video" muted autoplay>
<button id="unmuteButton"></button>

<script>
unmuteButton.addEventListener('click', function() {
video.muted = false;
});
</script>

Events that trigger user activation are still to be defined consistently across browsers. I'd recommend you stick to "click" for the time being then. See GitHub issue whatwg/html#3849.

# Web Audio

The Web Audio API has been covered by autoplay since Chrome 71. There are a few things to know about it. First, it is good practice to wait for a user interaction before starting audio playback so that users are aware of something happening. Think of a "play" button or "on/off" switch for instance. You can also add an "unmute" button depending on the flow of the app.

If an AudioContext is created before the document receives a user gesture, it will be created in the "suspended" state, and you will need to call resume() after the user gesture.

If you create your AudioContext on page load, you'll have to call resume() at some time after the user interacted with the page (e.g., after a user clicks a button). Alternatively, the AudioContext will be resumed after a user gesture if start() is called on any attached node.


window.onload = function() {
var context = new AudioContext();


}


document.querySelector('button').addEventListener('click', function() {
context.resume().then(() => {
console.log('Playback resumed successfully');
});
});

You may also create the AudioContext only when the user interacts with the page.

document.querySelector('button').addEventListener('click', function() {
var context = new AudioContext();


});

To detect whether the browser requires a user interaction to play audio, check AudioContext.state after you've created it. If playing is allowed, it should immediately switch to running. Otherwise it will be suspended. If you listen to the statechange event, you can detect changes asynchronously.

(Video) Chrome just disabled the new autoplay mute mode, but it’s for your own good

To see an example, check out the small Pull Request that fixes Web Audio playback for these autoplay policy rules for https://airhorner.com.

FAQs

Is autoplay allowed on Chrome? ›

The actual Chrome policy is: Autoplay with sound is (only) allowed if: The user has interacted with the domain (click, tap, etc.). On desktop, the user's Media Engagement Index (MEI) threshold has been crossed, meaning the user has previously played video with sound.

How do I bypass Autoplay on Chrome? ›

You can disable the autoplay policy entirely by using a command line flag: chrome.exe --autoplay-policy=no-user-gesture-required . This allows you to test your website as if user were strongly engaged with your site and playback autoplay would be always allowed.

Why is autoplay attribute not working? ›

Why video autoplay is not working in HTML? Chrome does not allow autoplay if the video is not muted. So to autoplay video you need to set both autoplay and muted attribute.

How do I change autoplay settings in Chrome? ›

In the menu that appears, tap “Settings” near the bottom. This will open a new tab of the “Settings” page tap “Site settings.” Tap “Sound.” On the toggle switch next to “Allow sites to play sound,” tap the “slider” to turn the option “off” to disable all sites or “on” to add site exceptions that will get turned off.

Why did Google remove AutoPlay? ›

Google has removed the option to disable autoplay from Mobile Chrome | Hacker News. The rationale here seems to be that by blocking video autoplay, Chrome incentivized sites shipping huge animated GIFs, or decoding video in JS and painting to canvas, both of which are very suboptimal for users.

How do I fix AutoPlay? ›

Go to Settings > Devices > AutoPlay. Turn off the button for Use AutoPlay for all media and devices and then turn it on. However, if it is not enabled, it should be the reason for AutoPlay not working in Windows 10. You need to enable it and then check whether it can work normally.

Do browsers block AutoPlay? ›

Some web browsers, including Chrome, restrict the autoplay of videos to improve the user experience. In some cases, this may result in the video features of Wonder not functioning. To prevent this, make sure the 'autoplay block' is disabled in your browser.

What is the difference between AutoPlay and AutoRun? ›

The main purpose of AutoRun is to provide a software response to hardware actions that a user starts on a computer. AutoPlay is a Windows feature that lets a user select which program starts when a specific type of media, such as music CDs, or DVDs containing photos, is inserted.

How do I enable AutoPlay on a website? ›

Google Chrome: control audio and video playback
  1. Click on the menu next to it, and select one of the available options: Default -- autoplay is enabled. No user gesture is required -- Users don't need to interact with the document for video or audio sources to start playing automatically. ...
  2. Restart the Chrome browser.
6 Feb 2018

What is AutoPlay in settings? ›

On Windows 10, AutoPlay is a feature that allows you to decide a default action when connecting a USB drive, memory card, and other kind of media or device to your computer.

How do I change AutoPlay settings? ›

Solution
  1. Open the Start menu. Click Settings.
  2. Select Devices.
  3. Click AutoPlay in the lower-left side of the display. Then slide the Use AutoPlay for all media and devices toggle on or off.
  4. Under Choose AutoPlay Defaults, set the default action for AutoPlay when connecting each type of media or device.

How do I reset AutoPlay settings? ›

Reset AutoPlay Defaults in Control Panel
  1. Open the Control Panel (icons view), and click/tap on the AutoPlay icon.
  2. Click/tap on the Reset all defaults button at the bottom. ( see screenshot below)
  3. Click/tap on Save.
  4. You can now close the Control Panel if you like.
3 Dec 2021

Why you should disable AutoPlay? ›

AutoRun and AutoPlay are Windows OS enabled features that allow an inserted drive (e.g. USB memory) to run a script upon insertion. This is plain dangerous since an infected drive could lead to a Virus or Malware being installed on your PC.

Why does AutoPlay exist? ›

It allows us to play without divulging too much attention, while waiting on the train or for whatever transportation.

Is AutoPlay a security risk? ›

"Turn off Autoplay" is not enabled. The Windows Autoplay feature allows files to execute from an external drive as soon as it plugged into the computer. This may allow attackers to introduce malicious code to a system easily without user intervention.

How do I know if AutoPlay is on? ›

If Autoplay is activated, you should see an Autoplay playlist in the lower half of the screen and a highlighted Autoplay icon to the right of the song playing. Tap the Autoplay icon to disable it. The Autoplay icon is the one that looks like an infinity symbol.

How do I stop AutoPlay on websites? ›

Disable Autoplay Videos in Chrome on Android

Android makes disabling autoplay videos simple. First, launch Chrome on your phone or tablet and go to Settings > Site Settings. Next, scroll down the menu and tap on Media, and then Autoplay and toggle the switch off.

How do I turn off AutoPlay devices? ›

How to Disable AutoPlay From the Control Panel
  1. Press the Win + R to open Run.
  2. Type control and click OK to open the Control Panel.
  3. In the Control Panel, go to Hardware and Sound.
  4. Next, click on AutoPlay.
  5. Uncheck the Use AutoPlay for all media and devices to disable AutoPlay.
28 Jan 2022

What is autoplay in Chrome? ›

Whenever you are reading an article or blog online, you may have noticed that videos in it start playing automatically. By default, the autoplay option is enabled in Chrome but the audio is muted. Even though Chrome itself does not provide any autoplay disabling option, you can disable it if you wish to.

Why autoplay is muted? ›

According to the new autoplay specifications, autoplaying videos on IOS, Safari, Chrome, Android, Firefox, and Edge must start out muted. This policy is controlled by the browser manufacturers, and all video hosting services must adhere to it.

What is Autoplay blocking? ›

The default Block Audio setting will prevent autoplay for all media with sound. The Block Audio and Video setting will prevent autoplay for all media, including video, even though audio is muted.

What is open AutoPlay? ›

AutoPlay. AutoPlay (also known as AutoRun) is a feature that automatically runs a program or opens a file on a removable drive or CD/DVD after connecting/inserting it.

What browsers support autoplay in HTML? ›

HTML element: audio: autoplay
  • Chrome. 4 - 106 Supported. 107 Supported. ...
  • Edge * 12 - 106 Supported. 107 Supported.
  • Safari. 3.1 - 16.0 Supported. 16.1 Supported. ...
  • Firefox. 2 - 3 supported. 3.5 - 105 Supported. ...
  • Opera. 10.1 supported. ...
  • IE. 6 - 8 supported. ...
  • Chrome for Android. 107 Supported.
  • Safari on iOS * 3.2 - 16.0 Supported.

How do I get websites to open automatically in Chrome? ›

You can tell Chrome to open to any webpage.
  1. On your computer, open Chrome.
  2. At the top right, click More. Settings.
  3. Under "On startup," select Open a specific page or set of pages. Click Add a new page. Enter the web address and click Add. Click Use current pages.

How do I enable AutoPlay in Chrome? ›

Go to “Settings.” Click the “Settings” button next to the “Autoplay” option. From the popup, click the drop-down next to the “Default for all websites” option, and switch to “Allow audio and video.”

How do I AutoPlay videos in Chrome? ›

How to control audio and video autoplay in Google Chrome
  1. Select Menu > Settings.
  2. Activate Site Settings (under Privacy and Security) and select Media on the page that opens.
  3. Tap on Auto-play.
  4. Toggle the status so that it is off.
6 Feb 2018

What are AutoPlay settings? ›

On Windows 10, AutoPlay is a feature that allows you to decide a default action when connecting a USB drive, memory card, and other kind of media or device to your computer.

What is AutoPlay in Chrome? ›

Whenever you are reading an article or blog online, you may have noticed that videos in it start playing automatically. By default, the autoplay option is enabled in Chrome but the audio is muted. Even though Chrome itself does not provide any autoplay disabling option, you can disable it if you wish to.

Where is video autoplay in settings? ›

Using the Android app

Click the menu button at the top right of your screen. Once you're there, scroll down and tap “Settings & Privacy,” then “Settings.” Scroll down until you find “Media and Contacts” and tap on it. Tap on “Autoplay” and set it to “Never Autoplay Videos.”

Videos

1. In video tag Auto-play is not working Fixed it || 2 Solutions || 💯 working solution.
(Sothe. Tech)
2. Stealth Auto Player Review 🙀Watch Now⚡⚡Google Chrome Video autoplay Function Solved!
(Adam Payne)
3. How To Get Your YouTube Videos To Autoplay In Chrome 2020
(Henry Webster)
4. chrome setting for autoplay background sound website
(SomethingToLearn)
5. Media - #AskChrome
(Google Chrome Developers)
6. Embedded Video Autoplay Alternatives - What to do when video autoplay doesn't work in chrome
(ThriveMate)
Top Articles
Latest Posts
Article information

Author: Duncan Muller

Last Updated: 02/05/2023

Views: 6161

Rating: 4.9 / 5 (59 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Duncan Muller

Birthday: 1997-01-13

Address: Apt. 505 914 Phillip Crossroad, O'Konborough, NV 62411

Phone: +8555305800947

Job: Construction Agent

Hobby: Shopping, Table tennis, Snowboarding, Rafting, Motor sports, Homebrewing, Taxidermy

Introduction: My name is Duncan Muller, I am a enchanting, good, gentle, modern, tasty, nice, elegant person who loves writing and wants to share my knowledge and understanding with you.