Since these work on urls, allow clientData to be passed in,
which will be the MediaDesc in msoy. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@786 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -37,7 +37,7 @@ public class Mp3AudioPlayer extends EventDispatcher
|
||||
/**
|
||||
* Load and immediately start playing some audio!
|
||||
*/
|
||||
public function load (url :String) :void
|
||||
public function load (url :String, clientData :Object = null) :void
|
||||
{
|
||||
_isComplete = false;
|
||||
_lastPosition = 0;
|
||||
@@ -46,9 +46,18 @@ public class Mp3AudioPlayer extends EventDispatcher
|
||||
_sound.addEventListener(IOErrorEvent.IO_ERROR, handleError);
|
||||
_sound.addEventListener(Event.COMPLETE, handleLoadingComplete);
|
||||
_sound.load(new URLRequest(url), new SoundLoaderContext(1000, true));
|
||||
_cliData = clientData;
|
||||
play();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get any client data associated with the media currently playing.
|
||||
*/
|
||||
public function getClientData () :Object
|
||||
{
|
||||
return _cliData;
|
||||
}
|
||||
|
||||
// from AudioPlayer
|
||||
public function getState () :int
|
||||
{
|
||||
@@ -150,6 +159,7 @@ public class Mp3AudioPlayer extends EventDispatcher
|
||||
_state = MediaPlayerCodes.STATE_UNREADY;
|
||||
checkNeedTimer();
|
||||
_lastPosition = NaN;
|
||||
_cliData = null;
|
||||
}
|
||||
|
||||
override public function addEventListener (
|
||||
@@ -261,6 +271,8 @@ public class Mp3AudioPlayer extends EventDispatcher
|
||||
|
||||
protected var _sound :Sound;
|
||||
|
||||
protected var _cliData :Object;
|
||||
|
||||
protected var _chan :SoundChannel;
|
||||
|
||||
protected var _loop :Boolean;
|
||||
|
||||
Reference in New Issue
Block a user