Reputation: 155
I'm trying to make a simple audio test in html5 (Windows 7) and it works in Firefox and Chrome, but not in IE11. Can anyone help me, please? This is my simple HTML file:
<!DOCTYPE html>
<html>
<head>
<title>My Title</title>
</head>
<body>
<audio controls>
<source src="myAudioFile.mp3" type="audio/mp3"/>
</audio>
</body>
</html>
I have read all questions related, but my problem is not fixed. Also, I tryed to add this, but still no luck:
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
I always get the "invalid source" message and I don't know what else can I do.
Upvotes: 5
Views: 15099
Reputation: 31
This will do the trick:
IE--> Internet Options--> Advanced--> Enable play sounds in webpages.
source: https://forums.asp.net/t/2111915.aspx?Error+Audio+Playback+was+aborted
Upvotes: 2
Reputation: 5473
The problem is that IE11 makes you enable the setting "Play Sounds in Webpage" before any sounds will play. Which, in my opinion, is a willing and intentional breakage of HTML5 audio. I'm so pissed at MS for this. They constantly go against what they preach, and they wonder why nobody uses their shitty browser anymore. Anyway, here's how to enable the setting:
Open Internet Explorer, click the Tools button,
Click Internet Options. Tap or click the Advanced tab
Under Multimedia, select Play sounds in webpage.
Click Apply, OK. Now check if you can play the mp3 files.
As far as a programmatic fix for this, I don't know of any. You could alert IE users to change their setting, or you could offer a download link as an alternative to the in-browser player.
Upvotes: 9
Reputation: 11
Some Times html5 audio tag doesnot work without controls or clear its chaches and try below code if any problem please reply. Hope so you are out of trouble. Have a good day
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Audio Tag</title>
</head>
<body>
<!--Before HTML5, Developer can add audio tag by Plug-in like FLASH. But HTML5 introduces an audio tag for embedded an audio media in a web page**strong text**-->
<audio controls="controls">
<source src="Allegro%20from%20Duet%20in%20C%20Major.mp3" type="audio/mp3">
</audio>
</body>
</html>
Upvotes: 1
Reputation: 9690
Your source type looks like it may be incorrect. Try this:
<audio controls>
<source src="myAudioFile.mp3" type="audio/mpeg"/>
</audio>
Upvotes: 1