Members
-
deepAccessfunction
-
SDK 使用 deep access 来获取对象的属性值, 通过
NIM.deepAccess
来获取此库的引用 -
util
-
public enum MsgEventSubscribeTag {
//客户端填写
event_type(1), //integer 事件类型
ttl(2), //long 订阅有效期,单位:秒,范围:60s到30天
sync_event(3), //integer 订阅后是否立即同步最新事件,1:同步,0:不同步
//服务器内部填写
publisher_uid(101), //long 被订阅人(事件发布人)的uid
publisher_accid(102), //String 被订阅人(事件发布人)的accid
subscribe_uid(103), //long 订阅人的uid
subscribe_accid(104), //string 订阅人的accid
subscribe_time(105), //long 订阅时间戳
;
} -
util
-
事件信息
public enum MsgEventTag {
//客户端填写的事件基本信息
event_type(1), //integer 事件类型,服务器保留1~99999
event_value(2), //integer 事件状态
msgid_client(3), //string 客户端生成的消息id
config(4), //string 用户自定义事件扩展属性,最长256字节
ttl(5), //long 事件有效期,单位:秒,时间范围:60s到7天
broadcast_type(6), //integer 事件广播类型:1:仅在线 2:在线和离线
sync_self(7), //integer 0:不同步给自己,1:同步给自己
//服务器预留字段,客户端不填写
ttl_type(8), //integer TtlType枚举值
durable(9), //integer 是否需要持久化(可选字段),默认为需要持久化,0:不需要持久化,1:需要持久化
event_time(10), //long 事件发布的时间戳,服务器补充
msgid_server(11), //string, 服务端生成的消息id
//服务器补充的事件发布人相关信息
appid(101), //long 应用ID
publisher_uid(102), //long 事件发布者的uid
publisher_accid(103), //string 事件发布者的accid
client_type(105), //integer 发送客户端类型(可选,客户端不填)
consid(106), //string 发送设备id(可选,客户端不填)
} -
util
-
Copyright: Netease
Description: 该类用于webgl绘制本地视频图像,有一条独立worker,在该worker中建立socket与pc通信,pc中视频信息通过socket传到worker,再从worker传到主线程中进行渲染绘制
优化说明:- CPU: 每一条worker均会在操作系统增开一条线程,多线程会有利于cpu多核处理效率优化;操作ArrayBuffer尽可能使用TypedArray而不要使用DataView,实测TypedArray的cpu消耗为2%时,DataView为10%
- 内存:内存要及时消耗,尤其要注意闭包中不要存在大的数据对象,对象的引用删除了,但对象在其他地方还有可能被引用;worker和socket要及时关闭;大数据量建议使用公共内存,以减少新增内存的CPU开销与内存泄露
Methods
-
changeRoleToAudience(){Promise}
-
互动者切换到观众
Returns:
Type Description Promise -
changeRoleToPlayer(){Promise}
-
观众切换到互动者
Returns:
Type Description Promise