Note that there are some explanatory texts on larger screens.

plurals
  1. POProvide mp4 video through a c# ashx handler doesn't work on the iphone
    text
    copied!<p>I'm trying to provide a mp4 file using a ashx handler and it doesn't work on the Iphone. Works in Safari PC though.</p> <p>I want this to work(ashx):</p> <pre><code>&lt;video width="100%" height="auto" controls=""&gt;&lt;source type="video/mp4" src="play.ashx"&gt;&lt;/source&gt;&lt;/video&gt; </code></pre> <p>Instead of (mp4):</p> <pre><code>&lt;video width="100%" height="auto" controls=""&gt;&lt;source type="video/mp4" src="play.mp4"&gt;&lt;/source&gt;&lt;/video&gt; </code></pre> <p>Here is my code:</p> <pre><code> public void ProcessRequest(HttpContext context) { context.Response.ClearContent(); context.Response.ClearHeaders(); var length = new System.IO.FileInfo(context.Server.MapPath("~/big_buck_bunny.mp4")).Length; context.Response.CacheControl = "Public"; context.Response.AddHeader("Content-Length", length.ToString()); context.Response.ContentType = "video/mp4"; context.Response.WriteFile(context.Server.MapPath("~/big_buck_bunny.mp4")); context.Response.Flush(); context.Response.Close(); } </code></pre> <p>Here is the file if you want to download: <a href="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" rel="nofollow">http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4</a></p> <p>The reason why I have to do this is because client wants to control the access to videos.</p> <p>Fiddler info(only the differences):</p> <p><strong>Request Iphone:</strong></p> <pre><code>User-Agent: AppleCoreMedia/1.0.0.9A405 (iPhone; U; CPU OS 5_0_1 like Mac OS X; en_us) Accept: */* Range: bytes=0-1 Accept-Encoding: identity Connection: keep-alive </code></pre> <p><strong>Request Safari Windows</strong></p> <pre><code>User-Agent: QuickTime/7.7.1 (qtver=7.7.1;os=Windows NT 6.1Service Pack 1) Pragma: no-cache </code></pre> <p><strong>The responses are identical</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload