E2 XML Audio/Video Player for Gallery2

Copyright (C) 2010 Wayne Patterson

@version 1.1 Date: 2010-2-24
@author Wayne Patterson


Quick Jump
External Variables
FLV Example
MP3 Example

The E2 XML Audio/Video Player communicates with your Gallery2 website via an external XML generator.
E2 is not part of the official Gallery2 package.

The E2 XML Audio/Video Player allows you to display your mp3s and flash videos on any webpage.

File List:

  • E2.swf
  • mediaRss.php
  • usage.txt
I have changed the E2 over to MediaRSS but still supporting my older frameworks for now. So you could rename to xml.php if you wish.

1. upload E2.swf and your mediaRss(.php) files to your gallery2 base directory.
(for now I would like to keep mediaRss.php and xml.php separate - until I switch the mini over)

2. edit line 29 of your mediaRss(.php) to reflect your setup (default will work for most).
$ret = GalleryEmbed::init(array('fullInit' => true, 'embedUri' => '/gallery2/main.php', 'g2Uri' => '/gallery2/'));
*Hint: If your gallery is embedded the embedUri needs to reflect you CMS' embedUri
*mediaRss.php usage.

3. place the following in your webpage where you want the E2 to appear:

The above code sample would render something similar to:

Flash player 9,0,115,0 or above is required to view this demo, click here to upgrade.

Try A different color combination

Blue Red Black

Edit the g2_itemId in the xmlUrl to reflect the album you want to be displayed and also the site url.
*Hint: If you have url rewrite enabled, you may have to temporarily disable it to see the g2_itemId in your album's url.

*Note on Gallery style urls and Flash
Flash interprets &(ampersand) as a break, so you will need to replace them with the unicode equivelent %26 in the url only.
Continue adding your additional vars with the &(ampersand).

External Variables(case sensitive)

External Variable Description/PossibleValue
albumSelect Show the album dropdown true/false default true, so leave out for true
color1 Hex color code eg. 0x000000 default 0x999999 1st color in player gradient
color2 Hex color code eg. 0xFFFFFF default 0x333333 2nd color in player gradient
color3 Hex color code eg. 0xFFFFFF default 0xCCCCCC line/frame color in player
color4 Hex color code eg. 0xFFFFFF default 0x000000 bgcolor in fullscreen
siteInfoText YourCoolSite name - currently only shows in the right-click context menu
allowDownload Show the download button - true/false Default : false
allowFullscreen Show the fullscreen button - true/false Default : true
share Show the share button - true/false Default : false
htmlDiv Define the target html div for resizing only necessary for multiple players on same page. Default : videoDiv
swfUrl URL to the player swf for sharing.
langDownload "Download"
langFullscreen "Fullscreen"
langNormal "Normal"
langPlay "Play"
langPause "Pause"
langForward "Forward"
langRewind "Rewind"
langMute "Mute"
langUnmute "Unmute"
langShare "Share"
langGenre "Genre"
langArtist "Artist"
langAlbum "Album"
langSong "Song"
langYear "Year"
langTrack "Track"
langInfo "Info"
langOpenList "Open List"
langCloseList "Close List"

Add your external variables to your xmlUrl separated with an ampersand (&) ie.


To avoid the "Click here to activate and use this control" blunder in IE7 we deploy a different method to embed our flash objects.

I prefer swfObject myself, but there are others like UFO, Flash's own ActiveContent....

Since we are using javascript to "write" our object to the page, we will first need to include our swfObject library in the <head> of our page:

<script type="text/javascript" src="http://www.yoursite.com/swfobject.js"></script>

next we need our html:

Please refer to the swfObject site for further instructions.

Singlefile flv example

If you pass a flvUrl the player will assume video/x-flv - required params: flvUrl, Height, Width, title, thumbUrl

Flash player 9,0,115,0 or above is required to view this demo, click here to upgrade.

Singlefile mp3 example

If you pass a mp3Url the player will assume audio/mpeg - required params: mp3Url, title, thumbUrl

Flash player 9,0,115,0 or above is required to view this demo, click here to upgrade.

The list will not show in singlefile mode.


Another new feature is the ability to allow sharing.
When enabled E2 will generate code to embed itself in any webpage with an easy cut/paste.
To enable just add the 2 new flashvars:
&share=true&swfUrl=http://www.yoursite.com/E2.swf (Obviously the real url to your E2.swf).

The above two examples have sharing enabled.

Any questions, comments, or suggestions are welcome.

| View Printable Version