0

我正在使用 AGORA 开放式视频通话与我的一款移动应用程序集成。我们希望在视频通话中显示每位与会者的姓名和音频状态(静音/取消静音)。我怎样才能做到这一点?

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

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

提前谢谢了

4

1 回答 1

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

于 2019-10-16T04:23:49.123 回答