23

I've tried many, many different configurations, files, encoding, browsers, etc..., but this is the simplest example that demonstrates the problem I am having.

If you paste the url for the sample video for JSPlayer in FF 8.0.1, the video plays inline:

http://video-js.zencoder.com/oceans-clip.webm

If I take that same video and upload it to my s3 bucket, it triggers download instead:

https://s3.amazonaws.com/turingvideos/oceans-clip.webm -- or -- http

(Permissions are read for everyone on the file and bucket)

So, let's try Cloud Front.

d2yat6m71lu23b dot cloudfront dot net slash oceans-clip.webm (download trigger)

And Cloud Front streaming:

strzsu4h2ax96 dot cloudfront dot net slash oceans-clip.webm (infinite spinner)

The same basic things happen when using an html video tag as well. Works fine from zencoder, borked on anything other than local disk read.

So, what magic is zencoder managing that is completely out of my reach with S3/CloudFront? I'm completely stumped.

Edit:

Setting the content type and disposition to "video/webm" and "inline" did the trick. Thanks for the quick response guys.

turing1
  • 281
  • 1
  • 3
  • 7

1 Answers1

48

Using the S3 web management console (https://console.aws.amazon.com/s3), select your bucket, right-click one of your video files, switch to the metadata tab and set 2 headers:

  • Content-Type: whatever your video file's content type is
  • Content-Disposition: inline

Also, make sure your CloudFront distribution is set as a "streaming" distribution and not a "download" one.

Edit:

From the AWS docs:

CloudFront servers don't determine the MIME type for the objects they serve. Therefore, when you upload an object to your origin, you should set the object's Content-Type header.

Source: http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/ObjectMIMEType.html

Lior Cohen
  • 8,985
  • 2
  • 29
  • 27
  • 8
    @turing1 - if this answer was the solution to your problem, you should mark it as the accepted answer (tick mark on the left under the votes) – Geoff Appleford Jan 08 '12 at 21:03
  • Worked for me too. Here's another point. The s3 admin console has a meta drop down selection that does not offer things like "video/mp4", etc ... No problem though. You can just type your own into the drop down box. It took me a while to figure that out. Thanks! – Craig Van Sant Mar 27 '12 at 23:48