Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<audio> tag is not working in IE11

Tags:

html

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.

like image 904
Acel Avatar asked Jan 15 '16 00:01

Acel


People also ask

How do I enable audio in HTML?

HTML Audio - How It WorksThe controls attribute adds audio controls, like play, pause, and volume. The <source> element allows you to specify alternative audio files which the browser may choose from. The browser will use the first recognized format.

What will be displayed if browser doesn't support audio tag?

If the browser doesn't support the audio element, then it will display the message, “Sorry, but your browser doesn't support audio.”

How do I get HTML audio to play on my website?

Complete HTML/CSS Course 2022 To play sound file in the background on a web page, use the <embed>… </embed> element. Also, use the autoplay attribute. This will run music in the background whenever the page loads.

Is audio tag is supported in HTML5?

HTML5 supports <audio> tag which is used to embed sound content in an HTML or XHTML document as follows. The current HTML5 draft specification does not specify which audio formats browsers should support in the audio tag. But most commonly used audio formats are ogg, mp3 and wav.


2 Answers

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.

like image 172
Ringo Avatar answered Sep 19 '22 03:09

Ringo


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

like image 38
david Avatar answered Sep 19 '22 03:09

david