[dancer-users] setting mime type

Hermen Lesscher hermen at lesscher.org
Sun Jun 30 08:42:00 BST 2013

Hi Puneet,

A bit off-topic, but I had trouble with a similar setup, serving the 
video files with Dancer did not work for me (using the send_file 
method). Well, it worked everywhere, except on iOS devices (iPAd, iPhone).
I had to resort (very unwillingly, there is a lot of access checking 
involved) to serving the videofiles via Apache, and the rest of the 
Dancer app proxie'd (using starman).

My experience was that it had nothing to do with mime-types, but more 
with quirks in iOS, but I would love to be corrected on this.

Hope this helps,

Regards, Hermen Lesscher
(A happy Dancer user)

On 30/06/2013 08:51 , Mr. Puneet Kishor wrote:
> I am sending back to the browser html5 video code via JSON as shown below. The code then loads mp4 video, but I need to set the correct mime type for the video. How do I do that with Dancer?
>      get '/p/:uri' => sub {
>          return to_json {
>              html =>  qq{
>                  <video width="960" height="540" poster="path/to/$mov.jpg" controls>
>                      <source type="video/mp4" src="path/to/$mov.mp4" />
>                      <source type="video/m4v" src="path/to/$mov.m4v" />
>                      <source type="video/ogg" src="path/to/$mov.ogv" />
>                      <source type="video/webm" src="path/to/$mov.webm" />
>                      Sorry, your browser has no video playback capabilities
>                  </video>
>                  <br />
>                  <b>$title</b>
>              };
>          };
>      };
> Note that the "path/to/.." is relative to the Dancer app, so the video is being served by Dancer. For a totally orthogonal reason I am unable to serve the static files from a different web server.
> Many thanks,
> --
> Puneet Kishor
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users

"I urge you to please notice when you are happy, and exclaim or murmur
or think at some point, 'If this isn't nice, I don't know what is.'"
                                                         -- Kurt Vonnegut

More information about the dancer-users mailing list