Ah-ha. After testing id3 tags with 3 different mp3 files that all
should have had id3 tags, and trying everything, I tried one more mp3 file: bingo. Added MediaPlayer.getMetadata() and a METADATA event. Contents of metadata vary by media being played and are open for interpretation by users of the player. FLV video returns their metadata object. MP3 audio returns id3 tags. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@708 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -151,9 +151,16 @@ public class FlvVideoPlayer extends EventDispatcher
|
||||
}
|
||||
}
|
||||
|
||||
// from VideoPlayer
|
||||
public function getMetadata () :Object
|
||||
{
|
||||
return _metadata;
|
||||
}
|
||||
|
||||
// from VideoPlayer
|
||||
public function unload () :void
|
||||
{
|
||||
_metadata = null;
|
||||
_sizeChecker.reset();
|
||||
_positionChecker.reset();
|
||||
_vid.attachNetStream(null);
|
||||
@@ -266,17 +273,15 @@ public class FlvVideoPlayer extends EventDispatcher
|
||||
*/
|
||||
protected function handleMetaData (info :Object) :void
|
||||
{
|
||||
// log.debug("Got video metadata:");
|
||||
// for (var n :String in info) {
|
||||
// log.debug(" " + n + ": " + info[n]);
|
||||
// }
|
||||
|
||||
if ("duration" in info) {
|
||||
_duration = Number(info.duration);
|
||||
if (!isNaN(_duration)) {
|
||||
dispatchEvent(new ValueEvent(MediaPlayerCodes.DURATION, _duration));
|
||||
}
|
||||
}
|
||||
|
||||
_metadata = info;
|
||||
dispatchEvent(new ValueEvent(MediaPlayerCodes.METADATA, info));
|
||||
}
|
||||
|
||||
protected function updateState (newState :int) :void
|
||||
@@ -316,6 +321,8 @@ public class FlvVideoPlayer extends EventDispatcher
|
||||
|
||||
protected var _volume :Number = 1;
|
||||
|
||||
protected var _metadata :Object;
|
||||
|
||||
/** Checks the video every 100ms to see if the dimensions are now know.
|
||||
* Yes, this is how to do it. We could trigger on ENTER_FRAME, but then
|
||||
* we may not know the dimensions unless we're added on the display list,
|
||||
|
||||
Reference in New Issue
Block a user