flvplayer is a FLV player, built in ActionScript.
The main goals of the project are:
- have a functional player with a proper open source license (MIT)
- being able to compile the player using only Open Source tools (MTASC, swfmill, Ruby)
- have a simple codebase that can be used on a more complex project
You can use the following variables in your HTML (* are required):
String. URL to the FLV video you want to play. It can be relative ('/video/test.flv') or absolute ('http://site.com/video/test.flv)
String. URL to the image you want to display as a placeholder. It is displayed before the video plays, and after it ends.
Makes the video play automatically when the SWF is loaded.
Number. Default aspect ratio to be used for your movie. By default it's 16/9, but if the FLV contains width and height metadata it will be used for auto aspect_ratio calculation.
String. URL to an image to be displayed on top of the video (like a TV station logo, for example).
The position can be specified by using the 'watermarkPosition' variable:
where 'position' is a string with a value of TL, TR, BL or BR (for Top Left, Top Right, Bottom Left or Bottom Right). If you don't specify anything, the default position is BR (Bottom Right).
Enable pseudostreaming support.
Whenever the user tries to watch a segment that is not loaded yet, the player will make a request to the server, with this format:
Enable the fullscreen button.
When this option is set, the controls are not displayed by default.
The player supports FLV pseudostreaming. It is disable by default.
Take a look at the sample sinatra app (app.rb) to see how it works.
The sinatra app requires the 'rack-contrib' gem, so install it with:
$ gem install rack-contrib
To use pseudostreaming in your FLV files, they need to contain some metadata. You can embed this metadata by using flvtool2:
$ sudo gem install flvtool2 $ flvtool2 -U your_video_file.flv
NOTE: Don't even think of running the sinatra app in a production environment. Use a real webserver and take a look at these articles:
flvplayer has been created using fluby, so compilation is pretty straightforward:
$ cd flvplayer $ rake
There are some additional rake tasks available:
- rake clobber_package # Remove package products
- rake package # Build all the packages
- rake release # Build a release version of flvplayer (with trace() disabled)
- rake repackage # Force a rebuild of the package files
- rake test # Test the SWF file in your default browser
All images used in the player are available inside the 'assets' folder, in Fireworks CS3 vector format.
If you want to change the look & feel of your player, just edit the PNG files and recompile.
flvplayer is released under the MIT License. Feel free to use the software as you please, but it would be nice if you shared your improvements even if it's not required :)
Copyright (c) 2009 Ale Muñoz
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.