I am trying to build a video conferencing application between two people. the problem I am facing is that I attach the video and mic to my stream and publish it. The first time a call is made the audio is transferred alongwith the video but when i end the call and call again this time i can see is only video and no audio is transferred in the stream. I debugged the application and mic and video are being attached to the stream. Cant figure out how to end this. Any help will be highly appreciated. Here is a bit of my code. Thank you.
camera = Camera.getCamera();
mic = Microphone.getMicrophone();
mic.setLoopBack(false); // prevent input from being routed back to local speakers - helps reduce feedback in some conditions
mic.setUseEchoSuppression(true);
camera.setMode(320,240,15);
camera.setQuality(65536,75);
// setup out going stream
var conn:NetConnection = Connection.getConnection().conn;
outStream = new NetStream(conn);
outStream.attachAudio(mic);
outStream.attachCamera(camera);
outStream.publish(appState.userProfile.username);
// setup in coming stream
inStream = new NetStream(conn);
inStream.play(appState.callingUser.username);
inStream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
//inStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandlerForInStream);
and here is the endCall function.
if(camera!=null || mic != null)
{
outStream.attachCamera(null);
outStream.attachAudio(null);
outVideo.attachCamera(null);
inStream.close();
outStream.close();
camera = null;
mic = null;
inVideo = null;
outVideo = null;
inStream = null;
outStream = null;
if (newStream)
{
newStream.close();
newStream = null;
}
}