Iot SDK 4.0.0
载入中...
搜索中...
未找到
jrtc_handler_t结构体 参考

会话中的事件处理函数集合 更多...

#include <jrtc.h>

成员变量

int(* on_user_joined )(struct jrtc_t *jc, char uid[64], unsigned role, unsigned status)
 用户的加入事件.
 
int(* on_user_changed )(struct jrtc_t *jc, char uid[64], int index, unsigned role, unsigned status)
 用户的更新事件.
 
void(* on_user_offline )(struct jrtc_t *jc, char uid[64], int index, enum jrtc_error reason)
 用户的离线事件.
 
void(* on_user_message )(struct jrtc_t *jc, char uid[64], int index, struct jrtc_slice_t msg[], unsigned num)
 用户的文本消息.
 
void(* on_video_changed )(struct jrtc_t *jc, char vid[64], int index)
 收到视频首帧事件.
 
void(* on_share_changed )(struct jrtc_t *jc, char uid[64], int index)
 共享者的改变事件 会话内全局只有一个共享屏幕, 被所有用户抢占使用.
 
void(* on_audio_volume )(struct jrtc_t *jc, unsigned num, unsigned char index_volume[][2])
 已索引成员的音量变化.
 
void(* on_user_netstate )(struct jrtc_t *jc, unsigned num, unsigned char index_netstate[][2])
 已索引成员的网络状态.
 

详细描述

会话中的事件处理函数集合

在文件 jrtc.h248 行定义.

结构体成员变量说明

◆ on_user_joined

int(* on_user_joined) (struct jrtc_t *jc, char uid[64], unsigned role, unsigned status)

用户的加入事件.

当 uid 为自身时, 说明加入成功, 后续将打开并独占媒体设备, 此时界面必须释放设备 不保证加入的次序, 有可能存在其他人早于自身加入成功的情况

参数
[in]uid用户ID
[in]role用户角色
[in]status用户状态
返回值
请求绑定该用户的index, 若 0 或负数则忽略

在文件 jrtc.h259 行定义.

◆ on_user_changed

int(* on_user_changed) (struct jrtc_t *jc, char uid[64], int index, unsigned role, unsigned status)

用户的更新事件.

注解
有可能存在其他人加入并更新早于自身加入成功的情况
参数
[in]uid用户ID
[in]index该用户索引值
[in]role用户角色
[in]status用户状态
返回值
请求重绑定该用户的newindex, 若 0 或与 index 相等则忽略

在文件 jrtc.h271 行定义.

◆ on_user_offline

void(* on_user_offline) (struct jrtc_t *jc, char uid[64], int index, enum jrtc_error reason)

用户的离线事件.

当 uid 为自身时,说明已离开会话, 无须调用 jrtc_leave 内部可以保证离开后, 没有后续任何事件 对应的index也将自动删除

参数
[in]uid用户ID
[in]index该用户索引值
[in]reason离线原因

在文件 jrtc.h282 行定义.

◆ on_user_message

void(* on_user_message) (struct jrtc_t *jc, char uid[64], int index, struct jrtc_slice_t msg[], unsigned num)

用户的文本消息.

参数
[in]uid消息来源的用户ID
[in]index该用户索引值
[in]msg多个消息块. 起始地址为uid, 第i个消息地址 = (uid + msg[i].offset)
[in]num消息个数

在文件 jrtc.h291 行定义.

◆ on_video_changed

void(* on_video_changed) (struct jrtc_t *jc, char vid[64], int index)

收到视频首帧事件.

会话中用户的 status 包含JRTC_STATUS_VIDEO, 说明他有发送视频 使用 jrtc_set_video 订阅该远端用户后, 收到首帧后就会有该事件

参数
[in]vid视频ID. 可以是用户视频 uid 或 共享屏幕 channelId 空表示已停止接收视频
[in]index该用户索引值

在文件 jrtc.h301 行定义.

◆ on_share_changed

void(* on_share_changed) (struct jrtc_t *jc, char uid[64], int index)

共享者的改变事件 会话内全局只有一个共享屏幕, 被所有用户抢占使用.

因此每个用户至多上传两路视频流。 共享屏幕ID是 channelId

参数
[in]uid用户ID, 共享者. 空表示不存在共享
[in]index该用户索引值

在文件 jrtc.h312 行定义.

◆ on_audio_volume

void(* on_audio_volume) (struct jrtc_t *jc, unsigned num, unsigned char index_volume[][2])

已索引成员的音量变化.

首次收到音频数据时也上报该事件, 且num=0,index_volume=NULL 其他情况下需要定时主动调用jrtc_request_volume请求才有, 且只上报绑定过索引值的用户音量

参数
[in]num后续的音量个数
[in]index_volume索引与音量的数组,音量范围[0,100]

在文件 jrtc.h322 行定义.

◆ on_user_netstate

void(* on_user_netstate) (struct jrtc_t *jc, unsigned num, unsigned char index_netstate[][2])

已索引成员的网络状态.

需要定时主动调用jrtc_request_netstate请求才有, 且只上报绑定过索引值的用户网络状态 网络状态范围[0,5], 0是未知, 1是最差, 5是最好 定义为只影响本地接收质量的状态:

  • 其他成员的上行发送状态
  • 本地自身的下行接收状态
参数
[in]num后续的状态个数
[in]index_netstate索引与网络状态的数组,

在文件 jrtc.h335 行定义.


该结构体的文档由以下文件生成: