Skip to main content
March 16, 2011
Answered

Video streaming with FMS for Android

  • March 16, 2011
  • 1 reply
  • 1651 views

Hi,

I am currently building a movie player which will play movie stored in the FMS with my PC as localhost(later on i will port it to my Android device).However,through the following code, I tried to just simply connect to the localhost to retrieve one of the video,but it keep popping out errors which I don't get it.

nc = new NetConnection();

nc.connect("rtmp://localhost/vod");

ns = new NetStream(nc);

ns.client = customClient;

customClient.onMetaData = metaDataHandler;

ns.play("mp4:Vultures");

vid.width = 800;

vid.height = 390;

vid.attachNetStream(ns);

addChild(vid);

Error log:

ArgumentError: Error #2126: NetConnection object must be connected.

at flash.net::NetStream/ctor()

at flash.net::NetStream()

at MoviePlayer/video()

at MoviePlayer()

at Main/gotoMoviePlayer()

at Details/playMovie()

ReferenceError: Error #1069: Property onBWDone not found on flash.net.NetConnection and there is no default value.

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 flash.net.NetConnection and there is no default value.

at MoviePlayer/video()

at MoviePlayer()

at Main/gotoMoviePlayer()

at Details/playMovie()

If anyone can shed some light or any advice,I really appreciate it.Thanks!

Regards,

Tan

    This topic has been closed for replies.
    Correct answer

    The error is becuase the server is invoking onBWdone, but you don't have an onBWDone function defined in your netconnection's client object. To supress the error, you can either remove the server side function that invokes onBWDone via client.call, or you can add a client object with an onBWDone method to your netconnection:

    nc = new NetConnection;

    ncClient = {

    onBWDone:function(){

    }

    };

    nc.client = ncClient;

    1 reply

    March 16, 2011

    sounds like you're trying to connect to the stream before the netconnection is connected. You should wait for the NetStatusEvent.NET_STATUS event to return an info.code of NetConnection.Connect.Success before trying to use the netconnection.

    There are examples in the docs.

    March 16, 2011

    Hi Jay,

    Thanks for the help,I've manage to get it running,however,this error message  keep popping up although my video is running,I don't quite get it.Any help is appreciated.

    Error log:

    ReferenceError: Error #1069: Property onBWDone not found on flash.net.NetConnection and there is no default value.

    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 flash.net.NetConnection and there is no default value.

    at MoviePlayer/video()

    at MoviePlayer()

    at Main/gotoMoviePlayer()

    at Details/playMovie()

    Regards,

    Tan

    Correct answer
    March 17, 2011

    The error is becuase the server is invoking onBWdone, but you don't have an onBWDone function defined in your netconnection's client object. To supress the error, you can either remove the server side function that invokes onBWDone via client.call, or you can add a client object with an onBWDone method to your netconnection:

    nc = new NetConnection;

    ncClient = {

    onBWDone:function(){

    }

    };

    nc.client = ncClient;