Proposed Answer IE9 does not play mp3 in audio tag

  • Tuesday, April 19, 2011 4:10 PM
     
     

    My release of IE9 is 9.0.8112.16421 installed today by Windows Update on my Vista (64).

    The following example copied from Microsoft does not play anything (just display a cross).

     

    <!doctype html>  

    <head>

        <title>Audio Element Sample</title>

    </head>

    <body>

        <h1>Audio Element Sample</h1>

     

        <!-- Display the audio player with control buttons. -->

        <audio src="test.mp3" controls autoplay > 

            HTML5 audio not supported

        </audio>

    </body>

    </html>

    Works well in Chrome and Firefox. The page is served by a local Tomcat server but does not work neither when opening the "file".

    For information the <video> tag works well (with a H264 src).

     

All Replies

  • Tuesday, April 19, 2011 7:53 PM
     
     
    No opening html tag
    Rob^_^
    Please always validate your markup.
  • Wednesday, April 20, 2011 5:38 PM
     
     

    Sorry for the copy / paste error. The html tag is of course open in the file.

    <!doctype html>  

    <html>

    <head>

        <title>Audio Element Sample</title>

    </head>

    <body>

        <h1>Audio Element Sample</h1>

        <!-- Display the audio player with control buttons. -->

        <audio src="test.mp3" controls autoplay > 

            HTML5 audio not supported

        </audio>

    </body>

    </html>

    But this file does not play anything (just display a red cross) in IE 9 (7 (64) as Vista (64)).

    Works fine in Chrome and in Firefox (but with a .ogg file, not a mp3).

  • Wednesday, April 20, 2011 10:59 PM
     
     

    Hi sports,

    Please see http://seanooi.net/audio-for-everybody/


    <AUDIO controls="controls"><SOURCE type="audio/ogg"
    src="http://downloads.seanooi.net/audio/seanooi.ogg"><SOURCE type="audio/mpeg"
    src="http://downloads.seanooi.net/audio/seanooi.mp3">
    <OBJECT classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" width="320" height="45">&lt;
    ! [endif]--&gt; <PARAM name="url" value="http://downloads.seanooi.net/audio/seanooi.mp3"><PARAM
    name="autostart" value="false"><PARAM name="uiMode" value="full"></OBJECT>
    <OBJECT id="audioplayer" data="flash/player.swf" width="320" type="application/x-shockwave-flash"
    height="24"><PARAM name="movie" value="flash/player.swf"><PARAM name="FlashVars"
    value="playerID=audioplayer&amp;titles=audio%20sample&amp;artists=Sean Ooi&amp;autostart=no&amp;soundFile=http://downloads.seanooi.net/audio/seanooi.mp3"><IMG
    class="fallback" title="No audio playback capabilities, please download the audio below"
    alt="Seanooi" src="http://downloads.seanooi.net/audio/mp3.jpg"></OBJECT><!--><!--<![endif]-->
    </AUDIO>

    which explains how to use the html5 source tag in conjunction with the <audio> tag to provide multiple media support for audio tags. Also the example page above provides a fallback to an <object> tag for support to non-html5 aware browsers.

    Regards.


    Rob^_^
  • Thursday, April 21, 2011 9:25 PM
     
     

    Hi,

    Using a distinct <source> tag with a type="audio/mpeg"  inside the audio tag does not change anything.

    It works in Chrome and Firefox (with a ogg file) but IE9 (32 as 64) still refuses to play the audio tag. The workaround for using a flash player is NOT my objective, I still try to use the standard HTML 5 tag <audio> in IE9 supposed as supporting this tag.

    It is true ? If IE9 is NOT supposed to implement the <audio> tag, my issue is not an issue. Else why IE9 does not play the <audio> tag?

    Regards.

     

  • Thursday, April 21, 2011 10:53 PM
     
     

    Hi,

    More information.

    If I use an external web server, the page works well.

    If I right click on my html file on my local disk and select "open in ... Internet Explorer", IE9 asks me "if I want to unblock a script or Active X "(???). Then it works well.

    If I use my local web server, IE9 does not ask anything and still blocks the content. Why ? Where is the secret "security" feature that blocks that ?

    Regards.

     

  • Friday, April 22, 2011 8:19 AM
     
     
    I think that you can mistake to copy the html tag otherwise i all play all the songs in internet explorer nothing this type of thing will be occur.Many times requires a plugin like flash player or silverlight.I suggest you also check that,they are working properly or not?otherwise first unistall the plugins which i tell then install and restart your pc.I think this work if not work then confirm the html tag copy by you is wrong or the html tag will not working amny times this happend.
  • Monday, April 25, 2011 3:32 PM
     
     

    <audio> and <video> tags of HTML5 do not require any plugin when implemented (case of IE9).

    The issue I have is with IE9 with a local Web server (Tomcat running on my PC): in this case the <video> tag works, not the <audio> one.

    If I specify directly a file as URL (D:/...audio.html) both work but I need to unblock  script/ActiveX.

    If I use another (of an external provider) web server <audio> and <video> tags work

    What type of restriction exist in the protocol with IE9.

    All cases described above work fine with Chrome.

  • Monday, April 25, 2011 4:07 PM
     
     

    Solved (but strange).

    Tomcat by default specifies for a .mp3 extension the MIME type audio/x-mpeg.

    Changing this default to audio/mpeg solves the issue.

    In other words IE9 is NOT comfortable with audio/x-mpeg but accepts audio/mpeg as MIME type of a resource for an <audio> tag.

  • Tuesday, May 03, 2011 7:44 PM
     
     

    IE9 seems to display web content from intranet in compatibility mode. To change that setting: -> Page -> Compatibility View Settings -> Uncheck "Display intranet sites in Compatibility View" ...

    Regards

    .PeH

  • Wednesday, May 04, 2011 9:18 AM
     
     

    I tried that. Does not change anything. mp3 has to be specified as audio/mpeg (and NOT audio/x-mpeg) and when the html page is loaded directly from the filesystem IE9 asks for authorization for invoking scripts/plugin.

    Regards.

  • Saturday, May 28, 2011 10:27 PM
     
      Has Code

    I'm having a similar problem to dsportes. The following code works fine on my local test server, but when uploaded to my live web site, it works in Firefox, Opera, Safari, and Chrome, but not IE9. Note the weird fact that going to any other page and then Back causes it to work even in IE9 (until a Reload).

     

    <!DOCTYPE html>
    <html>
    <head>
    <title>Audio test</title>
    <style>
    p { font-size: large; }
    </style>
    </head>
    <body>
    <h1>Audio test</h1>
    <p>An applause sound should play automatically each time this page is loaded,<br />
    and a control should be provided to play another sound.</p>
    <audio autoplay="autoplay">
    	<source src="http://www.bbemuseum.com/museum/media/effects/c-applause.ogg" type="audio/ogg" />
    	<source src="http://www.bbemuseum.com/museum/media/effects/c-applause.mp3" type="audio/mpeg" />
    	<source src="http://www.bbemuseum.com/museum/media/effects/c-applause.wav" type="audio/wav" />
    </audio>
    <audio controls="controls">
    	<source src="http://www.bbemuseum.com/museum/media/effects/c-adiada.ogg" type="audio/ogg" />
    	<source src="http://www.bbemuseum.com/museum/media/effects/c-adiada.mp3" type="audio/mpeg" />
    	<source src="http://www.bbemuseum.com/museum/media/effects/c-adiada.wav" type="audio/wav" />
    </audio>
    <p>But in IE9, I find that the sounds only play if I first link somewhere else
    such as<br /><br /><a href="http://www.google.com">http://www.google.com</a>
    <br /><br />
    and then press the browser's Back button.<br />Further, if I then Reload the page,
    it goes back to not working.</p>
    </body>
    </html>
     
    
    
    

    This code is also posted at  http://www.bbemuseum.com/museum/audio_test.htm

    • Proposed As Answer by dkurland Monday, May 30, 2011 3:41 AM
    • Unproposed As Answer by dkurland Monday, May 30, 2011 3:41 AM
    •  
  • Monday, May 30, 2011 3:42 AM
     
     Proposed Answer

    I think I’ve solved the problem.  I did some further testing, using separate <audio> tags for .mp3, .ogg, and .wav files, and discovered that, although Firefox is supposed to support .ogg and .wav, it was only working for me with .wav files.  So IE9 is supposed to work with .mp3, Firefox is supposed to work with .ogg, both worked fine on my local server, but failed with those file types on my live site.

     

    Shooting in the dark, I called tech support at my hosting service, and asked them if it was possible that .mp3 and .ogg files hadn’t been registered as MIME types audio/mpeg and audio/ogg, respectively.  The support guy offered to add those specifications to my site’s .htaccess file, and sure enough, .mp3 now works in IE9, and .ogg now works in Firefox.  The Back button thing?  I dunno, but I don’t care anymore.

     

    I guess IE and Firefox are more fastidious about MIME types than the other browsers.  Although my <audio>/<source> tags include type=”audio/mpeg” and type=”audio/ogg” attributes, these browsers seem to ignore them in favor of what the server says.  Is that a reasonable explanation for what I was seeing?


    - dkurland
    • Proposed As Answer by dkurland Monday, May 30, 2011 3:42 AM
    •  
  • Monday, May 30, 2011 5:09 AM
     
     

    Hi,

    That was an answer proposed in this question. re: MIME types. Read before you bottom post on questions that you did not start... MTL someone has already answered your question.


    Rob^_^
  • Tuesday, February 21, 2012 10:32 AM
     
     

    I am NOT able to do use the audio tag after changing DOCTYPE too.

    in my website www.iprameshkumar.com home page, i have audio tag, but its not working only in IE9.

    Any Clear Solution for audio tag?

  • Tuesday, February 21, 2012 12:52 PM
     
     Proposed Answer

    <!doctype html>

    see http://w3schools.com/doctype.asp or the links to the IE Developer center at the top of this forum.

    to save confusion please start your own threads with your own questions.

    Regards.


    Rob^_^

    • Proposed As Answer by IECUSTOMIZERMVP Tuesday, February 21, 2012 12:52 PM
    •