reechatsdk为所有基于互联网的实时通信需求用户提供了完整的解决方案,包括实时音频/视频互动、原生sdk低延迟广播,兼容第三方rtmp和hls直播方案
* 首先下载android版客户端sdk。
http://www.reechat.org/downloads/reechatsdk_android_release_3.2.0-20181011.zip
<http://www.reechat.org/downloads/reechatsdk_android_release_3.2.0-20181011.zip>
* 解压压缩包,并把reechat.jar和其他*.so导入目标android工程(Add as Library)。
* 在MainActivity.onCreate函数里注册,传入上下文context:
NativeVoiceEngine.getInstance().register(this);
* 创建一个回调事件监听函数,并创建数据接收器,绑定之,在SdkListener里处理各种sdk回调结果:
ReceiveDataFromC receiver = new ReceiveDataFromC();
SdkVoiceListener listener = new SdkVoiceListener() {
public void SdkListener(int cmdType, final int error, String dataPtr, int
dataSize) {
switch (cmdType) {
case: 1://初始化
//process
break;
}
}
}
receiver.set_voice_listener(listener);
* 在MainActivity.onCreate函数里初始化sdk
NativeVoiceEngine.getInstance().initSdk(“3768c59536565afb”,
“df191ec457951c35b8796697c204382d0e12d4e8cb56f54df6a54394be74c5fe”);
* 设置进房唯一用户名
NativeVoiceEngine.getInstance().setUserInfo(username, “”);
* 请求进入房间
NativeVoiceEngine.getInstance().RequestJoinRoom(roomid);
* 请求离开房间
NativeVoiceEngine.getInstance().RequestQuitRoom();
注意:
1. AndroidManifest.xml配置摄像头和麦克风访问权限。
2. 如需自建媒体服务器,请移步www.reechat.org <http://www.reechat.org>
下载服务端程序。建好服务端后,在客户端初始化sdk前调用如下语句:
NativeVoiceEngine.getInstance().SetSdkParam(“RoomServerAddr”,
gateway_server_ip);
热门工具 换一换