当前位置: 首页>>代码示例>>Java>>正文


Java IRtcEngineEventHandler类代码示例

本文整理汇总了Java中io.agora.rtc.IRtcEngineEventHandler的典型用法代码示例。如果您正苦于以下问题:Java IRtcEngineEventHandler类的具体用法?Java IRtcEngineEventHandler怎么用?Java IRtcEngineEventHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IRtcEngineEventHandler类属于io.agora.rtc包,在下文中一共展示了IRtcEngineEventHandler类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doHandleExtraCallback

import io.agora.rtc.IRtcEngineEventHandler; //导入依赖的package包/类
private void doHandleExtraCallback(int type, Object... data) {
    int peerUid;
    boolean muted;

    switch (type) {
        case AGEventHandler.EVENT_TYPE_ON_USER_AUDIO_MUTED: {
            peerUid = (Integer) data[0];
            muted = (boolean) data[1];

            notifyMessageChanged("mute: " + (peerUid & 0xFFFFFFFFL) + " " + muted);
            break;
        }

        case AGEventHandler.EVENT_TYPE_ON_AUDIO_QUALITY: {
            peerUid = (Integer) data[0];
            int quality = (int) data[1];
            short delay = (short) data[2];
            short lost = (short) data[3];

            notifyMessageChanged("quality: " + (peerUid & 0xFFFFFFFFL) + " " + quality + " " + delay + " " + lost);
            break;
        }

        case AGEventHandler.EVENT_TYPE_ON_SPEAKER_STATS: {
            IRtcEngineEventHandler.AudioVolumeInfo[] infos = (IRtcEngineEventHandler.AudioVolumeInfo[]) data[0];

            if (infos.length == 1 && infos[0].uid == 0) { // local guy, ignore it
                break;
            }

            StringBuilder volumeCache = new StringBuilder();
            for (IRtcEngineEventHandler.AudioVolumeInfo each : infos) {
                peerUid = each.uid;
                int peerVolume = each.volume;

                if (peerUid == 0) {
                    continue;
                }

                volumeCache.append("volume: ").append(peerUid & 0xFFFFFFFFL).append(" ").append(peerVolume).append("\n");
            }

            if (volumeCache.length() > 0) {
                String volumeMsg = volumeCache.substring(0, volumeCache.length() - 1);
                notifyMessageChanged(volumeMsg);

                if ((System.currentTimeMillis() / 1000) % 10 == 0) {
                    log.debug(volumeMsg);
                }
            }
            break;
        }

        case AGEventHandler.EVENT_TYPE_ON_APP_ERROR: {
            int subType = (int) data[0];

            if (subType == ConstantApp.AppError.NO_NETWORK_CONNECTION) {
                showLongToast(getString(R.string.msg_no_network_connection));
            }

            break;
        }

        case AGEventHandler.EVENT_TYPE_ON_AGORA_MEDIA_ERROR: {
            int error = (int) data[0];
            String description = (String) data[1];

            notifyMessageChanged(error + " " + description);

            break;
        }

        case AGEventHandler.EVENT_TYPE_ON_AUDIO_ROUTE_CHANGED: {
            notifyHeadsetPlugged((int) data[0]);

            break;
        }
    }
}
 
开发者ID:AgoraIO,项目名称:OpenVoiceCall-Android,代码行数:80,代码来源:ChatActivity.java

示例2: doHandleExtraCallback

import io.agora.rtc.IRtcEngineEventHandler; //导入依赖的package包/类
private void doHandleExtraCallback(int type, Object... data) {
        int peerUid;
        boolean muted;
        switch (type) {
            case AGEventHandler.EVENT_TYPE_ON_USER_AUDIO_MUTED:
                peerUid = (Integer) data[0];
                muted = (boolean) data[1];
                LogUtil.e("mute: " + (peerUid & 0xFFFFFFFFL) + " " + muted);
//                notifyMessageChanged("mute: " + (peerUid & 0xFFFFFFFFL) + " " + muted);
                break;
            case AGEventHandler.EVENT_TYPE_ON_AUDIO_QUALITY:
                peerUid = (Integer) data[0];
                int quality = (int) data[1];
                short delay = (short) data[2];
                short lost = (short) data[3];

                LogUtil.e("quality: " + (peerUid & 0xFFFFFFFFL) + " " + quality + " " + delay + " " + lost);
//                notifyMessageChanged("quality: " + (peerUid & 0xFFFFFFFFL) + " " + quality + " " + delay + " " + lost);
                break;
            case AGEventHandler.EVENT_TYPE_ON_SPEAKER_STATS:
                IRtcEngineEventHandler.AudioVolumeInfo[] infos = (IRtcEngineEventHandler.AudioVolumeInfo[]) data[0];
                if (infos.length == 1 && infos[0].uid == 0) { // local guy, ignore it
                    break;
                }
                StringBuilder volumeCache = new StringBuilder();
                for (IRtcEngineEventHandler.AudioVolumeInfo each : infos) {
                    peerUid = each.uid;
                    int peerVolume = each.volume;
                    if (peerUid == 0) {
                        continue;
                    }
                    volumeCache.append("volume: ").append(peerUid & 0xFFFFFFFFL).append(" ").append(peerVolume).append("\n");
                }
                if (volumeCache.length() > 0) {
                    LogUtil.e(volumeCache.substring(0, volumeCache.length() - 1));
//                    notifyMessageChanged(volumeCache.substring(0, volumeCache.length() - 1));
                }
                break;
            case AGEventHandler.EVENT_TYPE_ON_APP_ERROR:
                int subType = (int) data[0];
                if (subType == ConstantApp.AppError.NO_NETWORK_CONNECTION) {
                    LogUtil.e(getString(R.string.msg_no_network_connection));
//                    showLongToast(getString(R.string.msg_no_network_connection));
                }
                break;
            case AGEventHandler.EVENT_TYPE_ON_AGORA_MEDIA_ERROR: {
                int error = (int) data[0];
                String description = (String) data[1];
                LogUtil.e(error + " " + description);
//                notifyMessageChanged(error + " " + description);
                break;
            }
        }
    }
 
开发者ID:wzc25151,项目名称:lrs_android,代码行数:55,代码来源:AgoraActivity.java


注:本文中的io.agora.rtc.IRtcEngineEventHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。