I have just come across a few issues whilst building a video player that plays streaming video from a Flash Media Server.
I thought I had everything set up fine but then when I tested I got the following error message …
ReferenceError: Error #1069: Property onBWDone not found on flash.net.NetConnection and there is no default value.
So to resolve this you need to set the client property of the netConnection instance to the object on which callback methods should be invoked. For example …
netConnection.client = this;
and then you need to have an empty public method called onBWDone, like this …
public function onBWDone(...args):void
{
trace("onBWDone: "+args);
}
Sometimes you may get the following error message …
ReferenceError: Error #1069: Property onFCSubscribe not found on XXX and there is no default value.
In which case you’ll need to add …
public function onFCSubscribe(info:Object):void
{
trace("onFCSubscribe");
}
The same goes for this error message …
ReferenceError: Error #1069: Property close not found on XXX and there is no default value.
In which case you’ll need to add …
public function close(...args):void
{
trace("close: "+args);
}
I then discovered that the netConnection with the server was being closed after 5 minutes of inactivity (e.g. pause the video and leave it for 5 minutes). What you need to do in this case is listen for the ‘NetConnection.Connect.IdleTimeOut’ NetStatusEvent, and gracefully close the netStream yourself. For example …
import flash.events.NetStatusEvent;
netConnection.addEventListener(NetStatusEvent.NET_STATUS, onNetConnection_NET_STATUS);
private function onNetConnection_NET_STATUS(event:NetStatusEvent):void
{
switch (event.info.code) {
case "NetConnection.Connect.IdleTimeOut":
netStream.close();
netStream = null;
// Display a still image or message to the user ro something
break;
}
}