NetStream 在第二次呼叫 Flex 时不发送音频
我正在尝试在两个人之间构建一个视频会议应用程序。我面临的问题是我将视频和麦克风附加到我的流中并发布它。第一次拨打电话时,音频与视频一起传输,但是当我结束呼叫并再次呼叫时,我只能看到视频,流中没有传输音频。我调试了应用程序,麦克风和视频正在附加到流中。不知道如何结束这一切。任何帮助将不胜感激。这是我的一些代码。谢谢。
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);
这是 endCall 函数。
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;
}
}
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;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论