<my:SimpleMP3 />, the simple way to play mp3's in AS3 & Flex
mysimplemp3 is a small, open source, library that makes it extraordinarily simple to play mp3 files and create mp3 player components in ActionScript 3 - especially in Flex applications. It allows you to stop worrying about controlling audio and frees you up to create feature-rich mp3 players with compelling user experiences. It's just too simple.
[download the latest swc]
-
<my:SimpleMP3 id="audio" />
^ And there you have it. The guts of a completely functional mp3 player in under 30 characters. Now, just treat it like you'd expect!
-
audio.url = "http://mydomain.com/music.mp3";
-
audio.play();
-
audio.pause();
-
audio.stop();
-
audio.volume = 0..1;
-
audio.panning = -1..1;
-
// and more
It's that simple. And all the while, SimpleMP3 is dispatching a plethora of useful events and updating much needed bindable properties. Read below for a list of current features, properties and events.
Currently the only demo is my proof of concept found here. I look forward to seeing what you create!
Current Features
Basics:
load, play, stream, buffer, pause, stop, scrub
States:
idle, loading, playing, streaming, buffering, paused, stopped
Bindable state booleans:
isIdle, isLoading, isPlaysing, isStreaming, isBuffering, isPaused, isStopped, isScrubbing
Bindable progress indicators:
bytesTotal, bytesLoaded, bytesLoadedPercentage
playbackLength, playbackPosition, playbackPositionPercentage
ID3 Metadata:
id3
Properties
url [string]
autoLoad [bool]
autoPlay [bool]
autoRewind [bool]
repeat [bool]
volume [0..1]
panning [-1..1]
stream [bool]
streamingBufferTime [milliseconds]
checkPolicyFile [bool]
Events
[com.deploydaily.simplemp3.SimpleMP3ProgressEvent]
event.progressCurrent,
event.progressTotal
loadingProgressEvent
playbackProgressEvent
[flash.events.Event]
loadingBegin
loadingId3Complete
loadingComplete
playbackBegin (play from position 0)
playbackPlay
playbackPause
playbackResume (play from position > 0 && < playbackLength)
playbackStop
playbackComplete
scrubBegin
scrub
scrubEnd
Class methods
SimpleMP3.msToTimeString( milliseconds:Number ) :String // [hh:]mm:ss