As mentioned by Artem Tikhomirov (the author of the question) in his own answer, my answer is not helpful (I keep there below as wiki, for archive).
The real answer has been given by Ric Tokyo regarding a bug on Linux, and is documented in this thread.
The only reason my answer is "chosen" is because Artem did not choose any other answer (or an answer of his own) before the 7 day limits, giving me (the first and most upvoted answer) half of the bounty points (75 over 150) automatically as explained in this SO blog entry.
First lead:
If the client is a component-base application, it needs to [handle connection events properly][9].
When you develop applications, be aware that using components introduces explicit onConnectAccept
and onConnectReject
events.
You need to include code to handle these events.
When you use components, you must modify the application.onConnect
statement in your server-side code to include the application.onConnectAccept
and application.onConnectReject
event handlers.
The last line (in order of execution) of your onConnect
handler should be either application.acceptConnection()
or application.rejectConnection()
.
If your application requires additional code following the explicit acceptConnection()
or rejectConnection()
methods, such as a message indicating that the user has been granted or denied permission to the application, you should place that code in the application.onConnectAccept
or application.onConnectReject
statements.
TIP: If you're not using media components, you cannot use application.onConnectAccept
and application.onConnectReject
.
Then, you may want to check any error message in the Flash output panel, like:
Error #2044: NetStatusEvent non pris en charge : level=error, code=NetStream.Play.Failed
at MethodInfo-1()
Error #2044: NetStatusEvent non pris en charge : level=error, code=NetStream.Record.NoAccess
at MethodInfo-1()
That would indicate a server exception non-taken into account by the client, forcing an unexpected exit.
If the client read a stream from the server, it must make sure:
- the NetConnection has succeeded
- the NetStreams (in and out) listen to NET_STATUS
A good code would like this:
var status:Function = function( e:NetStatusEvent ):void
{
trace( "status : " + e.info.code ) ;
if ( e.info.code == "NetConnection.Connect.Success" )
{
streamOut = new NetStream( nc ) ;
streamOut.addEventListener( NetStatusEvent.NET_STATUS , status ) ;
streamIn = new NetStream( nc ) ;
streamIn.addEventListener( NetStatusEvent.NET_STATUS , status ) ;
streamOut.attachCamera( cam ) ;
video.attachNetStream( streamIn ) ;
streamOut.publish( "private" ) ;
streamIn.play( "private" ) ;
}
}
Since the new versions of FlashPlayer do propagate those kind of exception, they must be monitored and then catch in the client application