Posted at 27-04-2009 @ 21:13 by ..::DeUCeD::.. in Project
Step 1: After i searched and studied EMFF files and successfully installed all necessary tools, i tried to build a first and simple player based on position_blue skin that is shipped with. I changed the background image to something transparent and moved up or down anything i wanted.
Timer was already there (which saved me time) but i had to remove all other buttons except play and stop. I also wanted a counter for bytes that the player is loading while playing. I could also have a total bytes counter which would be useful if i played mp3 but not for a stream which is like a never ending mp3 and that means that total bytes are equal with bytes loading as the player plays the stream. I have already said that i know totally nothing about actionscript and flash objects so bare with me as i am learning step by step. Template is basic but will be the last thing that i ‘ll change. And here’s the result of my first step:
OK! a simple transparent EMFF flash player but with a timer and also a counter. I have put Radio Casbah stream in a bitrate of 48kbps as my test stream. Green button is for PLAY and red button is for STOP. And the first problem appears. You start playing but then you stop. Still it keeps loading the stream filling the RAM so that will be step 2, finding a way to empty the player after stop button is hit. Shouldn’t be too hard. Counter works only in Firefox (it’s temporary anyway).
To get the counter i had to hack EMFF.as adding the following code:
/**
* HACK Get loading BYTES.
* @return The loading BYTES
*/
public function getLOADBytes() : Number {
if (!initialized) {
return 0;
}
if (
isNaN(Sound(sounds[index]).getBytesLoaded())
) {
return 0;
} else {
return Sound(sounds[index]).getBytesLoaded() / 1024;
}
}
I also had to add a second text field (just like the timer) at Skin.as modifying position_blue skin.
Back to Player’s main project page for latest progress and comments.


















