NIM PC Cross Platform SDK
载入中...
搜索中...
未找到
nim::Rts类 参考

NIM Rts提供的相关接口 更多...

#include <nim_cpp_rts.h>

Public 类型

typedef std::function< void(NIMResCode res_code, const std::string &session_id, int channel_type, const std::string &uid)> StartChannelCallback
 
typedef std::function< void(const std::string &session_id, int channel_type, const std::string &uid, const std::string &custom_info)> StartNotifyCallback
 
typedef std::function< void(NIMResCode res_code)> CreateConfCallback
 
typedef std::function< void(NIMResCode res_code, const std::string &session_id, int64_t channel_id, const std::string &custom_info)> JoinConfCallback
 
typedef std::function< void(NIMResCode res_code, const std::string &session_id, int channel_type, bool accept)> AckCallback
 
typedef std::function< void(const std::string &session_id, int channel_type, bool accept, const std::string &uid)> AckNotifyCallback
 
typedef std::function< void(const std::string &session_id, int channel_type, bool accept)> SyncAckNotifyCallback
 
typedef std::function< void(const std::string &session_id, int channel_type, int code, const std::string &json)> ConnectNotifyCallback
 
typedef std::function< void(const std::string &session_id, int channel_type, const std::string &uid, int code, int leave_type)> MemberNotifyCallback
 
typedef std::function< void(NIMResCode res_code, const std::string &session_id)> HangupCallback
 
typedef std::function< void(const std::string &session_id, const std::string &uid)> HangupNotifyCallback
 
typedef std::function< void(NIMResCode res_code, const std::string &session_id, const std::string &info)> ControlCallback
 
typedef std::function< void(const std::string &session_id, const std::string &info, const std::string &uid)> ControlNotifyCallback
 
typedef std::function< void(const std::string &session_id, int channel_type, const std::string &uid, const std::string &data)> RecDataCallback
 
typedef std::function< void(NIMResCode res_code, const std::string &session_id, int channel_type, const std::string &json)> OptCallback
 

静态 Public 成员函数

static void SetProxy (NIMProxyType type, const std::string &host, int port, const std::string &user, const std::string &password)
 
static void StartChannel (int channel_type, const std::string &uid, RtsStartInfo info, const StartChannelCallback &cb)
 
static void SetStartNotifyCb (const StartNotifyCallback &cb)
 
static void CreateConf (const std::string &name, const std::string &custom_info, const CreateConfCallback &cb)
 
static void JoinConf (const std::string &name, const std::string &session_id, bool record, const JoinConfCallback &cb)
 
static void Ack (const std::string &session_id, int channel_type, bool accept, bool data_record, bool audio_record, const AckCallback &cb)
 
static void SetAckNotifyCb (const AckNotifyCallback &cb)
 
static void SetSyncAckNotifyCb (const SyncAckNotifyCallback &cb)
 
static void SetConnectNotifyCb (const ConnectNotifyCallback &cb)
 
static void SetMemberChangeCb (const MemberNotifyCallback &cb)
 
static void Control (const std::string &session_id, const std::string &info, const ControlCallback &cb)
 
static void SetControlNotifyCb (const ControlNotifyCallback &cb)
 
static void SetVChatMode (const std::string &session_id, int mode)
 
static void Hangup (const std::string &session_id, const HangupCallback &cb)
 
static void SetHangupNotifyCb (const HangupNotifyCallback &cb)
 
static void Relogin (const std::string &session_id, int channel_type, OptCallback cb)
 
static void SendData (const std::string &session_id, int channel_type, const std::string &data, const std::string &uid="")
 
static void SetRecDataCb (const RecDataCallback &cb)
 

详细描述

NIM Rts提供的相关接口

成员类型定义说明

◆ AckCallback

typedef std::function<void(NIMResCode res_code, const std::string& session_id, int channel_type, bool accept)> nim::Rts::AckCallback

◆ AckNotifyCallback

typedef std::function<void(const std::string& session_id, int channel_type, bool accept, const std::string& uid)> nim::Rts::AckNotifyCallback

◆ ConnectNotifyCallback

typedef std::function<void(const std::string& session_id, int channel_type, int code, const std::string& json)> nim::Rts::ConnectNotifyCallback

◆ ControlCallback

typedef std::function<void(NIMResCode res_code, const std::string& session_id, const std::string& info)> nim::Rts::ControlCallback

◆ ControlNotifyCallback

typedef std::function<void(const std::string& session_id, const std::string& info, const std::string& uid)> nim::Rts::ControlNotifyCallback

◆ CreateConfCallback

typedef std::function<void(NIMResCode res_code)> nim::Rts::CreateConfCallback

◆ HangupCallback

typedef std::function<void(NIMResCode res_code, const std::string& session_id)> nim::Rts::HangupCallback

◆ HangupNotifyCallback

typedef std::function<void(const std::string& session_id, const std::string& uid)> nim::Rts::HangupNotifyCallback

◆ JoinConfCallback

typedef std::function<void(NIMResCode res_code, const std::string& session_id, int64_t channel_id, const std::string& custom_info)> nim::Rts::JoinConfCallback

◆ MemberNotifyCallback

typedef std::function<void(const std::string& session_id, int channel_type, const std::string& uid, int code, int leave_type)> nim::Rts::MemberNotifyCallback

◆ OptCallback

typedef std::function<void(NIMResCode res_code, const std::string& session_id, int channel_type, const std::string& json)> nim::Rts::OptCallback

◆ RecDataCallback

typedef std::function<void(const std::string& session_id, int channel_type, const std::string& uid, const std::string& data)> nim::Rts::RecDataCallback

◆ StartChannelCallback

typedef std::function<void(NIMResCode res_code, const std::string& session_id, int channel_type, const std::string& uid)> nim::Rts::StartChannelCallback

◆ StartNotifyCallback

typedef std::function<void(const std::string& session_id, int channel_type, const std::string& uid, const std::string& custom_info)> nim::Rts::StartNotifyCallback

◆ SyncAckNotifyCallback

typedef std::function<void(const std::string& session_id, int channel_type, bool accept)> nim::Rts::SyncAckNotifyCallback

成员函数说明

◆ Ack()

void nim::Rts::Ack ( const std::string &  session_id,
int  channel_type,
bool  accept,
bool  data_record,
bool  audio_record,
const AckCallback cb 
)
static

NIM 回复收到的邀请

参数
[in]session_id会话id
[in]channel_type通道类型,暂时无效
[in]accept是否接受
[in]data_record服务器白板数据录制标记
[in]audio_record服务器音频数据录制标记
[in]cb见nim_rts_def.h
返回
void 无返回值

◆ Control()

void nim::Rts::Control ( const std::string &  session_id,
const std::string &  info,
const ControlCallback cb 
)
static

NIM 会话控制(透传),点对点有效

参数
[in]session_id会话id
[in]info透传数据
[in]cb见nim_rts_def.h
返回
void 无返回值

◆ CreateConf()

void nim::Rts::CreateConf ( const std::string &  name,
const std::string &  custom_info,
const CreateConfCallback cb 
)
static

NIM RTS 创建一个多人数据通道房间(后续需要主动调用加入接口进入房间)

参数
[in]name房间名
[in]custom_info自定义的房间信息(加入房间的时候会返回)
[in]cb结果回调见nim_rts_def.h,返回的json_extension无效
返回
void 无返回值
注解
错误码 200:成功 417:提示已经创建好频道

◆ Hangup()

void nim::Rts::Hangup ( const std::string &  session_id,
const HangupCallback cb 
)
static

NIM 结束会话

参数
[in]session_id会话id
[in]cb见nim_rts_def.h
返回
void 无返回值

◆ JoinConf()

void nim::Rts::JoinConf ( const std::string &  name,
const std::string &  session_id,
bool  record,
const JoinConfCallback cb 
)
static

NIM RTS 加入一个多人房间(进入房间后成员变化等,等同点对点nim_vchat_cb_func)

参数
[in]name房间名
[in]session_id会话id
[in]record是否录制白板数据
[in]cb结果回调见nim_rts_def.h,回调的json_extension若成功返回创建的kNIMRtsCustomInfo及kNIMRtsChannelId,如{"channel_id": 1231, "custom_info":"hello world" }
返回
void 无返回值
注解
错误码 200:成功

◆ Relogin()

void nim::Rts::Relogin ( const std::string &  session_id,
int  channel_type,
OptCallback  cb 
)
static

NIM 白板重连

参数
[in]session_id会话id
[in]channel_type通道类型, 暂时只支持白板类型
[in]cb操作回调
返回
void 无返回值

◆ SendData()

void nim::Rts::SendData ( const std::string &  session_id,
int  channel_type,
const std::string &  data,
const std::string &  uid = "" 
)
static

NIM 发送数据,暂时支持tcp通道,建议发送频率在20Hz以下,现在只支持50k的长度

参数
[in]session_id会话id
[in]channel_type通道类型, kNIMRtsChannelTypeVchat通道如果要自定义数据调用nim_device.h中nim_vchat_custom_audio_data和nim_vchat_custom_video_data
[in]data发送数据
[in]uidjson_extension 可扩展kNIMRtsUid(指定发送某人,不填则群发)
返回
void 无返回值

◆ SetAckNotifyCb()

void nim::Rts::SetAckNotifyCb ( const AckNotifyCallback cb)
static

NIM 设置收到对方回复的通知回调

参数
[in]cb见nim_rts_def.h
返回
void 无返回值
注解
错误码 200:成功 509:失效

◆ SetConnectNotifyCb()

void nim::Rts::SetConnectNotifyCb ( const ConnectNotifyCallback cb)
static

NIM 设置监听通道连接状态回调

参数
[in]cb见nim_rts_def.h
返回
void 无返回值

◆ SetControlNotifyCb()

void nim::Rts::SetControlNotifyCb ( const ControlNotifyCallback cb)
static

NIM 设置收到会话控制的通知回调

参数
[in]cb见nim_rts_def.h
返回
void 无返回值

◆ SetHangupNotifyCb()

void nim::Rts::SetHangupNotifyCb ( const HangupNotifyCallback cb)
static

NIM 设置结束会话通知回调,多人的时候结束后对方无通知。

参数
[in]cb见nim_rts_def.h
返回
void 无返回值

◆ SetMemberChangeCb()

void nim::Rts::SetMemberChangeCb ( const MemberNotifyCallback cb)
static

NIM 设置监听通道成员状态回调

参数
[in]cb见nim_rts_def.h
返回
void 无返回值
注解
错误码 200:成功

◆ SetProxy()

void nim::Rts::SetProxy ( NIMProxyType  type,
const std::string &  host,
int  port,
const std::string &  user,
const std::string &  password 
)
static

设置SDK白板的网络代理,暂时只支持socks5代理,全局代理接口也能设置音视频的代理,两接口没有优先级区别。不需要代理时,type设置为kNIMProxyNone,其余参数都传空字符串(端口设为0)。有些代理不需要用户名和密码,相应参数也传空字符串。

参数
[in]type代理类型,见NIMProxyType定义,其中音视频和白板暂时只支持kNIMProxySocks5代理
[in]host代理地址
[in]port代理端口
[in]user代理用户名
[in]password代理密码
返回
void 无返回值

◆ SetRecDataCb()

void nim::Rts::SetRecDataCb ( const RecDataCallback cb)
static

NIM 设置监听数据接收回调, kNIMRtsChannelTypeVchat通道要监听音视频数据,调用nim_device.h中nim_vchat_set_audio_data_cb和nim_vchat_set_video_data_cb

参数
[in]cb见nim_rts_def.h
返回
void 无返回值

◆ SetStartNotifyCb()

void nim::Rts::SetStartNotifyCb ( const StartNotifyCallback cb)
static

NIM 设置收到会话邀请的通知的回调

参数
[in]cb见nim_rts_def.h
返回
void 无返回值
注解
错误码 200:成功 404:对象不存在,发起记录不存在 509:通道失效

◆ SetSyncAckNotifyCb()

void nim::Rts::SetSyncAckNotifyCb ( const SyncAckNotifyCallback cb)
static

NIM 设置收到本人其他端回复的同步通知回调

参数
[in]cb见nim_rts_def.h
返回
void 无返回值

◆ SetVChatMode()

void nim::Rts::SetVChatMode ( const std::string &  session_id,
int  mode 
)
static

NIM 设置音视频会话类型

参数
[in]session_id会话id
[in]mode见NIMRtsVideoChatMode
返回
void 无返回值

◆ StartChannel()

static void nim::Rts::StartChannel ( int  channel_type,
const std::string &  uid,
RtsStartInfo  info,
const StartChannelCallback cb 
)
static

NIM 创建rts会话,传入的JSON参数定义见nim_rts_def.h

参数
[in]channel_type通道类型 如要tcp+音视频,则channel_type=kNIMRtsChannelTypeTcp|kNIMRtsChannelTypeVchat,同时整个SDK只允许一个音视频通道存在(包括vchat)
[in]uid对方帐号
[in]info发起参数
[in]cb结果回调见nim_rts_def.h
返回
void 无返回值
注解
错误码 200:成功 414:参数错误 501:数据库失败 509:通道失效 514:服务不可用 11001:无可送达的被叫方,主叫方可直接挂断

该类的文档由以下文件生成: