flash.net.NetStream is not receiving onMetaData

Boon picture Boon · Aug 5, 2009 · Viewed 7.9k times · Source

I have gotten a NetConnection and NetStream set up and the streaming mp3 is playing fine. The only problem is the metadata is not received even though NetStream's client has been set. Any idea what could have caused this?

Code snippet:


// set up NetConnection
...

private function netStatusHandler(e:NetStatusEvent):void 
{
  if (e.info.code == "NetConnection.Connect.Success")
  {
    // NetConnection's connection established successfully
    netStream = new NetStream(nc);
    netStream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
    netStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
    netStream.client = new NetStreamClient();

    netStream.play("mp3:music/123456");
  }
}

class NetStreamClient
{   
  public function onMetaData(info:Object):void
  {
    trace("onMetaData");
  }

  public function onPlayStatus(info:Object):void
  {
    trace("onPlayStatus");
  }
}

Answer

Jake picture Jake · Aug 5, 2009

before the netStream.play( ) call add this:

netStream.onMetaData = function(infoObject:Object) {
    trace('on metadata:');
    for (var propName:String in infoObject) {
        trace(propName + " = " + infoObject[propName]);
    }
};

does this work?