Autoplay with m4a/mp3

<audio controls autoplay>
 <source src="backgroundSound.m4a" type="audio/m4a">
</audio>

The code above seems not to work.
Can I make it work with your help?

Which browser are you using? Firefox blocks autoplay by default.

2 Likes

You may find this article helpful:

You should also remember:

Note : Sites that automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avoided when possible.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio

2 Likes
<audio controls autoplay><source src="myMusic.mp3" type="audio/mpeg"></audio> 

I have the code above a web page of mine.
The code “autoplay” doesn’t work on most browsers.
But it works on chrome with PC.
I like it works on chrome with PC.
However, with smartphone it doesn’t work on chrome.

Is there any smartphone browser that autoplaying of mp3 file works?
Or any trick for the autoplaying of mp3 file with mobile phone?

@joon1, I’ve merged your topic with an earlier one on the same subject. You might find the link given by @TechnoBear helps.

1 Like