Reputation: 5483
I have a problem with this .aspx c# code:
protected void Page_Load(object sender, EventArgs e)
{
string url = Request["url"];
string type = Request["ext"];
if (!string.IsNullOrEmpty(url))
{
url = HttpUtility.UrlDecode(url);
WebClient client = new WebClient();
byte[] file = client.DownloadData(url);
if (file != null && file.Length > 0)
{
Response.Clear();
Response.Buffer = true;
Response.ContentType = "audio/mpeg";
Response.AddHeader("Content-Disposition", "inline");
Response.BinaryWrite(file);
Response.End();
}
}
}
It works fine in all browsers except IE. In IE, the < audio> tag player shows a cryptic message saying "Invalid Source". No console errors or warnings. I'm guessing I have a subtle error in my Response settings. Below is the < audio> markup, but like I said, it works on every browser except IE. I've gone way out of my way to try to make it work on IE -- once again, the most difficult browser to work with by far. After all these years, it's beyond heartbreaking. What the hell are people DOING at Microsoft?
<audio controls="true" preload="none">
<source src="http://localhost:8056/web/Recordings/RE4cdf6a142506328787e9c88cbf7c4885.mp3" type="audio/mpeg"></source>
Your browser does not support HTML5 audio. Please consider upgrading your browser to the latest version.
</audio>
Upvotes: 0
Views: 113
Reputation: 68
Which version of IE are you using?. HTML5 is compatible with IE 9+. You will require the HTML5shiv to provide compatibility for IE Browsers older than IE 9.
If using IE 9 you should use something like this:
<!-- Display the audio player with control buttons. -->
<audio src="http://localhost:8056/web/Recordings/RE4cdf6a142506328787e9c88cbf7c4885.mp3" controls autoplay loop>
HTML5 audio not supported
</audio>
Note: If you are developing on an intranet and have rendering issues for HTML5, you can add to the block of a webpage to force Internet Explorer to use the latest standards. If you prefer, configure your web development server to send a meta http-equiv-“X-UA-Compatible” header with IE=edge instead.
Upvotes: 1