Hey web gurus!
I have a web app. I want to use the HandleURL event to return a .mov file and I want that file to simply show and play in the client browser.
Now I know there are tons of compatibility caveats with formats, codecs, etc… but just hang on with me. All things being the same (browser, platform, movie file), what I want is to have the same behaviour when a movie file is requested by the browser, no matter if the file is sent from a standard Apache web server or from my web app.
So to start, I placed a movie file test.mov on my Apache server and typed its url http://myserver.com/test.mov in Safari 9.0.3 on my Mac. The browser plays the movie directly. This is the direct file, no html/flash player or anything. Since Safari knows how to handle that file, it plays it.
However, I cannot get the same result with a web app using the same browser to access the same file.
Here’s what I have tried in the HandleURL event:
dim thefile as folderItem = GetFolderItem("test.mov")
Request.File = thefile
Request.Header("Content-Type") = "video/quicktime"
Request.Status = 200
return true
This results in Safari downloading the file and opening it with Quicktime Player. Analyzing the headers returned automatically by the web app, I saw that Xojo adds [quote]Content-Disposition: attachment; filename=“test.mov”[/quote] to the page returned. So it makes sense that the file is saved: the browser responds correctly to the server instructions.
To override that, I cleared the request headers with
Request.Header("Content-Disposition") = ""
With this, the browser displays it’s player… but it’s just the play bar saying “loading” and the movie never starts. I can click play/stop all I want, nothing happens.
I thought maybe Apache adds some special headers that the web app does not. So I checked the headers returned by Apache (using curl -I) to see if there would be something I’m missing. I saw that Apache returns Accept-Ranges: bytes so that hinted me that maybe the browser sends additional data to the server for playback positioning, and so after some googling, I tried adding
Request.Header("Accept-Ranges") = "none"
… but it didn’t help. Still stuck with the frozen player.
So what am I missing?