HaXePlayer
==========
This is a simple MP3 player written in HaXe, a new object oriented
language aimed at scripting languages like ActionScript, JavaScript
etc. See http://haxe.org. It also uses swfmill to build an embedded
font resource. See http://swfmill.org.
Files
=====
build.bat - Build file for windoze
build.sh - Build file for linux
Button.hx - Button class file
ButtonState.hx - ButtonState class file
Changes - Changes file
COPYING - Gnu copyleft
HaXePlayer.hx - Haxe source file
HaXePlayer.hxml - Haxe build file
HaXePlayer.swf - Flash application
Makefile - Makefile
PauseButton.hx - PauseButton class file
PlayButton.hx - PlayButton class file
README - This file
Resource.swf - Resource library
Resource.xml - Resource XML source
silkscreen.zip - Silkscreen font
slkscr.ttf - Silkscreen font file
State.hx - State enum file
StopButton.hx - StopButton class file
TitleText.hx - TitleText class file
ValueChangeEvent.hx - ValueChangeEvent class file
VolumeControl.hx - VolumeControl class file
Building
========
You can either use the build files, build.bat or build.sh, or use gnu
make with the Makefile.
Using
=====
There are three buttons, the title field, and a volume control. The
buttons operate in the usual way, except that clicking the play button
(|>) while a tune is playing will restart from the last pause
position, or the beginning if the pause button (||) or the title
hasn't been clicked. Clicking the stop button ([]) will stop the
playing, and reset the pause position and the loop position.
Clicking on the title field will replay the tune from the clicked
position, and set a new pause position. Clicking on the title field
with the shift key pressed will set a loop position. The tune will
replay from the pause position, or the beginning, when the loop
position is reached. If the loop position is after the current
position the tune will replay immediately. If the title field is
clicked at a position after the loop position, the tune will play to
the end, and reset the loop position.
Clicking on the volume control will set the volume in proportion to
where it is clicked.
HTML
====
Suggested html code is:
<object
width="350"
height="21"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<param
name="movie"
value="HaXePlayer.swf?url=http://...&title=..." />
<embed src="HaXePlayer.swf?url=http://...&title=..."
width="350"
height="21"
type="application/x-shockwave-flash">
</embed>
</object>
Parameters
==========
url - URL of mp3 file
title - Title of mp3 file
play - Start if true (optional)
start - Start if true (optional)
volume - Volume, 0-100 (optional)
external - External interface if true (optional)
color - Colour for progress bar (optional)
colour - Alternate spelling for color
External Interface
==================
Requires external=true and id and name parameters in the html code:
<object
width="350"
height="21"
id="<id>"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<param
name="movie"
value="HaXePlayer.swf?url=http://...&title=...&external=true" />
<embed src="HaXePlayer.swf?url=http://...&title=...&external=true"
name="<name>"
width="350"
height="21"
type="application/x-shockwave-flash">
</embed>
</object>
The javascript functions <id/name>.Start(null), <id/name>.Pause(null),
<id/name>.Cease(null), <id/name>.Volume(<value>) will start, pause,
stop and set the volume of the player respectively. The Stop function
name has been changed to Cease because of problems with Internet
Explorer. Substitute <id/name> with the value used for the id and name
parameters in the html, eg: "player". Note the functions must have a
parameter which is ignored except in the case of the volume
function. Html code to define some buttons and a text input field for
the volume:
<button type="button" onclick="player.Start(null)">Start</button>
<button type="button" onclick="player.Pause(null)">Pause</button>
<button type="button" onclick="player.Cease(null)">Stop</button>
<br />
Volume: <input type="text" value="75" size="6"
onchange="player.Volume(value)" /> (0-100)
In all tested browsers except IE, pressing the [Enter] key will change
the volume to the value in the text field. In IE you will need to
click elsewhere on the page. You can of course use any other method to
call the interface functions.
To use this interface on your local file system you will need to
change your global security settings to trust the folder where you
want to keep the files. Visit http://www.macromedia.com/support/
documentation/en/flashplayer/help/settings_manager04.html to change
your settings.
Colours
=======
Colour can be one of: red green blue cyan yellow magenta, or two hex
numbers separated by a comma, like this: #ffffff,#bbbbbb.
The first value sets the colour of the top of the progress bar, the
second sets the bottom, with a gradient between. To retain the 3D
effect the second colour needs to be darker than the first.
The progress bar colour defaults to cyan, if not defined, or there is
an error in the parameter.