I want make the music automatically,but it dosn't work.
<embed src="music/1.mp3" autostart="1">
I tried autostart="true";
Asked
Active
Viewed 391 times
0

Deng
- 1
- 1
-
can u add a working demo? – Alopwer Mar 18 '20 at 16:02
-
What web browser / version are you using? See also https://stackoverflow.com/questions/20286541/html-embed-autoplay-false-but-still-plays-automatically – Mark Stewart Mar 18 '20 at 16:43
2 Answers
1
After the policy changes, Chrome doesn't allow autoplaying embed audios.
Discussion about changes in Chrome
What you can do is to autoplay the muted video:
<video controls autoplay muted>
<source src="music/1.mp3" type="audio/mp3">
</video>
You can find more work arounds here: How to make audio autoplay on chrome

Paweł Własiuk
- 96
- 1
- 8
0
You don't want quotes around 1
or true
. Adding quotes makes them strings as opposed to boolean.
I would suggest looking into using html5's <audio>
element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio

Rob Moll
- 3,345
- 2
- 9
- 15