I have a web application that i have developed in RoR 2.1
. In the app, users have the privilege of uploading media files. Currently, only FLV videos can be streamed online since i have given FLV
player browser support.I have used the gem Mime Types
to identify the file fomats of the media files being uploaded.
I would like to get the feasibility and ways to implement two new requirements
How can i stream all videos being uploaded online? Should I convert these files to flv or is there any other way of making it possible?
I want the users who upload the videos to set a privilege (count) of how many users can stream this video on line at a given time. How can i implement this?
1) for streaming you should use a CDN, this should not be the responsibility of your rails app. Lots of options, I have enjoyed working with S3/Cloudfront. Streaming through your app will really hurt the scalability of your platform. Lets the good folks at the CDN deal with this.
2) To throttle the usage -- I would do the following. When a web user wants to watch a video give them a link you your app (vs directly to the CDN) so http://myapp/video/watch
. In that method(VideosController#watch) you can count concurrent views, and if under the threshold then perform a secure redirect to the video.
If you must serve files directly from your server use send_file
method (doc)
If you are looking for video playback, there a bunch of javascript/html5 video solutions: VideoJS is a pretty good one: http://videojs.com/, It should be able to handle many different types of video formats enter link description here
Good luck