xiaosongxiaosong / study-notes

xiaosong的学习笔记
https://github.com/xiaosongxiaosong/study-notes/issues
1 stars 0 forks source link

Janus #8

Open xiaosongxiaosong opened 5 years ago

xiaosongxiaosong commented 5 years ago

全局变量

xiaosongxiaosong commented 5 years ago

Janus Static 属性

属性 类型 初始值 说明
sessions object {} ---
noop func function () {} ---
initDone bool --- ---
xiaosongxiaosong commented 5 years ago

Janus Static 方法

返回值:Bool

返回值:object

属性 类型 默认值 说明
newWebSocket func --- ---
extension object defaultExtension ---
isArray object --- ---
webRTCAdapter object adapter ---
httpAPICall object --- ---

返回值:object

属性 类型 默认值 说明
newWebSocket func --- ---
extension object defaultExtension ---
isArray object --- ---
webRTCAdapter object adapter ---
httpAPICall object --- ---

初始化

  1. 检查是否已经初始化了,如果是则直接调用 callback
  2. 根据 debug 参数初始化 Janus.trace Janus.debug Janus.vdebug Janus.log Janus.warn Janus.error
  3. 将 dependencies 的属性复制给 Janus
  4. 初始化插件
  5. 初始化 listDevices attachMediaStream reattachMediaStream 方法
  6. 监听 beforeunload / pagehide 方法,离开页面时检查 sessions ,循环销毁 sessions
  7. 设置 initDone 为 true, 调用 callback

入参:options[object]

属性 类型 默认值 说明
callback func --- ---
debug string or bool --- ---
dependencies object --- 如果为传入使用 Janus.useDefaultDependencies 获取

入参:

参数 类型 默认值 说明
callback func --- ---
config object { audio: true, video: true } ---
xiaosongxiaosong commented 5 years ago

入参: gatewayCallbacks[object]

属性 类型 默认值 说明
error func --- ---
success func --- ---
destroyed func --- ---
server string --- ---
iceServers array [{urls: "stun:stun.l.google.com:19302"}] 穿透NAT的公网服务器
iceTransportPolicy string --- ---
bundlePolicy string --- ---
ipv6Support bool false ---
withCredentials bool false ---
max_poll_events number 1 ---
token object null ---
apisecret object null ---
destroyOnUnload bool true ---
keepAlivePeriod number 25000 ---
longPollTimeout number 60000 ---
xiaosongxiaosong commented 5 years ago

Janus 实例私有变量

属性 类型 默认值 说明
websockets bool false ---
ws bool null ---
wsHandlers object {} ---
wsKeepaliveTimeoutId number null ---
servers array null ---
serversIndex number 0 ---
server string false ---
iceServers array [{urls: "stun:stun.l.google.com:19302"}] 穿透NAT的公网服务器
iceTransportPolicy string --- ---
bundlePolicy string --- ---
ipv6Support bool false ---
withCredentials bool false ---
maxev number 1 ---
token object null ---
apisecret object null ---
destroyOnUnload bool true ---
keepAlivePeriod number 25000 ---
longPollTimeout number 60000 ---
connected bool false ---
sessionId string null ---
pluginHandles object null ---
that object this ---
retries number 0 ---
transactions object {} ---
xiaosongxiaosong commented 5 years ago

Janus 实例私有方法

xiaosongxiaosong commented 5 years ago

Janus 实例公开变量

属性 类型 默认值 说明
destroyOnUnload bool true ---

Janus 实例公开方法