Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to stream partial content with ASP.NET MVC FileStreamResult
    primarykey
    data
    text
    <p>We're using a FileStreamResult to provide video data to a Silverlight MediaElement based video player:</p> <pre><code>public ActionResult Preview(Guid id) { return new FileStreamResult( Services.AssetStore.GetStream(id, ContentType.Preview), "application/octet-stream"); } </code></pre> <p>Unfortunately, the Silverlight video player downloads the entire video file before it starts playing. This behavior is expected as our <code>Preview</code> Action does not support downloading partial content.</p> <p>(side note: if the file is hosted in an IIS virtual directory we can start playback at any location in the video while it is still downloading. however for security and auditing reasons we can't provide a direct download link. so this is not an option.)</p> <p><strong>How can we improve the Controller Action to support partial HTTP content?</strong></p> <p>I assume we first have to inform the client that we support it (adding an "Accept-Ranges:bytes" header to a HEAD request), then we have to evaluate the HTTP "Range" header and stream the requested file range with a response code of 206. Will that work with ASP.NET MVC hosted on IIS6? Is there already some code available?</p> <p>Also see:</p> <ul> <li><a href="http://en.wikipedia.org/wiki/List_of_HTTP_headers" rel="noreferrer">http://en.wikipedia.org/wiki/List_of_HTTP_headers</a></li> <li><a href="http://blogs.msdn.com/anilkumargupta/archive/2009/04/29/downloadprogress-downloadprogressoffset-and-bufferprogress-of-the-mediaelement.aspx" rel="noreferrer">http://blogs.msdn.com/anilkumargupta/archive/2009/04/29/downloadprogress-downloadprogressoffset-and-bufferprogress-of-the-mediaelement.aspx</a></li> <li><a href="http://benramsey.com/archives/206-partial-content-and-range-requests/" rel="noreferrer">http://benramsey.com/archives/206-partial-content-and-range-requests/</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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