I wrote a basic range request class I was wanting to flesh out so html5 video and audio players could interact with my MVC app.
I have it functioning (but not fully featured for things like If-Modified) if I don't add the extension to the 'src' tags. Thing is on the routing I can't get any string with a "{filename}.{extension}" style of route to work. My guess is anything like that is assumed to be a static file and thus I never get the opportunity to fulfill the request. If I add a source without the extension it works.
So this works
<video id="my-video-player" class="video-js" controls preload="auto" width="640" height="264" src="@Url.Action("Index","Video",new { id = "SampleVideo_1280x720_20mb" })" type="video/mp4">
<p class="vjs-no-js">
To view this video please enable JavaScript, and consider upgrading to a web browser that
<a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
</p>
</video>
but this doesn't
<video id="my-video-player" class="video-js" controls preload="auto" width="640" height="264" src="@Url.Action("Index","Video",new { id = "SampleVideo_1280x720_20mb.mp4" })" type="video/mp4">
<p class="vjs-no-js">
To view this video please enable JavaScript, and consider upgrading to a web browser that
<a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
</p>
</video>
Does anyone know how I could make certain extensions potentially reroute to a handler of my choosing?
Edit:
Linked below is a method to make it work on 1 path, ideally I'd like to inject it so I could do it for any path, so I'd like to keep it open to see if anyone has more insight. As this method still would require you to have an IgnorePath also to make sure any direct path to your media files aren't handled by the static file handler instead of your MVC path.
<system.webServer>
<handlers>
<add name="Media-Handler" path="/Video/*" verb="GET" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
</handlers>
</system.webServer>