Class com.maheshj.utils.mp3.Mp3PlayBackManager

Description

... This class forms the basic functional framework of any MP3 player that you can model. It helps in keeping UI separate from the functionality.

Field Index

addEventListener, currentPlayingTrack, currentPlayingTrackNum, currentPlayingTrackPath, dispatchEvent, playlist, removeEventListener, volume

Method Index

new Mp3PlayBackManager()
pauseMusic(), playMusic(), playNext(), playPrev(), playTrackNum(), stopMusic(), togglePlayBack()

Constructor Detail

Mp3PlayBackManager

public function Mp3PlayBackManager()

Constructor of the class. Does not take any parameters

Field Detail

addEventListener

public addEventListener:Function

removeEventListener

public removeEventListener:Function

dispatchEvent

public dispatchEvent:Function

playlist

public playlist:PlayList
This is basically an array. The array elements are a set of objects containting various track properties. The most basic properties are "file" - path of the mp3 file and "title" - the title of the file to be displayed on the player when being played. You can add many other properties to the object which you may want to use with the player you are making.

currentPlayingTrackNum

public currentPlayingTrackNum:Number
You can get and set the current playing track number with the property.

currentPlayingTrack

public currentPlayingTrack:String [Read Only]
You can get the current playing track's title with this property.

currentPlayingTrackPath

public currentPlayingTrackPath:String [Read Only]
You can get the current playing track's path with this property.

volume

public volume:Number
You can get and set the playback volume with this property.

Method Detail

playMusic

public function playMusic():Void

Function to be called when you have to resume music playback. Dispatches an event with name "MusicStarted".

pauseMusic

public function pauseMusic():Void

Function to be called when you have to pause music playback. Dispatches an event with name "MusicPaused".

stopMusic

public function stopMusic():Void

Function to be called when you have to stop music playback. Dispatches an event with name "MusicStopped".

playNext

public function playNext()

Function to be called when you have to go to next track. Dispatches an event with name "NextTrackSelected".

playPrev

public function playPrev()

Function to be called when you have to go to previous track. Dispatches an event with name "PreviousTrackSelected".

togglePlayBack

public function togglePlayBack()

If music is being played then it will be paused and vice versa.

playTrackNum

public function playTrackNum(num:Number)

This function can be called when you wnt to play a specific track in the playlist. Dispatches an event with name "TrackChanged".

Parameters

numthe track number to be played. It is a zero indexed value.