I like it and more

Oct 31, 2012 at 7:58 PM

I have been looking for a way to stream video to iPhone from SharePoint site until I found this.  The bad thing is SharePoint is not MVC based.  The good thing is this solution can easily remove MVC dependency.  I replaced all usages of ControllerContext to HttpContextBase which is what the code really needs.  Then I can easily use it in a HttpHandler.

Would you mind to add support to non-MVC applications?

P.S. I also find it doesn't work in Chrome most of the time.

Conrad

Nov 1, 2012 at 2:13 AM

Thanks for the feedback! I'm glad it was helpful and you were able to hack out the bits you needed.

I thought I cited the source of some of the request parsing but maybe it didn't get migrated when I rewrote some things. Much of the parsing logic came from an HttpHandler module already freely available. This project stemmed from an attempt to help answer a StackOverflow question regarding streaming to iOS from MVC. I haven't put much thought into other platforms. The point was to be able to support the stream without exposing direct links to files - in a higher level abstraction than an HttpHandler or module.

I honestly haven't used this code for anything myself but I have done some testing with the various browsers for serving up downloads and streaming video on all the major browsers. Of course this was back when MVC 2 was still new so that had to be about 260 versions of Chrome ago.

Do you have any particular set up to replicate what you mean by Chrome not always working? A capture of the request and response headers would be immensely helpful at trying to track down the particular problem. I'd be quite interested in figuring it out.

As an aside - I'm interested in your approach. I wonder if what you've done would lend itself more readily to a reusable library that could be plugged into / wrapped by multiple platforms. Not to mention it could use an update! I've recently used some code that leveraged

WebOperationContext.Current.IncomingRequest.CheckConditionalRetrieve

and I'm curious if that could be used to simplify some of the custom code. Of course my time has been very limited lately!

-Erik

Nov 1, 2012 at 9:59 PM

I guess I missed all other implementations except yours :).  My modified design works the same level as your original one.  Once I refactored the code to be MVC independent, I wrap the code in my custom MobileVideo.ashx.  A simple page will then be used to show the videos using <video> tag i.e. <video src='/MobileVideo.ashx?Url=/Videos/Hello.mp4'>.   The videos can be played perfectly fine in iPhone.   The handler of course can move down even more to conditionally map to .mp4 files via web.config, if we like to hide this complexity better.

The same sample page does not work in Chromes (I believe it miraculously worked once or twice.)  If I open the Chrome debugger, I will see those ashx requests are in either cancelled or pending states.

If you are interested, I would love to send you my updates to the codes and screenshots to Chrome issues.  Please let me what is the best way to send to you.

Cheers,

Conrad

Nov 13, 2012 at 3:54 PM

Any chance you could post that ashx code on github?  I'd be very interested to see what you did.