Saturday, October 2, 2010

Flex Mp3 Player supports buffering ,streaming and visualizer.


Flex ...
this is a simple control "Mp3 Player" supports buffering and has a visualizer.

we will see together how to cook ... make * one home :) .

lets summarize it in some points:
  • how buffering works.
  • playing files.
  • visualizer.
Beffering
simple as you can see below you just need to have :
  • a Sound Object : to be able to play the file.
  • aURLRequest Object : to get the file to play.
  • a SoundLoaderContext Object: to load the file into sound channel.
  • for more info go there.
now you got the file , you loaded it and you are playing the file.

just notice that play function accepts parameters to enable you set the start time in the sound file. but it should be loaded.

so if you know if the start time available to play then buffering mission is completed .

-------------------------------------------------------------------------------------------------
import flash.media.Sound;
import flash.media.SoundLoaderContext;
import flash.net.URLRequest;

var s:Sound = new Sound();
var req:URLRequest = new URLRequest("bigSound.mp3");
var context:SoundLoaderContext = new SoundLoaderContext(8000, true);
s.load(req, context);
s.play();

-------------------------------------------------------------------------------------------------

Playing files
as we mentioned before just your url request , soundloader and sound.
what you have to do is just changing the url of the urlrequest by the new file.

Visualizer
i didn't make it i just used it .

here is the player you can make yours home , enjoy :) ----> ZIZOOO Mp3Player