ChannelObserver channelObserver = new ChannelObserver() { @Override public void onJoinSuccess(String roomName, long uid, ChannelRole role, boolean muted) { Log.d("qtt_rtc", "加入频道成功 roomId:" + roomName + " uid:" + uid + " role:" + role + " "); } @Override public void onReJoinSuccess(String roomName, long uid, ChannelRole role, boolean muted) { Log.d("qtt_rtc", "重新加入频道成功 roomId:" + roomName + " uid:" + uid + " role:" + role + " "); } @Override public void onOtherJoin(long uid, ChannelRole role, boolean muted) { Log.d("qtt_rtc", "uid " + uid + " 加入频道 role:" + role); } @Override public void onJoinFail(final int code, final String message) { Log.d("qtt_rtc", "加入频道失败 " + message); } @Override public void onConnectionBreak() { Log.d("qtt_rtc", "网络打断"); } @Override public void onConnectionLost() { Log.d("qtt_rtc", "网络失去连接"); } @Override public void onError(int err, String message) { Log.d("qtt_rtc", "错误消息 " + message); }
@Override public void onWarning(int warn, String message) { Log.d("qtt_rtc", "警告消息 " + message);; } @Override public void onLeave() { Log.d("qtt_rtc", "离开频道"); }
@Override public void onOtherLeave(long uid, ChannelRole role) { Log.d("qtt_rtc", "远端用户离开频道 " + uid); } @Override public void onTalkingVolumeIndication(VolumeInfo[] volumeInfos, int size) { Log.d("qtt_rtc", "用户说话"); } @Override public void onMuteStatusChanged(long uid, boolean muted) { if (uid == 0) { Log.d("qtt_rtc", "自己静麦状态变化: " + muted); } else { Log.d("qtt_rtc", "远端用户 " + uid + " 静麦状态变化: " + muted); } }
@Override public void onRoleStatusChanged(long uid, ChannelRole role) { if (uid == 0) { Log.d("qtt_rtc", "自己角色状态变化: " + role); } else { Log.d("qtt_rtc", "远端用户 " + uid + " 角色状态变化: " + role); } } @Override public void onNetworkStats(long uid, int txQuality, int rxQuality, RtcStat stat) { if (uid == 0) { Log.d("qtt_rtc", "自己网络情况:上行质量 " + txQuality + " 下行质量 " + rxQuality + " 上行丢包 " + stat.mUpLossRate + " 下行丢包 " + stat.mDownLossRate + " 端到端时延 " + stat.mRttAverage + " 抖动 " + stat.mJitter); } else { Log.d("qtt_rtc", "uid: " + uid + " 用户网络情况:上行质量 " + txQuality + " 下行质量 " + rxQuality + " 上行丢包 " + stat.mUpLossRate + " 下行丢包 " + stat.mDownLossRate + " 端到端时延 " + stat.mRttAverage + " 抖动 " + stat.mJitter); } } @Override public void onAudioRouteChanged(int route) { Log.d("qtt_rtc", "音频路由变化"); } @Override public void onSoundStateChanged(int state) { Log.d("qtt_log", "播放音乐状态变化 " + state); } @Override public void onEffectFinished(int effectId) { Log.d("qtt_log", "音效播放完成 " + effectId); } };
ChannelEngine channelEngine = ChannelEngine.GetChannelInstance(getApplicationContext(),"your appkey",channelObserver);
|