Entry: flash mediaplayer widget

Description

The free flash media player widget can be used to play audio and video files on a website. The player automatically recognizes whether the media file is audio or video. The player can play mp3 audio files and flv and mp4 video files.

You can simply control the widget by passing flashvars to the swf file. One of the easiest ways is to use "swfobject", which is a javascript library that you need to include in the page where you want to view the diashow. Download swfobject from code.google.com.

The following flashvars can be used to control the widget:

  • playBarColor: the color of the play bar (for example: "ff000" for red)
  • loadBarColor: the color of the load bar (for example: "0000ff" for blue)
  • closeButton: whether or not a close button should exist, allowed values are "true" and "false" (default is true).
  • start: whether or not the media should start playing right away after the player has been loaded, allowed values are "true" and "false" (default is false)
  • media: the url to the media file

The following code shows an example of how you can add the media player to your website if you do it with swfobject (you can do it also without). The media player automatically resizes to the correct video size, you must however set the widget size yourself (add a few pixels in width and height for the controls).

<div id="mediaPlayerDiv"></div>
<script type="text/javascript">

  var so = new SWFObject("mediaPlayer.swf", "mediaPlayerEmbedded", "700", "505", "9");
  so.addParam("wmode","transparent");
  so.addParam("scale","noscale");
  so.addParam("quality", "best");
  so.addVariable("closeButton", "0");
  so.addVariable("playBarColor", "457DDF");
  so.addVariable("loadBarColor", "457DDF");
  so.addVariable("start", "false");
  so.addVariable("media", "http://lab.urban-sky.net/flash_mediaplayer_widget/media/
  harbourBridge.flv");
  so.addParam("salign","lt");
  so.write("mediaPlayer");
</script>
  

Grab the diashow.swf by clicking on the "source" button below. Feel free to use the widget as you want (see creative commons license below).

download source
Comments

NameE-Mail
send


Creative Commons License