Autoplay Policy Changes no longer allow autoplay without user interaction first.

  • Muted autoplay is always allowed.
  • Autoplay with sound is allowed if:
    • 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.

The only way to bypass this would be your mouse movement implementation

Answer from Halmon on Stack Overflow
🌐
Medium
brad-carter.medium.com › building-an-audio-player-in-react-136fc684d16c
Building an Audio Player in React | by Brad Carter | Medium
April 25, 2021 - Now create a div with id audio-player that contains a self-closing audio tag. The audio tag should also have autoPlay, preload=”true” (must be explicitly set to true), and loop (if desired).
Discussions

Autoplay audio on React - react - Meteor Forum
Hello I have a trouble playing auto on chrome browser. I have to play audio automatically without any user’s activity. But I knew it is prevented on new chrome versions. If you know how to solve this, please let me know. Thank you More on forums.meteor.com
🌐 forums.meteor.com
1
0
October 25, 2022
Why react-audio-player dont play automatically?
On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge. If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options: Limiting your involvement with Reddit, or Temporarily refraining from using Reddit Cancelling your subscription of Reddit Premium as a way to voice your protest. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/learnprogramming
3
2
January 20, 2024
player autoPlay prop not working
onload of player I want to stop autoPlay , but its not working as expected More on github.com
🌐 github.com
8
May 30, 2019
audio play automatically on `src` change with unique URL but same audio when `autoPlay` is `false`
In here, if src changes, audio gets played auto even we say autoPlay is false. More on github.com
🌐 github.com
7
August 30, 2019
🌐
CodeSandbox
codesandbox.io › s › audio-autoplay-p4p55w
audio autoplay - CodeSandbox
November 21, 2023 - audio autoplay by mrchetan005 using ethers, react, react-dom, react-scripts, tailwindcss
Published   Nov 20, 2023
Author   mrchetan005
🌐
Meteor
forums.meteor.com › react
Autoplay audio on React - react - Meteor Forum
October 25, 2022 - Hello I have a trouble playing auto on chrome browser. I have to play audio automatically without any user’s activity. But I knew it is prevented on new chrome versions. If you know how to solve this, please let me k…
🌐
Reddit
reddit.com › r/learnprogramming › why react-audio-player dont play automatically?
r/learnprogramming on Reddit: Why react-audio-player dont play automatically?
January 20, 2024 -

I'm using react-audio-player from npm. I just want that when the user access the page the music starts. This code is not working:

<ReactAudioPlayer

src="/music.mp3"

autoPlay={true}

controls

loop

/>

🌐
npm
npmjs.com › package › react-audio-player
react-audio-player - npm
April 19, 2021 - import ReactAudioPlayer from 'react-audio-player'; //... <ReactAudioPlayer src="my_audio_file.ogg" autoPlay controls /> See the example directory for a basic working example of using this project. To run it locally, run npm install in the example directory and then npm start.
      » npm install react-audio-player
    
Published   Apr 19, 2021
Version   0.17.0
Author   Justin McCandless
🌐
GitHub
github.com › lhz516 › react-h5-audio-player › issues › 8
player autoPlay prop not working · Issue #8 · lhz516/react-h5-audio-player
May 30, 2019 - onload of player I want to stop autoPlay , but its not working as expected
Published   May 30, 2019
Author   kishan143-jaiswal
Find elsewhere
🌐
Tabnine
tabnine.com › home page › code › javascript › audio
react.audio JavaScript and Node.js code examples | Tabnine
origin: robsquires/react-audio-examples · render() { return ( <audio refs='audio' src={this.props.src} playing={this.props.playing} /> ) } origin: rakshans1/docstash · render() { return ( <div> {this.props.payload.format === 'video' ? <video width="1050" height="580" autoPlay controls> <source src={this.props.payload.url} type="video/mp4" /> </video> : <audio autoPlay controls> <source src={this.props.payload.url} type="video/mp4" /> </audio>} </div> ); } origin: Keishma/jammming ·
🌐
Mozilla
developer.mozilla.org › en-US › docs › Web › Media › Guides › Autoplay
Autoplay guide for media and Web Audio APIs - MDN Web Docs
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.
🌐
Ahoisting
ahoisting.com › blog › 2024-09-28-how-to-autoplay-audio-in-react-js
How to autoplay audio in react js? - aHoisting
September 28, 2024 - To autoplay audio in react js, you can use audioRef and then use it in useEffect to autoplay on load.
🌐
GitHub
github.com › lhz516 › react-h5-audio-player › issues › 9
audio play automatically on `src` change with unique URL but same audio when `autoPlay` is `false` · Issue #9 · lhz516/react-h5-audio-player
August 30, 2019 - react-h5-audio-player/src/index.js · Line 328 in b3497ed · if (src !== prevProps.src) { In here, if src changes, audio gets played auto even we say autoPlay is false. We should either add one more condition like ... && autoPlay or completely disable this feature.
Author   gencer
🌐
GitHub
github.com › riyaddecoder › react-audio-play
GitHub - riyaddecoder/react-audio-play: A simple audio player component for react. · GitHub
react-audio-play accepts the following ... The URL or file path of the audio file to be played. autoPlay (boolean, optional): Set this to true to autoplay the audio....
Starred by 39 users
Forked by 8 users
Languages   TypeScript 81.8% | CSS 13.6% | JavaScript 4.6%
🌐
npm
npmjs.com › package › react-h5-audio-player
react-h5-audio-player - npm
3 weeks ago - A customizable React audio player. Written in TypeScript. Mobile compatible. Keyboard friendly. Latest version: 3.10.1, last published: 6 months ago. Start using react-h5-audio-player in your project by running `npm i react-h5-audio-player`. There are 64 other projects in the npm registry using ...
      » npm install react-h5-audio-player
    
Published   Aug 24, 2025
Version   3.10.1
Author   Hanz Luo
🌐
Medium
medium.com › @jerrysbusiness › playing-a-sound-file-in-a-react-project-bd0ad079ad93
Playing a sound file in a React project | by Jerry | Medium
October 5, 2019 - Ok. Time to search “HTML5 audio react” · I found this: <div> <audio ref=”audio_tag” src=”./assets/sound.mp3" controls autoPlay/> </div> Once I wired this up, it also worked. I knew the refs should be avoided in most cases and I wondered if this was the best way to handle it.
🌐
Mozilla
developer.mozilla.org › en-US › docs › Web › Media › Autoplay_guide
Autoplay guide for media and Web Audio APIs - Media | MDN
December 20, 2024 - 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.
Top answer
1 of 3
11

After some experimenting I discovered that the mp3 file needs to be imported (using import) in order to be able to play it within this environment.

So i've found a solution and edited my AudioPlayer component as follows (which works perfect):

import React, { Component } from 'react';
import './music-player.css';
//Now we import the mp3 file that this JavaScript file uses.
//This will ensure that when the project is built, 
//webpack will correctly move the mp3 file into the build folder, 
//and provide us with the right paths.  
//See docs: https://create-react-app.dev/docs/adding-images-fonts-and-files/
import mp3_file from './sounds/0010_beat_egyptian.mp3'; 

const AudioPlayer = function(props) {
    
        return (<audio id="audio_player">
        <source id="src_mp3" type="audio/mp3" src={mp3_file}/>
        <source id="src_ogg" type="audio/ogg" src=""/>
        <object id="audio_object" type="audio/x-mpeg" width="200px" height="45px" data={mp3_file}>
            <param id="param_src" name="src" value={mp3_file} />
            <param id="param_src" name="src" value={mp3_file} />
            <param name="autoplay" value="false" />
            <param name="autostart" value="false" />
        </object>
        </audio>    
        );
  
}
export default AudioPlayer;

Update 2022

In certain cases it is better to store your files (images, mp3 files etc) in the public folder. Such cases include if you need to load these files dynamically to your app. (see the docs https://create-react-app.dev/docs/using-the-public-folder/)

Due to the fact that (in my project) I have multiple mp3 files that I wanted to load dynamically I discovered that storing my mp3 files in the public folder was more suitable to my app.

Note: When storing your files in the public folder you don't need to "import" them but you must use the public environment variable (process.env.PUBLIC_URL) so that the correct path (to your public folder) will be referenced.

So here is my new solution:

  1. I created a folder in the public folder called sounds.
  2. I then changed my the Audio component (in the original post) to the following:

.

import React from 'react';
    const AudioPlayer = props => {
      
      let mp3_file = process.env.PUBLIC_URL + props.sounds[props.currentSoundIndex].mp3;
      return (<audio id="audio_player">
        <source id="src_mp3" type="audio/mp3" src={mp3_file} />
        <source id="src_ogg" type="audio/ogg" src={mp3_file} />
        Your browser does not support this audio player.
      </audio>  
      );
    }
    
    export default AudioPlayer;

Note: If you decide to store your files in the public folder then they won't be part of the webpack build and so therefore if a file is missing we won't get an error during compilation so we won't know it's missing. (The user will get a 404).

If you choose to store your files in the src folder then you need to use import so that webpack will know to include the files in the build. The upside to this is that you will get an error during compilation if any of the files don't exist.

2 of 3
5

Try:

import React, { Component } from 'react';
import mp3_file from './sounds/0010_beat_egyptian.mp3';

const AudioPlayer = function(props) {
  return (
    <audio src={mp3_file} controls autoPlay/>
  );
}
export default AudioPlayer;
🌐
CodeSandbox
codesandbox.io › s › 2mcw1
Sound-AutoPlay - CodeSandbox
February 26, 2021 - Poc on sound Policy .wihtout user interaction on document we cant autoplay any audio in browser their are some edge case in ios older versions that user interaction should be in the scope of audio that needed to be played
Published   Jan 05, 2021
Author   SachinSh97
🌐
Reddit
reddit.com › r/reactjs › react - play audio only when fully loaded
r/reactjs on Reddit: React - play audio Only when fully loaded
May 1, 2017 -

Hello!

I want to play the audio only when it's fully loaded. So if someone has slow network connection it won't stutter. My component looks like this:

class MusicLoop extends Component {
    state = {
        isLoaded: false
    }

    componentWillReceiveProps(nextProps) {
        if (nextProps.song !== this.props.song) {
            this.setState({
                isLoaded: false
            });
        }
    }

    playSong = () => {
        this.audio.play();
        this.setState({
            isLoaded: true,
        });
    }

    render() {
        const { song } = this.props;
        const { isLoaded } = this.state;

        return (
            <div>
                { isLoaded ? 
                    <Image src={image} responsive/> :
                    <div className="loader"></div> 
                }
                <audio
                    ref={audio => this.audio = audio}
                    preload="auto"
                    src={require(`../static/songs/${song}.mp3`)}
                    loop={true}
                    autoPlay={false}
                    onCanPlayThrough={() => this.playSong()}
                />
            </div>
        );
    }
};

If I set Throttling in Network tab in Chrome DevTools to GPRS (50 kb/s) it will start playing the audio part by part, which is terrible :/.

How to play audio only if it is FULLY loaded?

🌐
YouTube
youtube.com › watch
How to Autoplay Audio on Page Load in React using useEffect - YouTube
Discover the secrets to autoplaying audio with the `useEffect` hook in React while circumventing common browser restrictions.---This video is based on the qu...
Published   July 29, 2025
Views   47
🌐
Npm
npm.io › search › keyword:autoplay
Autoplay | npm.io
reactjwplayerjw-playervideoautoplayevents1.4.1 • Published 8 years ago · A simple way to autoplay youtube videos on mobile devices. autoplayyoutubevideospauseplaygooglejavascriptes2015alisonmonteiro0.0.4 • Published 9 years ago · Autoplays an inline <video> w/ audio if possible, muted otherwise