lacymorrow / xspf-jukebox

🎹 Flash media player for champions
https://xspf-jukebox.vercel.app/
MIT License
3 stars 0 forks source link
flash media-player php player playlist xspf xspf-jukebox

xspf-jukebox

A skinnable, customizeable Flash media player.

license:mit

Live demo of the XSPF Jukebox

You must have flash installed!

The XSPF Jukebox is a fully skinnable Flash media player. Based on my revisions of Fabricio Zuardi's original creation. A full featured media player, the Jukebox supports both mp3 audio and flv video parsed through an external .XSPF or .XML playlist. Custom skins combined with auto-resume and many customizable options make the XSPF Jukebox a solid choice for a Flash-based media player.

As of 2014 this project is no longer being maintained. It is considered to be in a stable state and will receive no further updates.
If you would like to take over, please file an issue.

Features

Table of Contents

Install

1. Create an XSPF playlist pointing to your media files

(Optional) Automatically generate your playlists in PHP, Python, or JS

Edit the first line of the xplay.php file to point to your media directory:

$media = "media"

Edit any options you wish, playlist caching is turned on by default.

2. Include the SWFObject javascript code into your page <head>:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>

3. Create a <div> to hold your content:
  <div id="flashcontent">
      <!-- this will be replaced -->
  </div>
4. Invoke the player via javascript:
<script>
    var params = {};
    params.wmode="transparent";
    params.allowscriptaccess="always";

    var url = "xspf_jukebox.swf?playlist_url=xplay.php&skin_url=skins/iTunes&param1=value";
    swfobject.embedSWF(url, "flashcontent", "skin width", "skin height", "7.0.0", "", {}, params, {});
</script>

Notice the values highlighted above, you must specify valid file paths for both the playlist_url and skin_url as well as the skin width and height. You may also specify any of the optional parameters following the playlist_url. For example:

The entire url for the .swf on the demo page is:

xspf_jukebox.swf?playlist_url=xplay.php&skin_url=skins/iTunes&autoplay=true&alphabetize=true&autoload=true&autoresume=true&main_image=images/artwork.jpg&shuffle=true&statsurl=stats.php

That's it! The XSPF Jukebox is now installed.

Options

The XSPF Jukebox can be customized for almost any need to play audio or video on the web.

Single-track mode

You can also use the Jukebox to play a single .mp3 or .flv file, using the following two parameters in place of playlist_url:

Optional Parameters
Playlist Format

The XSPF Jukebox uses the XSPF (‘spiff’) open XML playlist format. A brief example follows:

<?xml version="1.0" encoding="UTF-8"?>
<playlist version="0" xmlns="http://xspf.org/ns/0/">
    <trackList>
        <track>
            <location>url of .mp3 audio or .flv video file</location>
            <creator>artist or creator of track</creator>
            <title>title of track</title>
            <annotation>used in place of creator/title if both are absent</annotation>
            <duration>number of milliseconds of track duration</duration>
            <info>url of info link</info>
            <image>url of image, overwrites main_image parameter</image>
            <purchase>url of purchase link</purchase>
        </track>
    </trackList>
</playlist>
NOTE: only <location> is required
Javascript API

A javascript interface has been added into the player to allow for extended control over the Jukebox. This feature only applies to the Flash 8 version. Available functions are:

To control the Jukebox using Javascript, make sure that you have an id set in the object and embed tags for the embed script. To call a function, use the format:

window.document.xspfJukebox.playTrack();

For example:

<a href="https://github.com/lacymorrow/xspf-jukebox/blob/master/javascript:window.document.xspfJukebox.playTrack();">Click to Play </a>

Skin Documentation

The XSPF Jukebox uses a custom XML format to specify the player appearance. The skin.xml files are in the following format:

<?xml version="1.0" encoding="UTF-8"?>
<skin version="0" xmlns="http://xsml.org/ns/0/">
    <name>skin name</name>
    <width>skin width</width>
    <height>skin height</height>
    <author>skin author</author>
    <email>author?s email</email>
    <website>author?s website</website>
    <comment>author?s comments</comment>
    <object>
           all skin objects reside between the <object> tags
    </object>
</skin>
Skin Objects
Function Objects

All function objects begin with an tag, and are distinguished through a label attribute. Most labels have similar attributes, but there are some slight differences.

  • <object label="playButton" x="" y="" z="" width="" height="" scale="" image="" color="" alpha="" hoverMessage="" />
  • <object label="playpauseButton" x="" y="" z="" width="" height="" scale="" image="" color="" alpha="" hoverMessage="" />
  • <object label="stopButton" x="" y="" z="" width="" height="" scale="" image="" color="" alpha="" hoverMessage="" />
  • <object label="prevButton" x="" y="" z="" width="" height="" scale="" image="" color="" alpha="" hoverMessage="" />
  • <object label="fwdButton" x="" y="" z="" width="" height="" scale="" image="" color="" alpha="" hoverMessage="" />
  • <object label="shuffleButton" x="" y="" z="" width="" height="" scale="" image="" color="" alpha="" hoverMessage="" />
  • <object label="repeatButton" x="" y="" z="" width="" height="" scale="" image="" color="" alpha="" hoverMessage="" />
  • <object label="scrollButton" x="" y="" z="" width="" height="" scale="" image="" color="" bgColor="" alpha="" bgAlpha="" hoverMessage="" />
  • <object label="scrollupButton" x="" y="" z="" width="" height="" scale="" image="" color="" alpha="" hoverMessage="" />
  • <object label="scrolldownButton" x="" y="" z="" width="" height="" scale="" image="" color="" alpha="" hoverMessage="" />
  • <object label="startButton" x="" y="" z="" width="" height="" scale="" color="" alpha="" hoverMessage="" />
  • <object label="infoButton" x="" y="" z="" size="" color="" font="" text="" bold="" italic="" underline="" target="" hoverMessage="" />
  • <object label="purchaseButton" x="" y="" z="" size="" color="" font="" text="" bold="" italic="" underline="" target="" hoverMessage="" />
  • <object label="downloadButton" x="" y="" z="" size="" color="" font="" text="" bold="" italic="" underline="" target="" hoverMessage="" />
  • <object label="playDisplay" x="" y="" z="" width="" height="" scale="" color="" alpha="" hoverMessage="" />
  • <object label="imageDisplay" x="" y="" z="" width="" height="" scale="" color="" alpha="" hoverMessage="" />
  • <object label="videoDisplay" x="" y="" z="" width="" height="" scale="" alpha="" hoverMessage="" />
  • <object label="trackDisplay" x="" y="" z="" width="" size="" color="" font="" text="" align="" bold="" italic="" underline="" hoverMessage="" />
  • <object label="timeDisplay" x="" y="" z="" size="" color="" font="" text="" bold="" italic="" underline="" hoverMessage="" />
  • <object label="fulltimeDisplay" x="" y="" z="" size="" color="" font="" text="" bold="" italic="" underline="" hoverMessage="" />
  • <object label="volumeDisplay" x="" y="" z="" width="" height="" scale="" image="" color="" alpha="" hoverMessage="" />
  • <object label="timeBar" x="" y="" z="" width="" height="" scale="" image="" color="" alpha="" hoverMessage="" />
  • <object label="loadBar" x="" y="" z="" width="" height="" scale="" image="" color="" alpha="" hoverMessage="" />
Labels
  • playButton : a play button, toggles between play and pause
  • playpauseButton : a static play pause button, toggles between play and pause
  • stopButton : a stop button, stops the track
  • prevButton : a previous button, changes to the previous track
  • fwdButton : a forward button, changes to the next track
  • shuffleButton : a shuffle button, toggles on/off
  • repeatButton : a repeat button, toggles on/off
  • scrollButton : a scroll button with background, scrolls playlist
  • scrollupButton : an up arrow, scrolls playlist up
  • scrolldownButton : a down arrow, scrolls playlist down
  • startButton : a rectangle to indicate click location to start load or play, set alpha to 0
  • infoButton : text button to follow the current info link in a playlist
  • purchaseButton : text button to follow the current purchase link in a playlist
  • downloadButton : text button to directly link to the currently playing mp3
  • playDisplay : displays current track images
  • imageDisplay : displays current track images
  • videoDisplay : displays video tracks
  • trackDisplay : displays currently playing track
  • timeDisplay : displays current track time in a standard format 00:00, toggles between time, duration, and time remaining
  • fulltimeDisplay : displays current track time in a full format 00:00/00:00, displays time and duration
  • volumeDisplay : displays a volume bar to change track volume
  • timeBar : displays current track percentage in bar form, click to scan track
  • loadBar : displays loaded percentage for the current track in bar form
Attributes
  • x : number : the x value or percentage for placing an object
  • y : number : the y value or percentage for placing an object
  • z : number : the z value, or depth of an object.
  • width : number : the width of an object
  • height : number : the height of an object
  • scale : number : used in place of width/height. scales the object while retaining default aspect ratio. 1 = no scaling
  • size : number : font size. size must be preceded by a + for infoButton, purchaseButton, and downloadButton. ex: +15
  • image : url : load an image in place of the default symbol
  • shape : rectangle/rectRounded/circle/triangle : draws a shape for an object
  • border : number : defines a shape?s border width
  • color : hex code : sets the color of an object. ex: ff0088
  • borderColor : hex code : sets the color of an shape?s border
  • bgColor : hex code : sets the color of an object?s background
  • selectedColor : hex code : sets the color of the current track in the playlist
  • font : font name : sets the text font
  • text : text : displayed text
  • align : left/center/right : used only for trackDisplay. aligns text
  • bold : boolean : sets text bolding on/off
  • italic : boolean : sets text italics on/off
  • underline : boolean : sets text underline on/off
  • alpha : percent : sets alpha channel of object
  • bgAlpha : percent : sets alpha channel of an object?s background
  • url : url : allows an object to link to a web page
  • hoverMessage : text : message displayed on mouse over

Generating an XSPF Playlist:

License

MIT © Lacy Morrow