We are saying goodbye to ActiveDen on February 29. Please make sure you download any ActiveDen items before then! Read more.



Universal Flv Player in AS3

universalFlvPlayer is a basic flv video player written in AS3 using Flex Builder. The player is quite straightforward and can be used within any site, implementation requires no actionscript knowledge. Also adjusting the player can be done without touching the actionscript, global settings are stored in a xml file that is used onload. To adjust the player while loaded a Javascript API can be used.


    fullscreen is not working here on FlashDen, because allowFullScreen is not enabled in HTML
  • Easy implementation
  • Elegant minimal design
  • Flexible Javascript API
  • XML driven alignment
  • Loadprogress indication
  • Fullscreen button
  • Double click fullscreen toggle
  • Mouse hide on fullscreen
  • Controller hide on inactivity
  • Controller lock
  • Volume control
  • Spacebar play/pause toggle
  • Seek with preview


Implementation and fine-tuning

  • Adobe Flash Player 9</il>
  • HTML/Javascript Editor
  • Basic HTML knowledge</il>
  • Basic Javascript knowledge
Advanced editing
  • Adobe Flash CS3 (controller graphical adjustment)
  • Adobe Flex Builder (or Eclipse with Flex plugins)
  • Actionscript 3 and OOP knowledge
  • Basic HTML knowledge
  • Basic Javascript knowledge

Javascript controls:

  • playFlv(url) – Play a flv file by URL
  • setDimensions(width,height) – Set new video width and height
  • pause – Pause video
  • resume – Resume video
  • seek(time) – Seek in video (use seconds)
  • volume(value) – Set the volume
  • lock – Lock the controller
  • hide – Hide controller
  • show – Show controller

Wanna make your own Javascript Controlls?

Check out this file:

Important info of non-Flex users

In the example, in order to make it work offline, add the swf to your allowed locations list.

If you would like to compile the player from Flash in stead of Flex download the simpleVideoPlayer.fla

When you do this you wont see any video after hitting the splash image because the flv is normally provided in the Flex generated index.template. So you can either watch it from the example.html (so that it is provided with the flv source) or add an else statement at line 49 in simpleVideoPlayer.as.

That would look like this:

if (root.loaderInfo.parameters.flvSrc!=null) { CanvasManager.videoCanvas.playFlv(root.loaderInfo.parameters.flvSrc); } else { CanvasManager.videoCanvas.playFlv("yourVideo.flv"); }

Other AS3 files by me: