MC9000
MC9000

Reputation: 2403

IE bug Invalid Source HTML5 audio - workaround

I (and about a million others) have found a bug in IE11 (not sure if other versions have the same bug) where, if you create an HTML5 audio tag, the browser reports "Invalid Source" no matter what. I've tried every combination I can think of with no luck. So far:

I have checked Microsoft's "Connect" website. They make the claim that it is not reproducible, but hundreds of thousands of Google results suggest otherwise.

Is this not possible at all? ALL other latest & greatest browsers I tried work (Firefox, Opera, Safari, Chrome). No solutions work.

Here's the code:

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="AudioPopupPlayer.aspx.vb" Inherits="AudioPopupPlayer" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
        <div style="padding-top: 30px; margin: auto; width: 300px;">
        <asp:Literal ID="litVoiceOver" runat="server"></asp:Literal></div>
</body>
</html>

Code behind:

Partial Class AudioPopupPlayer
Inherits System.Web.UI.Page

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
    Dim VoiceOverFileName As String = Request.QueryString("vo")
    If VoiceOverFileName.Length > 0 Then
        Dim root As String = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + ResolveUrl("~/")
        Dim audiosource As String = "<audio id=""VoiceOver"" autoplay=""autoplay"" preload=""preload"" controls=""controls""><source src=""" & root & "audio/" & VoiceOverFileName & ".ogg"" type=""audio/ogg"" ></source><source src=""" & root & "audio/" & VoiceOverFileName & ".mp3"" type=""audio/mpeg"" ></source><source src=""" & root & "audio/" & VoiceOverFileName & ".wav"" type=""audio/wav"" ></source></audio>"
        Me.litVoiceOver.Text = audiosource
    End If
End Sub

 End Class

And, finally, a screenshot (in IE11) showing that the HTML is rendered perfectly, yet I still get the dreaded "Invalid Source" message (NOTE: copying and pasting the link causes the audio file to play - go figure).

bug in IE 11

Upvotes: 9

Views: 10311

Answers (5)

mattferderer
mattferderer

Reputation: 974

Check the browser's response headers for the audio file response. I ran into this issue due to a server not being configured to send the audio file as an audio/mpeg. Someone had mp3s set to application/octet-stream in IE. Once I fixed this, everything worked fine.

Upvotes: 0

npocmaka
npocmaka

Reputation: 57252

A comment from here:

Posted by Jonathan Laughery on 23.5.2014 at 22:19 This is because IE's HTML5 audio tag doesn't support WAV PCM format. This is especially weird because IE does support WAV PCM in the deprecated bgsound tag, WAV PCM has been the native Microsoft Windows audio format forever, and Microsoft's is the only major browser that doesn't support it. WAVs are still popular in sound archives and used on corporate networks, but playing WAVs in IE requires the bgsound tag (IE-specific, deprecated, and poor control), transcoding on the server, or using a flash player (like jPlayer's fallback) which is what the HTML5 audio tag was designed to avoid. Please add this format.

Here's the documentation about bgsound . If you going to use bgsound this might be helpful

Upvotes: 0

Rogier
Rogier

Reputation: 1240

We have experienced the same issue in a corporate environment with fresh installs of IE11 and Windows 7.

We have resolved the issue by installing the K-Lite media pack and have an alternate MP3 codec installed. Then it worked.

Upvotes: 0

guest123
guest123

Reputation: 21

I had the same issue trying to use the simple HTML5 code. The url and file name were correct as well. This is what worked for me:

<audio src="song.mp3" controls autoplay></audio>

You can remove the controls if you don't need them, it's still going to work. I hope this helps!

Upvotes: 2

MC9000
MC9000

Reputation: 2403

I tried a couple of new file formats. Internet Explorer 11 only supports the M4A audio format (WAV, OGG & MP3 are not supported). Microsoft really needs to put the correct information on their website about what their browser supports (they claim MP3 is supported, but clearly, it is not). Madness, I tell you!

Upvotes: 0

Related Questions