服务器录制
需要您联系我们的销售,开通此功能,并且需要在管理中心中成功配置消息抄送服务。通话中需要开启功能时,在本地发起时打开服务器录制开关。服务器白板录制,针对3.2之后的版本,在每条数据前追加4字节长度信息和4字节的时间戳。
服务器录制信息回调
API介绍
在通道连接成功时,会在返回的扩展中带上录制文件名,开启录制时有效。
API原型
C++
static void SetConnectNotifyCb(const ConnectNotifyCallback& cb)
File:nim_cpp_rts.h
Namespace:NIM
Class:Rts
C#
public static void SetConnectionNotifyCallback(OnConnectNotify cb)
public delegate void OnConnectNotify(string sessionId, int channelType, int code)
Namespace:NIM
Class:RtsAPI
C
void nim_rts_set_connect_notify_cb_func(nim_rts_connect_notify_cb_func cb, const void *user_data)
File:nim_rts.h
参数说明
- C++
参数 | 类型 | 说明 |
---|---|---|
cb | function | 回调函数 |
- C#
参数 | 类型 | 说明 |
---|---|---|
cb | function | 回调函数 |
sessionId | string | 本地的一个通话标记 |
channelType | int | 会话类型 |
code | int | 错误码NIMRtsConnectStatus |
- C
参数 | 类型 | 说明 |
---|---|---|
cb | function | 回调函数 |
user_data | void* | 注册回调时的APP自定义用户数据,SDK只负责传回给回调函数cb,不做任何处理 |
返回值说明
无返回值。
- 回调扩展(C)
键常量名 | 键常量值 | 值类型 | 说明 |
---|---|---|---|
kNIMRtsRecordFile | record_file | string | 录制的文件名(服务器开启录制时有效,音视频类型时为音频文件名) |
示例
C++
static void ConnectNotifyCallback(const std::string& session_id, int channel_type, int code, const std::string& json) { Json::Value valus; Json::Reader reader; std::string file; if (reader.parse(json_extension, valus) && valus.isObject()) { file = valus[nim::kNIMRtsRecordFile].asString(); } if (channel_type == nim::kNIMRtsChannelTypeTcp) { if (code == nim::kNIMRtsConnectStatusSuccess) { //白板连接成功,录制的白板数据文件为file } else { //白板连接失败 } } else if (channel_type == nim::kNIMRtsChannelTypeVchat) { if (code == nim::kNIMRtsConnectStatusSuccess) { //语音连接成功,录制的音频数据文件为file } else { //语音连接失败 } } } void foo() { nim::Rts::SetConnectNotifyCb(&ConnectNotifyCallback); }
C#
void OnConnectNotify(string sessionId, int channelType, int code) { if (channel_type == NIM.NIMRts.NIMRtsChannelType.kNIMRtsChannelTypeTcp) { if (code == 200) { //白板连接成功 } else { //白板连接失败 } } else if (channel_type == NIM.NIMRts.NIMRtsChannelType.kNIMRtsChannelTypeVchat) { if (code == 200) { //语音连接成功 } else { //语音连接失败 } } } void RegisterRtsCallback() { RtsAPI.SetConnectionNotifyCallback(OnConnectNotifyCb); }
C
void ConnectNotifyCallback(const char *session_id, int channel_type, int code, const char *json_extension, const void *user_data) { Json::Value valus; Json::Reader reader; std::string file; if (reader.parse(json_extension, valus) && valus.isObject()) { file = valus[nim::kNIMRtsRecordFile].asString(); } if (channel_type == nim::kNIMRtsChannelTypeTcp) { if (code == nim::kNIMRtsConnectStatusSuccess) { //白板连接成功,录制的白板数据文件为file } else { //白板连接失败 } } else if (channel_type == nim::kNIMRtsChannelTypeVchat) { if (code == nim::kNIMRtsConnectStatusSuccess) { //语音连接成功,录制的音频数据文件为file } else { //语音连接失败 } } } typedef void (*nim_rts_set_connect_notify_cb_func)(nim_rts_connect_notify_cb_func cb, const void *user_data); void foo() { nim_rts_set_connect_notify_cb_func func = (nim_rts_set_connect_notify_cb_func) GetProcAddress(hInst, "nim_rts_set_connect_notify_cb_func"); func(&ConnectNotifyCallback, NULL); }
本篇文档内容是否对您有帮助?
有帮助
我要吐槽
此文档对你是否有帮助
×
有帮助
我要吐槽
×