views:

431

answers:

2

Hi again peepz, I have this streaming video player with an asyncErrorHandler function which isn't working correctly.

In Flash player 10 I get no errors, but in Flash player 9 I'll get a popup window with the error message that shows up in my output window when I test on my local machine.

Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.NetConnection was unable to invoke callback onBWDone. error=ReferenceError: Error #1069: Property onBWDone not found on src.display.VideoClass and there is no default value.

I feel that I have my AsyncErrorEvent setup correctly however, but am unsure as to why I still get a massive error in my output window, here is the popup window and code below:

alt text

My statusEventHandler function


// ☼ --- Handle Status and Errors
function statusEventHandler(event:NetStatusEvent):void {
trace("connected is: "+ncConnection.connected);
trace("event.info.level: "+event.info.level);
trace("event.info.code: "+event.info.code);

switch (event.info.code) {
 case "NetConnection.Connect.Success" :
  trace("Connected");
  connectStream();
  break;
 case "NetConnection.Connect.Failed" :
 case "NetConnection.Connect.Rejected" :
  trace("The connection was rejected");
  break;
 case "NetStream.Play.Stop" :
  trace("The stream has finished playing");
  break;
 case "NetStream.Play.StreamNotFound" :
  trace("The server could not find the stream you specified");
  trace("Stream: "+streamName);
  break;
 case "NetStream.Publish.BadName" :
  trace("The stream name is already used");
  break;
    }
}

My Async Error Handling Function


// ☼ --- ♥♥♥ Async Error Handling ♥♥♥
public function asyncErrorHandler(event:AsyncErrorEvent):void 
{
    trace("========================= asyncErrorHandler"+"\r");
    //ignore
}

connectStream Function - activated from statusEventHandler


// ☼ --- ♥♥♥ Connect to Stream ♥♥♥
public function connectStream():void 
{ 
    nsStream = new NetStream(ncConnection);
    nsStream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
    nsStream.addEventListener(NetStatusEvent.NET_STATUS, statusEventHandler);
    nsStream.client = getMetaData(nsStream);

    // Attach Stream and Play
    vidHold.attachNetStream(nsStream);
    vidHold.smoothing = SMOOTHING;
    nsStream.play(streamName);
    videoStatus = "IsPlaying";
}

Finally the ncConnection code + onBCDone bug fix


// ☼ --- initVideo
public function initVideo(flvUrl:String, vidHolder)
{
    streamName = flvUrl;
    vidHold = vidHolder;

    trace("streamName = "+streamName);

    // ☼ --- ¤¤¤¤¤¤ LIMELIGHT ¤¤¤¤¤¤
    ncConnection.connect(protocolArray[1] + "://" + serverName + "/" + appName );
    trace("Stream Path: " + protocolArray[1] + "://" + serverName + "/" + appName + "/" + streamName +"\r"+"\r");
    ncConnection.addEventListener(NetStatusEvent.NET_STATUS, statusEventHandler);
    ncConnection.client = this; // Corrects onBCDone bug
    //          ↑ This was suppose to fix it I thought :*( 
    addChild(videoArea);
}

Any help, tips, thoughts on this are extremely appreciated! I've googled all day long and the only thing I've found was nc.client = this should fix this issue. Or adding an AsyncErrorEvent should have fixed this too.

alt text

+2  A: 

I figured it out! Forgot to add the AsyncErrorEvent to the NetConnection also, I just had it on the NetStream

ncConnection.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);

no more error :) btw anyone know what the AsyncError actually is or means?

alt text

Leon
A: 

Thank you.

This works great

pabloesg_8