3
votes

I have set up a simple ring server with a file server

(ns scratch.basic-test
  (:use [ring.middleware.file :only [wrap-file]]
        [ring.middleware.file-info :only [wrap-file-info]])
  (:require [ring.adapter.jetty :as jetty]))

(defn naked-handler [request]
  {:status 200
   :headers {"Content-Type" "text/html"}
   :body (str request})

(defonce server 
  (run-jetty (-> #'naked-handler
                 (wrap-file "resources/public")
                 wrap-file-info)               
             {:port 8890 :join? false}))

I have test.mp4 and video.html in the resources/public directory.


video.html references the mp4 file:

  ...blah...
  <video id="my_video_1" controls>
     <source src="test.mp4" type='video/mp4'>
   </video>
  ...blah...

when I open up http://server-ip-address:8890/video.html in safari, firefox and ie it works fine

however, when i open it up on the ipad, it does not.. a black cannot-play-rectangle is displayed instead.


when i put the same files in an apache server and open up video.html on the ipad the video plays perfectly....

what is going on?

1
i'm not sure how to do this in jettyzcaudate

1 Answers

1
votes

I'll reply here as comment section is too tight for to my taste :).

I think before changing anything it makes sense to take a look at the HTML headers. Compare what Apache gives you against ring. It could be that issue is related to the one described here or maybe it's something else. If you don't know how to see the header this might help.

As for modifying header I think if anything has to be modified it will be on the ring level not Jetty.

I ran your application here are headers:

Name    Value
Date    Wed, 12 Sep 2012 05:26:20 GMT
Content-Length  36320472
Last-Modified   Sat, 12 May 2012 21:04:47 +0000
Server  Jetty(7.6.1.v20120215)
Content-Type    video/mp4;charset=UTF-8

It played in Chrome, sorry I don't have an iPad to check it. Content length is correct it is equal to the original mp4 file size.

I guess unless you post headers from both servers there's nothing else I can do.