AGORA:显示对手的姓名和“静音/取消静音”按钮

时间:2019-10-13 23:42:47

标签: agora.io

我正在将AGORA开放式视频通话与我的一个移动应用程序集成在一起。我们想显示视频通话中每个与会者的姓名和音频状态(静音/取消静音)。我该如何实现?

我正在使用的代码参考/示例:https://github.com/AgoraIO/Basic-Video-Call/tree/master/Group-Video/OpenVideoCall-Android

Agora SDK:io.agora.rtc:full-sdk:2.4.1

非常感谢

1 个答案:

答案 0 :(得分:1)

在Agora的Android SDK中,onUserMuteAudio中有一个IRtcEngineEventHandler回调。每当频道中的用户静音或取消静音音频时,都会触发此回调。

您的实现应如下所示:

// Handle Stream Events
private final IRtcEngineEventHandler mRtcEventHandler = new IRtcEngineEventHandler() {
    // remote user has toggled their video
    @Override
    public void onUserMuteAudio(final int uid, final boolean toggle) { // Tutorial Step 10
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if(toggle) {
                    Log.i(LOG_TAG, "MUTE: remote user with  uid:" + uid + " muted their microphone");
                } else {
                    Log.i(LOG_TAG, "UNMUTE: remote user with  uid:" + uid + " unmuted their microphone");
                }
            }
        });
    }
};

官方文档:https://docs.agora.io/en/Video/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_i_rtc_engine_event_handler.html#a42ecab512f9fc5ba0785abd9f4d8b2d9