Opera natively plays WMV files? - asp.net

I was working on playing videos in HTML5 and displaying other content instead if the browser cannot play the video. I was looking at the results in Opera, and it played a WMV! I was really surprised. My installation of Opera is a fresh install with no extensions. It doesn't play if I try it the normal way, but when using an ashx handler and sending the content as MP4, it works!
It does not work if I change it to the correct MIME type for WMV files.
VideoHandler.ashx
' load file above and get bytes (the file is a WMV)
Dim bytes As Byte() = file.FileBytes
context.Response.ContentType = "video/mp4" ' yes, I send it as an MP4
context.Response.OutputStream.Write(bytes, 0, bytes.Length)
HTML5 (my content is added dynamically using ASP.NET, but I'll simplify it here)
<video id="video" src="~/VideoHandler.ashx?&filesource=somesource&token=123456789" controls>
Video preview not available
</video>
My question is essentially, how is this working?
I couldn't find any articles by searching that would indicate that Opera can play a WMV. This method doesn't play the WMV in Chrome, Firefox, or IE11.
Note: I know that my "Video preview not available" content doesn't actually display on browsers that can't play the video, but this is unrelated to my question.

Related

PDF rendering issues on IE 11

All, I am working on an ASP.NET 4.6.1 web forms application that renders pdf documents natively on a browser.I get an error message only on IE 11 when some pdf documents are rendered as shown in the screenshot saying "The file is damaged and could not be repaired.Local\EWH-6624-0".The same document renders fine on Chrome and FireFox.Has anyone encountered the same issue? I downloaded the same pdf file in Chrome and tried to open this in Adobe Reader version 11.0.22, it gives me the "There was an error opening this document."The file is damaged and could not be opened".Please see the screen shots below
The asp.net application gets the data from a service and renders it on the UI.This is the C# code that does this
var data = getdataAndOtherThingsFromService();
Response.ContentType = "application/pdf";
Response.AddHeader("content-length", data.DocumentStream.Length.ToString());
Response.BinaryWrite(data.DocumentStream);
IE isn't rendering the PDF. As the dialog clearly indicates, the Adobe Reader plugin is attempting to render the PDF but is unable to. That's why you get the same dialog when you download the file and open it.
Chrome, Firefox, and Edge, and even PDF files hosted on Dropbox have their own PDF rendering engines built-in and, apparently, are more forgiving of badly formatted PDF than Adobe Reader is.
Unfortunately, you will never be able to create a consistent experience if you rely on the browser, or browser plugins to render your PDF files. Instead, you'll need to implement something like PDF.js which, while not a perfect PDF rendering tool, will at least behave predictably across browsers and operating systems.
Adding the code below that fixed my issue.This might be helpful to someone in the future
var data = getdataAndOtherThingsFromService();
Response.ContentType = "application/pdf";
Response.AddHeader("content-length", data.DocumentStream.Length.ToString());
Response.BinaryWrite(data.DocumentStream);
Response.End();

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:
Changing the HTML end tags from self-closing to explicit
Changing the file name to eliminate any odd characters
Changing the audio sub format to every possible setting
Adding an explicit URI ("http:// ...")
Disabling all plugins (there were on the stock plugins)
Trying every possible audio format
Defining the MIME type
Changing the audio tag's parameters.
Changed the IIS settings to include the MIME types.
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).
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!
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!
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.
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
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.

Can't stream AAC file with HTML5 on iOS Safari

I'm trying to embed this stream in to an HTML5 audio tag to be targeted at iOS mobile safari users: http://cjzn.streamon.fm/listen.m3u
After searching around I discovered that you can't embed M3U files directly with an HTML5 audio tag. So I saved that M3U file and opened it up, and it's only contents were:
http://cjzn.streamon.fm:8000/CJZN-48k.aac?starttime=1372879409
My next logical step was to try and embed that AAC file in to the audio tag, like so:
<audio src="http://cjzn.streamon.fm:8000/CJZN-48k.aac", autoplay="true"></audio>
But I still can't seem to get it working. Can anyone help me out?
As well, taking a step back to the M3U file - would it be smarter to try and use an M3U parser and convert the file in to a playlist that an audio player like jPlayer could play? What's the best option for me here? All I want to do is embed this stream in to my mobile Safari app.
At the moment AAC+ giving headache when it comes to Flash and HTML5. But actually you can link your M3U file from your Safari web app.
Steps -
Just create M3U file and upload it to your web server.
Then put a HTML link to that M3U file.
Example : <a href="playlist.m3u'>Play Stream</a>
All Apple devices will play that stream. I checked mine with Ipad, Iphone and Ipod touch.
I hope this will help you. Good luck !

Displaying images and documents using asp.net across several browsers

I have a webpage called DisplayBinaryData.aspx - the purpose of this page being to display/download any word, excel, pdf or images. I call this webpage and pass the id of my BinaryData entity using a querystring. The BinaryData entity contains the file, filename and contenttype uploaded using the asp.net fileUploadControl. The code in the page load is below:
BinaryData obj = GetBinaryObjectById(int.Parse(Request.QueryString["id"]));
Response.Clear();
Response.BufferOutput = true;
Response.AddHeader("Content-Disposition", "attachment; filename=" + obj.FileName);
Response.ContentType = obj.FileContentType;
Response.BinaryWrite(obj.BinaryFile);
Response.Flush();
Response.Close();
Response.End();
This code executes perfect in IE,but fails when executed in FireFox. IE prompts the user, either to save or open the content. FireFox also prompts the user, but the dialog box fails to save or open any content. When executing this in google chrome - there is no dialog box, it starts downloading the content automatically.
My question: I need this code to be compatable with FireFox - any suggestions?
The behavior you mention with Chrome is just do to the default settings for Chrome. You can change those by going to the "Under the hood" tab of the Options window. Then select the "Ask Where to save each file before downloading" checkbox.
Does your obj.FileName have a space in the name?
See this post on "Content Disposition" in different browsers.
Content Disposition in different
browsers
Today I had to resolve an issue where
in different browsers the filed
dynamically generated download worked
very differently / at all
The setup, we had an xml file with a
custom extension, say .mj, which was
being served up by ASP. The HTTP
Header had a content disposition
header and a response type set.
Response.AddHeader "Content-Disposition", "attachment; filename=""our file.mj"""
Response.ContentType = "text/xml"
This worked fine in Internet Explorer, the
file was downloaded as "our file.mj".
However FireFox and Chrome acted very
differently, in FireFox the file was
downloaded as just "our", and Chrome
as "our file.xml". In FireFox it
appears that the issue is caused by
having a space in the file name, this
forum post by funkdaddu helped me on
this, so by removing the space FireFox
could now download the file as
"ourfile.mj". ...

How to embed audio file in HTML if it's being sent as octet-stream?

I'm trying to write a Greasemonkey script that will convert all "Play" links on a page to embedded audio (using the <embed> tag).
When I use a link that I get from a GMail attachment, it works like a charm.
When I use a link from another site (Digium Switchvox), the HTTP response header has ContentType set to "application/octet-stream" instead of "audio/x-wav" (like GMail's link). This confuses Firefox, which decides that I don't have the right plugin installed. If I set the type attribute in the <embed> tag to "audio/x-wav", Firefox uses Quicktime to load the file. Quicktime gets confused, however, and won't play the file.
Does anyone know of a clever way to solve this problem?
have you tried overrideMimeType?
overrideMimeType
String (Compatibility: 0.6.8+) Optional.
A MIME type to specify with the request (E.G. "text/html; charset=ISO-8859-1").

Resources