Reputation: 181
I am coding an e-card for fathers day but i have run into some problems- my code for playing audio doesn't make the music play. Any advice on how fix this would be much appreciated. Here is the code for the music:
<audio autoplay loop>
<source src="Republic - Rád gondoltam.mp3">
</audio>
And here is the code for the whole thing.
<html>
<head>
<title>Happy Father's Day</title>
<style>
img {
margin: 0;
position: absolute;
top: 50%;
left: 50%
margin-right: -50%;
transform: translate(-50%, -50%)
}
</style>
</head>
<body>
<audio autoplay loop>
<source src="Republic - Rád gondoltam.mp3">
</audio>
<center>
<img src="output_tzHVLY.gif" />
</center>
</body>
</html>
Upvotes: 0
Views: 58
Reputation: 67778
You have to add the file type:
<audio autoplay loop>
<source src="Republic - Rád gondoltam.mp3" type="audio/mpeg">
</audio>
Also, I would check for the exact name of the file - "Republic - Rád gondoltam.mp3" seems to be a not-so-good filename (includes spaces and special charcter á) - maybe change the filename to something like "republic_rad_gondoltam.mp3"
Upvotes: 1