Skip to content

Video Streaming from S3 Object Standard storage class wont load via html5 video tag, but Glacier IR will.

0

My web application utilizes an html5 video element. When I load the page, I get a 206 status, which is normal. However, the video will not load or play. Any Glacier Instant Retrieval objects do load normally. The only difference I have found between the two is the storage class.

Is this normal behavior?

asked 9 months ago364 views

1 Answer
0

This is not normal behavior. The storage class itself (Standard vs. Glacier Instant Retrieval) should not directly affect how a video plays in an HTML5 video tag. Both storage classes provide millisecond access to your data.

The issue you're experiencing is likely related to how the content is being served rather than the storage class. When videos don't play in a browser but download instead, it's typically due to incorrect content headers. The most common causes are:

  1. Content-Type header: Make sure it's set to "video/mp4" (assuming your videos are MP4 format)
  2. Content-Disposition header: This should either be not set or set to "inline" (not "attachment")

When you upload objects to S3 through different methods (directly via console vs. through your application), these headers might be set differently. Your application might be setting the Content-Disposition header to "attachment" for the Standard storage class objects, which would cause browsers to download rather than play the video.

You can fix this by explicitly setting the correct headers when uploading or by modifying the metadata of existing objects:

aws s3 cp s3://your-bucket-name/video.mp4 s3://your-bucket-name/video.mp4 \
--metadata-directive REPLACE \
--content-type video/mp4 \
--content-disposition inline

For better video streaming performance overall, consider implementing Amazon CloudFront in front of your S3 bucket. This would improve load times and provide a better viewing experience for your users.
Sources
S3 Bucket links download video files instead of opening in browser | AWS re:Post
Hosting videos in S3 bucket | AWS re:Post

answered 9 months ago

EXPERT

reviewed 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.