Omitting Content-Length header breaks video play back in some browsers

Issue

Videos uploaded to AEM Assets play back properly in Apple Safari browser via publish instances, but not via dispatcher.  Once the file is fully downloaded, it play backs, however, it doesn't play during download.

Cause

Many things can break video play back via dispatcher.  However, the most common causes are wrong or missing Content-Length, Content-Type, or Accept-Ranges HTTP headers.

Resolution

The HTTP response headers for a video can be checked by using cURL to download the video: 

curl -v http://host/content/dam/test.mp4

The full output of the command can be seen below: 

$ curl -v http://host/content/dam/test.mp4
...
> GET /content/dam/test.mp4 HTTP/1.1
> User-Agent: curl/7.37.1
> Host: host
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Mon, 09 Jan 2017 20:27:50 GMT
* Server Apache is not blacklisted
< Server: Apache
< Last-Modified: Wed, 23 Nov 2016 23:22:56 GMT
< ETag: "17c0313-81a7de-542002b36d400"
< Accept-Ranges: bytes
< Content-Length: 8497118
< Content-Type: video/mp4

Validate that the Accept-Ranges and Content-Length headers are present and that the MIME type is correct.  

If Content-Length header is missing:

If you are using Apache web server and the Content-Length Header is missing, then it is likely due to a bad Server Side Include configuration.  When SSI is enabled on a file, then Apache omits the Content-Length header.

Search your Apache .conf files for "INCLUDES", you might find an incorrect configuration like this: 

SetOutputFilter INCLUDES;DEFLATE

If that is set, then it enables SSI on all files.  Instead, SSI should be enabled per file type, like this: 

AddOutputFilter INCLUDES;DEFLATE html

If Accept-Ranges header is missing:

Review your web server's configurations as most modern web servers have the range option enabled by default.

If you are using Apache then search the .conf files for this: 

Accept-Ranges none

If Content-Type header is wrong:

If the MIME type is incorrect, then you need to update your web server configuration, refer to the documentation for the web server you have Dispatcher installed in.

Here is a small non-inclusive list of video MIME types: 

Type

File Extension

MIME Type

Flash

flv

video/x-flv

MPEG-4

mp4

video/mp4

iPhone Index

m3u8

application/x-mpegURL

iPhone Segment

ts

video/MP2T

3GP Mobile

3gp

video/3gpp

QuickTime

mov

video/quicktime

Windows Media

wmv

video/x-ms-wmv

A/V Interleave

avi

video/x-msvideo

Adobes logotyp

Logga in på ditt konto