From 7bf440c6291c711c5b9ae29de9259b7311bcbf65 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Fri, 20 Mar 2009 21:56:48 +0000 Subject: [PATCH] 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 --- .../com/threerings/flash/media/Mp3AudioPlayer.as | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/as/com/threerings/flash/media/Mp3AudioPlayer.as b/src/as/com/threerings/flash/media/Mp3AudioPlayer.as index af0855ea..2b0cfe05 100644 --- a/src/as/com/threerings/flash/media/Mp3AudioPlayer.as +++ b/src/as/com/threerings/flash/media/Mp3AudioPlayer.as @@ -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;