onBWDone problem Flash Media Server with AS3
I ran into a small problem today while testing FMS 3, and had some problems finding the solution. I eventually found it and would like to share it with you.if you get the error:
ReferenceError: Error #1069: Property onBWDone not found on StreamTest and there is no default value.
Make sure that you map your NetConnection.client to a client class or the class you are working from. Then create the method onBWDone in the target Class. :
1 2 3 4 5 6 7 8 9 10 11 12 13 | private function setConnection():void { nc = new NetConnection(); nc.client = this; nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus); nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError); nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError); nc.connect(appURL); } public function onBWDone():void{ } |
Why is this happening?
Well if you look into the VOD application on the FMS server you will see that the application performs a BandWidth check and invokes this function on the client when it is done. You can measure the bandwidth speed in order to select a proper stream (assuming you have encoded multiple bitrates of one video). How to use this?
Take a look here.
16 Responses to “onBWDone problem Flash Media Server with AS3”
Leave a Reply
I was having the same error message with FMS 3. Worked around by setting client on the NetConnection instead - NetStream never complained. Thanks for the tip on defining a onBWDone method on the client - I missed this one
You’re right, I pasted the wrong part of code. The client of the netstream is mapped to the class for the onMetaData. It has to be the netconnection. I fixed the post, thanks for pointing it out.
Environment Flashdevelop/AS3(Flex 3 SDK). Your fix worked.
THX RTG
Thank you!! I have been looking for this for days…
All that is needed with a onBWDone error is to add in:
nc.client = this;
This will cause the component to send return calls to the client.
Thanks !!!!!!!!!
Thank u!!!
Thanks a lot!
Muchas gracias!!!
Thanks!!
Obrigado!
Very useful. Thanks !
Thank you for that - saved me from further hair loss!
Really thanks!!!
I have been looking for this for hours…
I was throwing my laptop outside the windows…:P
Thanks!
I also had to add the nc.client = this; line in to get to work.
Glad you got it. Flash Media Server can be tricky sometimes.
Error gone, Thanks