Yesterday, I wasted almost an hour to figure out the video streaming. Here’s how everything was setup:
- Video Player: Sublime Video – A free HTML5/Flash video player – http://sublimevideo.net
- Ruby on Rails
- Amazon S3 – Simple Storage Server – It is being used to store the video files.
Its pretty easy to get the sublime video setup on the website but the problem arises when you try to run the video in the player with MP4 and the video doesn’t stream. Video Player try to download the full video on to the local machine. After downloading the full video the player detects the encoding scheme and then plays the video. If you are facing the same problem I’ve the solution for you.
Here’s what I thought could be wrong:
- Something is wrong on Amazon S3 server(probably its not distributing the file in chunks).
- Probably something is wrong with the Video player
- Or the video file is not right.
I started my investigation in the order mentioned above.
I used Amazon CloudFront and hooked it up with my Amazon S3 bucket but nothing really worked.
Video player worked for other websites(http://railscasts.com/ is one of them). So, the Sublime Player is all good.
Culprit: I figured out that the video file was not encoded properly. It should use the following encoding scheme if you want to use that as a streaming video:
H.264/MP4