NetStream 在第二次呼叫 Flex 时不发送音频

发布于 2024-12-21 04:46:39 字数 1399 浏览 3 评论 0原文

我正在尝试在两个人之间构建一个视频会议应用程序。我面临的问题是我将视频和麦克风附加到我的流中并发布它。第一次拨打电话时,音频与视频一起传输,但是当我结束呼叫并再次呼叫时,我只能看到视频,流中没有传输音频。我调试了应用程序,麦克风和视频正在附加到流中。不知道如何结束这一切。任何帮助将不胜感激。这是我的一些代码。谢谢。

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文