KRTC Web SDK 使用说明
SDK接口
SDK接口导出类命名KRtcClient
,超元RTC客户端
类型 | 接口 | 描述 |
---|---|---|
全局接口 | getVersion | 获取SDK版本号 |
getClientIds | 获取可用的SDK实例ID列表 | |
数据接口 | getRoomId | 获取SDK实例缓存房间ID |
getNickname | 获取SDK实例缓存用户昵称 | |
getUserId | 获取用户ID | |
getRoomInfo | 获取Room信息 | |
getUserList | 获取Room用户列表 | |
基础接口 | init | 初始化 |
login | 登录 | |
join | 进入房间 | |
exit | 离开房间 | |
订阅相关接口 | subscribe | 订阅 |
subscribeChange | 改变订阅 | |
unsubscribe | 取消订阅 | |
麦克风相关接口 | listMicrophone | 获取麦克风列表 |
enableMicrophone | 开启麦克风 | |
disableMicrophone | 关闭麦克风 | |
changeMicrophone | 切换麦克风 | |
testMicrophoneVolume | 获取麦克风测试音量 | |
摄像头相关接口 | listCamera | 获取摄像头列表 |
enableCamera | 开启摄像头 | |
disableCamera | 关闭摄像头 | |
changeCamera | 切换摄像头 | |
扬声器相关接口 | listLoudspeaker | 获取扬声器列表 |
enableLoudspeaker | 开启扬声器 | |
disableLoudspeaker | 关闭扬声器 | |
changeLoudspeaker | 切换扬声器 | |
共享相关接口 | enableShare | 开启共享屏幕 |
disableShare | 关闭共享屏幕 |
SDK事件
/**
* webscoket 键链失败,缺少证书
* 枚举值:ERR_CERT_AUTHORITY_INVALID
* @event websocketErrorCertAuthorityInvalid
*/
export const ERR_CERT_AUTHORITY_INVALID = "websocketErrorCertAuthorityInvalid";
/** webscoket断开链接
* 枚举值:WEBAGENT_SOCKET_ERROR
* @event webrtcagentError
*/
export const WEBAGENT_SOCKET_ERROR = "webrtcagentError";
/**
* 发布双流失败
* 枚举值: ENABLE_SHARE_ERROR
* @event enableShareError
*/
export const ENABLE_SHARE_ERROR = "enableShareError";
/**
* 发布主流音频失败
* 枚举值:ENABLE_PUB_MIC_CAMERA_ERROR
* @event enablePubMicError
*/
export const ENABLE_PUB_MIC_CAMERA_ERROR = "enablePubMicError";
/**
* ajax请求失败
* 枚举值:AJAX_ERROR
* @event ajaxError
*/
export const AJAX_ERROR = "ajaxError";
/**
* 用户在别处登录
* 枚举值:WEBAGENT_TOKENOVERTIME_ERROR
* @event tokenOverTimeError
*/
export const WEBAGENT_TOKENOVERTIME_ERROR = "tokenOverTimeError";
/**
* 会议状态异常
* 枚举值:MEETING_STATE_ERROR
* @event meetingStateError
*/
export const MEETING_STATE_ERROR = "meetingStateError";
/**
* 机房状态异常
* 枚举值:MACHINE_ROOM_STATE_ERR
* @event machineRoomStateErr
*/
export const MACHINE_ROOM_STATE_ERR= "machineRoomStateErr";
/**
* 会议结束,免登录用户需要跳转
* 枚举值:MEETING_STATE_USER_ERROR
* @event meetingStateUserError
*/
export const MEETING_STATE_USER_ERROR = "meetingStateUserError";
/**
* 会议结束或者被请出会议
* 枚举值:MEETING_OVER_ERROR
* @event meetingOverError
*/
export const MEETING_OVER_ERROR = "meetingOverError";
/**
* 需要会议密码
* 枚举值:WEBAGENT_NEEDPASSWORD_ERROR
* @event needPassword
*/
export const WEBAGENT_NEEDPASSWORD_ERROR = "needPassword";
/**
* 终端被抢登
* 枚举值:ANOTHER_LOGIN_ERROR
* @event anotherLoginError
*/
export const ANOTHER_LOGIN_ERROR = "anotherLoginError";
/**
* 重复注册,在别处已被注册
* 枚举值:WEBAGENT_REPEAT_ERROR
* @event repeatregisterError
*/
export const WEBAGENT_REPEAT_ERROR = "repeatregisterError";
//Auth
/**
* 认证变更
* 枚举值:AUTH_ISAUTHENTICATED_UPDATE
* @event authIsAuthenticatedUpdate
* @type {boolean}
* @property {boolean} isAuthenticated - 成功或失败
*/
export const AUTH_ISAUTHENTICATED_UPDATE = "authIsAuthenticatedUpdate";
/**
* 用户数据更新
* 枚举值:AUTH_USER_UPDATE
* @event authUserUpdate
* @type {object}
* @property {object} user - user实体对象
* @property {string} [user.loginName] - 登陆帐号
* @property {string} [user.name] - 名称
* @property {string} [user.e164] - e164号
*/
export const AUTH_USER_UPDATE = "authUserUpdate";
/**
* 用户名更新
* 枚举值:AUTH_USERNAME_UPDATE
* @event authUsernameUpdate
* @type {string}
* @property {string} username - 用户名
*/
export const AUTH_USERNAME_UPDATE = "authUsernameUpdate";
/**
* inner
* AccountToken数据更新
* 枚举值:AUTH_ACCOUNTTOKEN_UPDATE
* @event authAccountTokenUpdate
* @type {string}
* @property {string} AccountToken - AccountToken
*/
export const AUTH_ACCOUNTTOKEN_UPDATE = "authAccountTokenUpdate";
/**
* inner
* SsoToken数据更新
* 枚举值:AUTH_SSOTOKEN_UPDATE
* @event authSsoTokenUpdate
* @type {string}
* @property {string} SsoToken - SsoToken
*/
export const AUTH_SSOTOKEN_UPDATE = "authSsoTokenUpdate";
/**
* inner
* ServerUrl数据更新
* 枚举值:AUTH_SERVERURL_UPDATE
* @event authServerUrlUpdate
* @type {string}
* @property {string} ServerUrl - ServerUrl
*/
export const AUTH_SERVERURL_UPDATE = "authServerUrlUpdate";
/**
* inner
* Protocol数据更新
* 枚举值:AUTH_PROTOCOL_UPDATE
* @event authProtocolUpdate
* @type {string}
* @property {string} protocol - protocol
*/
export const AUTH_PROTOCOL_UPDATE = "authProtocolUpdate";
/**
* inner
* 是否发送信息数据更新
* 枚举值:AUTH_ENABLESENDINFO_UPDATE
* @event authEnableSendInfoUpdate
* @type {boolean}
* @property {boolean} enableSendInfo - enableSendInfo
*/
export const AUTH_ENABLESENDINFO_UPDATE = "authEnableSendInfoUpdate";
/**
* inner delete
* 枚举值:AUTH_ENABLE_PORT_MEDIA_UPDATE
* @event
* @type {boolean}
* @property {boolean} enablePortMedia - enablePortMedia
*/
export const AUTH_ENABLE_PORT_MEDIA_UPDATE = "authEnablePortMediaUpdate";
/**
* inner
* EVSendInfo数据更新
* 枚举值:AUTH_EVSENDINFO_UPDATE
* @event authEVSendInfoUpdate
* @type {object}
* @property {object} EVSendInfo - EVSendInfo
* @property {string} [EVSendInfo.operate] - 名称
* @property {string} [EVSendInfo.codec] - 名称
* @property {string} [EVSendInfo.interval] - 名称
*/
export const AUTH_EVSENDINFO_UPDATE = "authEVSendInfoUpdate";
/**
* inner
* M_tMtInfo数据更新
* 枚举值:AUTH_M_TMTINFO_UPDATE
* @event authM_tMtInfoUpdate
* @type {object}
* @property {object} M_tMtInfo - M_tMtInfo
* @property {string} [M_tMtInfo.m_szAccount] - 帐号
* @property {string} [M_tMtInfo.m_szE164NO] - e164
*/
export const AUTH_M_TMTINFO_UPDATE = "authM_tMtInfoUpdate";
/**
* inner
* 平台属性数据更新
* 枚举值:AUTH_M_TPLATFORMATTR_UPDATE
* @event authM_tPlatformAttrUpdate
* @type {object}
* @property {object} M_tPlatformAttr - 实体
* @property {string} [M_tPlatformAttr.m_bSelfBuilt] - 帐号
* @property {string} [M_tPlatformAttr.m_bSupportPortMedia] - m_bSupportPortMedia
* @property {string} [M_tPlatformAttr.m_dwResourceType] - m_dwResourceType
* @property {string} [M_tPlatformAttr.m_szSupportConfType] - m_szSupportConfType
* @property {string} [M_tPlatformAttr.m_szVersion] - 版本号
*/
export const AUTH_M_TPLATFORMATTR_UPDATE = "authM_tPlatformAttrUpdate";
export const AUTH_M_TSRVINFO_UPDATE = "authM_tSrvInfoUpdate";
export const AUTH_M_TNTPADDRINFO_UPDATE = "authM_tNtpAddrInfoUpdate";
export const AUTH_M_TVRSADDRINFO_UPDATE = "authM_tVrsAddrInfoUpdate";
export const AUTH_M_TDCSADDRINFO_UPDATE = "authM_tDcsAddrInfoUpdate";
export const AUTH_M_TAPSSRVIPLIST_UPDATE = "authM_tApsSrvIpListUpdate";
/**
* inner
* 品牌数据更新
* 枚举值:AUTH_SYSBRAND_UPDATE
* @event authSysBrandUpdate
* @type {string}
* @property {string} SysBrand - 品牌类型
*/
export const AUTH_SYSBRAND_UPDATE = "authSysBrandUpdate";
/**
* inner
* 模式数据更新
* 枚举值:AUTH_SYSMODE_UPDATE
* @event authSysModeUpdate
* @type {string}
* @property {string} SysMode - 模式类型
*/
export const AUTH_SYSMODE_UPDATE = "authSysModeUpdate";
/**
* inner
* Hostname数据更新
* 枚举值:AUTH_HOSTNAME_UPDATE
* @event authHostnameUpdate
* @type {string}
* @property {string} Hostname - Hostname
*/
export const AUTH_HOSTNAME_UPDATE = "authHostnameUpdate";
/**
* inner
* Port数据更新
* 枚举值:AUTH_PORT_UPDATE
* @event authPortUpdate
* @type {string}
* @property {string} Port - Port
*/
export const AUTH_PORT_UPDATE = "authPortUpdate";
/**
* inner
* M_tNmsWebsocketAddrInfo数据更新
* 枚举值:AUTH_M_TNMSWEBSOCKETADDRINFO_UPDATE
* @event authM_tNmsWebsocketAddrInfoUpdate
* @type {object}
* @property {object} M_tNmsWebsocketAddrInfo - 实体
* @property {string} [M_tNmsWebsocketAddrInfo.m_szIpAddr] - m_szIpAddr
* @property {string} [M_tNmsWebsocketAddrInfo.m_szNetDomainName] - m_szNetDomainName
* @property {string} [M_tNmsWebsocketAddrInfo.m_wPort] - m_wPort
* @property {string} [M_tNmsWebsocketAddrInfo.m_wTlsPort] - m_wTlsPort
*/
export const AUTH_M_TNMSWEBSOCKETADDRINFO_UPDATE =
"authM_tNmsWebsocketAddrInfoUpdate";
/**
* webrtcagent连接是否已成功
* 枚举值:AUTH_WEBRTC_AGENT_CONNECT_SUCCESS
* @event authWebrtcagentConnectSuccess
* @type {boolean}
* @property {boolean} isSucess - 成功与否
*/
export const AUTH_WEBRTC_AGENT_CONNECT_SUCCESS =
"authWebrtcagentConnectSuccess";
//Me
/**
* 用户帐号类型更新
* 枚举值:ME_ACCOUNTTYPE_UPDATE
* @event meAccountTypeUpdate
* @type {number}
* @property {number} accountType - 帐号类型, 目前主要用的有:0-账号,1-号码, 8-免登陆
*/
export const ME_ACCOUNTTYPE_UPDATE = "meAccountTypeUpdate";
/**
* inner
* e164更新
* 枚举值:ME_E164_UPDATE
* @event meE164Update
* @type {string}
* @property {string} e164 - e164
*/
export const ME_E164_UPDATE = "meE164Update";
/**
* 显示名更新
* 枚举值:ME_DISPLAYNAME_UPDATE
* @event meDisplayNameUpdate
* @type {string}
* @property {string} displayName - 显示名
*/
export const ME_DISPLAYNAME_UPDATE = "meDisplayNameUpdate";
/**
* inner
* 设备更新
* 枚举值:ME_DEVICE_UPDATE
* @event meDeviceUpdate
* @type {Object}
* @property {Object} device - 实体
* @property {string} flag - 状态
* @property {string} name - 名称
* @property {string} version - 版本
*/
export const ME_DEVICE_UPDATE = "meDeviceUpdate";
/**
* 音量值更新
* 枚举值:ME_VOLUME_UPDATE
* @event meVolumeUpdate
* @type { number}
* @property {number} volume - 音量值
*/
export const ME_VOLUME_UPDATE = "meVolumeUpdate";
/**
* inner
* 摄像头能力是否检测完成
* 枚举值:ME_HASCHECKEDWEBCAM_UPDATE
* @event meHasCheckedWebcamUpdate
* @type { boolean}
* @property {boolean} yesOrNo - 是否完成
*/
export const ME_HASCHECKEDWEBCAM_UPDATE = "meHasCheckedWebcamUpdate";
/**
* 麦克风是否可发送
* 枚举值:ME_CANSENDMIC_UPDATE
* @event meCanSendMicUpdate
* @type { boolean}
* @property {boolean} yesOrNo - 是否可以
*/
export const ME_CANSENDMIC_UPDATE = "meCanSendMicUpdate";
/**
* 摄像头是否可发送
* 枚举值:ME_CANSENDWEBCAM_UPDATE
* @event meCanSendWebcamUpdate
* @type { boolean}
* @property {boolean} yesOrNo - 是否可以
*/
export const ME_CANSENDWEBCAM_UPDATE = "meCanSendWebcamUpdate";
/**
* 是否可以切换摄像头
* 枚举值:ME_CANCHANGEWEBCAM_UPDATE
* @event meCanChangeWebcamUpdate
* @type { boolean}
* @property {boolean} yesOrNo - 是否可以
*/
export const ME_CANCHANGEWEBCAM_UPDATE = "meCanChangeWebcamUpdate";
/**
* inner
* 视频参数更新
* 枚举值:ME_VIDEOPARAM_UPDATE
* @event meVideoParamUpdate
* @type { object}
* @property {object} videoParam - 实体
* @property {number} [videoParam.aspectRatio] - aspectRatio
* @property {object} [videoParam.frame] - frame
*/
export const ME_VIDEOPARAM_UPDATE = "meVideoParamUpdate";
/**
* 摄像头是否处理中
* 枚举值:ME_WEBCAMINPROGRESS_UPDATE
* @event meWebcamInProgressUpdate
* @type { boolean}
* @property {boolean} yesOrNo - 是否
*/
export const ME_WEBCAMINPROGRESS_UPDATE = "meWebcamInProgressUpdate";
/**
* 麦克风是否处理中
* 枚举值:ME_MICINPROGRESS_UPDATE
* @event meMicInProgressUpdate
* @type { boolean}
* @property {boolean} yesOrNo - 是否
*/
export const ME_MICINPROGRESS_UPDATE = "meMicInProgressUpdate";
/**
* 桌面共享是否处理中
* 枚举值:ME_SHAREINPROGRESS_UPDATE
* @event meShareInProgressUpdate
* @type { boolean}
* @property {boolean} yesOrNo - 是否
*/
export const ME_SHAREINPROGRESS_UPDATE = "meShareInProgressUpdate";
/**
* 是否音频正在进入房间处理中
* 枚举值:ME_AUDIOONLYINPROGRESS_UPDATE
* @event meAudioOnlyInProgressUpdate
* @type { boolean}
* @property {boolean} yesOrNo - 是否
*/
export const ME_AUDIOONLYINPROGRESS_UPDATE = "meAudioOnlyInProgressUpdate";
/**
* 是否正在重启ICE中
* 枚举值:ME_RESTARTICEINPROGRESS_UPDATE
* @event meRestartIceInProgressUpdate
* @type { boolean}
* @property {boolean} yesOrNo - 是否
*/
export const ME_RESTARTICEINPROGRESS_UPDATE = "meRestartIceInProgressUpdate";
/**
* 是否音频进入房间状态
* 枚举值:ME_AUDIOONLY_UPDATE
* @event meAudioOnlyUpdate
* @type { boolean}
* @property {boolean} yesOrNo - 是否
*/
export const ME_AUDIOONLY_UPDATE = "meAudioOnlyUpdate";
/**
* 音频静音状态更新
* 枚举值:ME_AUDIOMUTED_UPDATE
* @event meAudioMutedUpdate
* @type { boolean}
* @property {boolean} yesOrNo - 是否
*/
export const ME_AUDIOMUTED_UPDATE = "meAudioMutedUpdate";
/**
* 本地音频流获发送成功与否
* 枚举值:ME_MICSTATE_UPDATE
* @event meMicStateUpdate
* @type { boolean}
* @property {boolean} yesOrNo - 是否
*/
export const ME_MICSTATE_UPDATE = "meMicStateUpdate";
/**
* inner
* mtId更新
* 枚举值:ME_MTID_UPDATE
* @event memtIdUpdate
* @type { string}
* @property {string} mtId - mtId
*/
export const ME_MTID_UPDATE = "memtIdUpdate";
/**
* inner
* moId更新
* 枚举值:ME_MOID_UPDATE
* @event meMoidUpdate
* @type { string}
* @property {string} moId - moId
*/
export const ME_MOID_UPDATE = "meMoidUpdate";
/**
* 本地主流发布成功与否
* 枚举值:ME_WEBCAMSTATE_UPDATE
* @event meWebcamStateUpdate
* @type { boolean}
* @property {boolean} yesOrNo - 是否
*/
export const ME_WEBCAMSTATE_UPDATE = "meWebcamStateUpdate";
/**
* 本地桌面共享流发布成功与否
* 枚举值:ME_SHARESTATE_UPDATE
* @event meShareStateUpdate
* @type { boolean}
* @property {boolean} yesOrNo - 是否
*/
export const ME_SHARESTATE_UPDATE = "meShareStateUpdate";
/**
* 注册返回实体更新
* 枚举值:ME_REGISTERINFO_UPDATE
* @event meRegisterInfoUpdate
* @type { object}
* @property {object} info - 实体
* @property {string} [info.reason] - "Success"的字符串是成功
* @property {string} [info.expires] - 过期时间
*/
export const ME_REGISTERINFO_UPDATE = "meRegisterInfoUpdate";
/**
* 注册返回结果描述更新
* 枚举值:ME_REGISTERREASON_UPDATE
* @event meRegisterReasonUpdate
* @type { object}
* @property {string} reason - "Success"的字符串是成功
*/
export const ME_REGISTERREASON_UPDATE = "meRegisterReasonUpdate";
/**
* inner
* 音频输入参数更新
* 枚举值:ME_AUDIOINPUTDEVICES_UPDATE
* @event meAudioinputDevicesUpdate
* @type { object}
* @property {object} InputDeviceInfo - 实体
* @property {string} [InputDeviceInfo.deviceId] - deviceId
* @property {string} [InputDeviceInfo.groupId] - groupId
* @property {string} [InputDeviceInfo.kind] - kind
* @property {string} [InputDeviceInfo.label] - label
*/
export const ME_AUDIOINPUTDEVICES_UPDATE = "meAudioinputDevicesUpdate";
/**
* inner
* 视频输入参数更新
* 枚举值:ME_VIDEOINPUTDEVICES_UPDATE
* @event meVideoinputDevicesUpdate
* @type { object}
* @property {object} InputDeviceInfo - 实体
* @property {string} [InputDeviceInfo.deviceId] - deviceId
* @property {string} [InputDeviceInfo.groupId] - groupId
* @property {string} [InputDeviceInfo.kind] - kind
* @property {string} [InputDeviceInfo.label] - label
*/
export const ME_VIDEOINPUTDEVICES_UPDATE = "meVideoinputDevicesUpdate";
/**
* inner
* 间频输出参数更新
* 枚举值:ME_AUDIOOUTPUTDEVICES_UPDATE
* @event meAudiooutputDevicesUpdate
* @type { object}
* @property {object} InputDeviceInfo - 实体
* @property {string} [InputDeviceInfo.deviceId] - deviceId
* @property {string} [InputDeviceInfo.groupId] - groupId
* @property {string} [InputDeviceInfo.kind] - kind
* @property {string} [InputDeviceInfo.label] - label
*/
export const ME_AUDIOOUTPUTDEVICES_UPDATE = "meAudiooutputDevicesUpdate";
/**
* inner
*/
export const ME_CURRENTAUDIOINPUTDEVICEID_UPDATE =
"meCurrentAudioinputDeviceIdUpdate";
/**
* inner
*/
export const ME_CURRENTVIDEOINPUTDEVICEID_UPDATE =
"meCurrentVideoinputDeviceIdUpdate";
/**
* inner
*/
export const ME_CURRENTAUDIOOUTPUTDEVICEID_UPDATE =
"meCurrentAudiooutputDeviceIdUpdate";
/**
* inner
* 麦克风音频流参数更新
* 枚举值:ME_AUDIOCONSTRAINTS_UPDATE
* @event meAudioConstraintsUpdate
* @type { object}
* @property {object} AudioConstraints - 实体
*/
export const ME_AUDIOCONSTRAINTS_UPDATE = "meAudioConstraintsUpdate";
//Medias 全部不要
/**
* inner
* 生产者参数更新
* 枚举值:MEDIAS_PRODUCERS_UPDATE
* @event mediasProducersUpdate
* @type { object}
* @property {object} producers - 实体
* @property {object} [producers.audio] - audio实体
* @property {object} [producers.video] - video实体
*/
export const MEDIAS_PRODUCERS_UPDATE = "mediasProducersUpdate";
/**
* inner
* 枚举值:MEDIAS_SHAREPRODUCERS_UPDATE
* @event 桌面共享生产者参数更新
* @type { object}
* @property {object} producers - 实体
* @property {object} [producers.audio] - audio实体
* @property {object} [producers.video] - video实体
*/
export const MEDIAS_SHAREPRODUCERS_UPDATE = "mediasShareProducersUpdate";
/**
* inner
* 枚举值:MEDIAS_CONSUMERS_UPDATE
* @event 消费者参数更新
* @type { Map}
* @property {object} producers - 实体
* @property {object} [producers.audio] - audio实体 以 mtid+mediaType为key值
* @property {object} [producers.video] - video实体 以 mtid+mediaType为key值
*/
export const MEDIAS_CONSUMERS_UPDATE = "mediasConsumersUpdate";
/**
* inner
* 枚举值:MEDIAS_MIXAUDIOCONSUMERS_UPDATE
* @event 桌面共享生产者更新
* @type { Map}
* @property {object} consumers - Map
* @property {object} [producers.key] - consumers实体 以 streamid+mediaType(mixaudio)为key值
*/
export const MEDIAS_MIXAUDIOCONSUMERS_UPDATE = "mediasMixaudioConsumersUpdate";
/**
* inner
* 枚举值:MEDIAS_MIXAUDIOCONSUMERS_REMOVE
* @event 消费者移除
* @type { Map}
* @property {object} Consumers - 实体
* @property {object} [producers.audio] - audio实体 以 mtid+mediaType为key值
* @property {object} [producers.video] - video实体 以 mtid+mediaType为key值
*/
export const MEDIAS_MIXAUDIOCONSUMERS_REMOVE = "mediasMixaudioConsumersRemove";
/**
* inner
* 枚举值:MEDIAS_SHARECONSUMERS_UPDATE
* @event 消费者更新
* @type { Map}
* @property {object} Consumers - 实体
* @property {object} [producers.audio] - audio实体 以 mtid+mediaType为key值
* @property {object} [producers.video] - video实体 以 mtid+mediaType为key值
*/
export const MEDIAS_SHARECONSUMERS_UPDATE = "mediasShareConsumersUpdate";
//MtList
/**
* inner
* 成员有序列表
* 枚举值:MTLIST_ORDEREDLIST_UPDATE
* @event mtlistOrderedListUpdate
* @type { Array }
* @property {Array} list - 数组
*/
export const MTLIST_ORDEREDLIST_UPDATE = "mtlistOrderedListUpdate";
/**
* 成员列表,正常房间在上,免登录在下
* 枚举值:MTLIST_MEMBERLIST_UPDATE
* @event mtlistMemberListUpdate
* @type { Array }
* @property {Array} list - 数组
*/
export const MTLIST_MEMBERLIST_UPDATE = "mtlistMemberListUpdate";
/**
* 大视图标识
* 枚举值:MTLIST_BIGVIEW_UPDATE
* @event mtlistBigViewUpdate
* @type { string }
* @property {string} key - mtid+mediaType拼接的key
*/
export const MTLIST_BIGVIEW_UPDATE = "mtlistBigViewUpdate";
/**
* peers更新
* 枚举值:MTLIST_PEERS_UPDATE
* @event mtlistPeersUpdate
* @type { Map }
* @property {Map} peers - 键值对象
* @property {object} peer - 实体
*/
export const MTLIST_PEERS_UPDATE = "mtlistPeersUpdate";
/**
* 发言方标识通知
* 枚举值:MTLIST_SPEAKER_UPDATE
* @event mtlistSpeakerUpdate
* @type { string }
* @property {string} mtid - 标识
*/
export const MTLIST_SPEAKER_UPDATE = "mtlistSpeakerUpdate";
/**
* 缓存音量更新
* 枚举值:MTLIST_PEERS_VOLUME_UPDATE
* @event mtlistPeersVolumeUpdate
* @type { Map }
* @property {Map} volumesMap - 标识
* @property {string} key - mtId
* @property {number} value - 音量值
*/
export const MTLIST_PEERS_VOLUME_UPDATE = "mtlistPeersVolumeUpdate";
/**
* 双流信息更新
* 枚举值:MTLIST_DOUBLEINFO_UPDATE
* @event mtlistDoubleInfoUpdate
* @type { Object }
* @property {Object} doubleInfo - 标识
* @property {boolean} [doubleInfo.isHasDouble] - 是否双流
* @property {string} [doubleInfo.doubleKey] - 双流标识
* @property {number} [doubleInfo.dualMt] - mtid
*/
export const MTLIST_DOUBLEINFO_UPDATE = "mtlistDoubleInfoUpdate";
/**
* inner
*/
export const MTLIST_CLOSEALLSMALLPEER_UPDATE = "mtlistCloseAllSmallPeerUpdate";
/**
* inner
*/
export const MTLIST_PEERSORDER_UPDATE = "mtlistPeersOrderUpdate";
/**
* inner
* 大画面锁定状态变更
* 枚举值:MTLIST_LOCKSTATE_UPDATE
* @event mtlistLockStateUpdate
* @type { boolean }
* @property {boolean} yesOrNo - 是否
*/
export const MTLIST_LOCKSTATE_UPDATE = "mtlistLockStateUpdate";
/**
* 大画面锁定状态变更原因
* 枚举值:MTLIST_LOCKREASON_UPDATE
* @event mtlistLockReasonUpdate
* @type { string }
* @property {string} Reason - 原因
*/
export const MTLIST_LOCKREASON_UPDATE = "mtlistLockReasonUpdate";
/**
* 更新我的mtid
* 枚举值:MTLIST_MEID_UPDATE
* @event mtlistMeIdUpdate
* @type { string }
* @property {string} mtId - 原因
*/
export const MTLIST_MEID_UPDATE = "mtlistMeIdUpdate";
/**
* inner
* 是否强制广播画面合成变更
* 枚举值:MTLIST_BFORCEVMP_UPDATE
* @event mtlistBforceVmpUpdate
* @type { boolean }
* @property {boolean} yesOrNo - 是否
*/
export const MTLIST_BFORCEVMP_UPDATE = "mtlistBforceVmpUpdate";
/**
* inner
* 画面合成成员变更
* 枚举值:MTLIST_VMPMEMBER_UPDATE
* @event mtlistVmpMemberUpdate
* @type { Array }
* @property {Array} VmpMember - 成员列表
* @property {Array} [VmpMember.streamid] - 流标识
* @property {Array} [VmpMember.label.mt] - mt
* @property {Array} [VmpMember.label.mcu] - mcu
*/
export const MTLIST_VMPMEMBER_UPDATE = "mtlistVmpMemberUpdate";
/**
* 是否画面合成模式变更
* 枚举值:MTLIST_VMPMOD_UPDATE
* @event mtlistVmpmodUpdate
* @type { boolean }
* @property {boolean} yesOrNo - 是否
*/
export const MTLIST_VMPMOD_UPDATE = "mtlistVmpmodUpdate";
/**
* 是否强制选看变更
* 枚举值:MTLIST_BFORCEBROAD_UPDATE
* @event mtlistBforceBroadUpdate
* @type { boolean }
* @property {boolean} yesOrNo - 是否
*/
export const MTLIST_BFORCEBROAD_UPDATE = "mtlistBforceBroadUpdate";
/**
* 强制选看开启状态变更
* 枚举值:MTLIST_BROADOPEN_UPDATE
* @event mtlistBroadOpenUpdate
* @type { boolean }
* @property {boolean} yesOrNo - 是否
*/
export const MTLIST_BROADOPEN_UPDATE = "mtlistBroadOpenUpdate";
/**
* 选看终端mt更新
* 枚举值:MTLIST_BROADMT_UPDATE
* @event mtlistBroadMtUpdate
* @type { number }
* @property {number} mt - 是否
*/
export const MTLIST_BROADMT_UPDATE = "mtlistBroadMtUpdate";
/**
* 锁定时间更新
* 枚举值:MTLIST_LOCKTIME_UPDATE
* @event mtlistLockTimeUpdate
* @type { number }
* @property {number} mt - 是否
*/
export const MTLIST_LOCKTIME_UPDATE = "mtlistLockTimeUpdate";
//Room
/**
* inner
* 当前终端是否为主呼状态变更
* 枚举值:ROOM_ISCALLER_UPDATE
* @event roomIsCallerUpdate
* @type { boolean }
* @property {boolean} yesOrNo - 是否
*/
export const ROOM_ISCALLER_UPDATE = "roomIsCallerUpdate";
/**
* inner
* 当前终端是否为呼叫中状态变更
* 枚举值:ROOM_CALLING_UPDATE
* @event roomCallingUpdate
* @type { boolean }
* @property {boolean} yesOrNo - 是否
*/
export const ROOM_CALLING_UPDATE = "roomCallingUpdate";
/**
* inner
* 当前终端是否为被呼叫中状态变更
* 枚举值:ROOM_BECALLING_UPDATE
* @event roomBeCallingUpdate
* @type { boolean }
* @property {boolean} yesOrNo - 是否
*/
export const ROOM_BECALLING_UPDATE = "roomBeCallingUpdate";
/**
* inner
* 会议列表变更
* 枚举值:ROOM_MEETINGLIST_UPDATE
* @event roomMeetingListUpdate
* @type { Array }
* @property {Array} MeetingList - 列表
*/
export const ROOM_MEETINGLIST_UPDATE = "roomMeetingListUpdate";
/**
* 是否进入房间状态更新
* 枚举值:ROOM_ISINMEETING_UPDATE
* @event roomIsInMeetingUpdate
* @type { boolean }
* @property {boolean} yesOrNo - 是否
*/
export const ROOM_ISINMEETING_UPDATE = "roomIsInMeetingUpdate";
/**
* inner
* 是否正在转场进程中
* 枚举值:ROOM_CHANGE_MEETING_TYPE_IN_PROGRESS_UPDATE
* @event changeMeetingTypeInProgress
* @type { boolean }
* @property {boolean} yesOrNo - 是否
*/
export const ROOM_CHANGE_MEETING_TYPE_IN_PROGRESS_UPDATE =
"changeMeetingTypeInProgress";
/**
* 会议详情更新
* 枚举值:ROOM_MEETINGINFO_UPDATE
* @event roomMeetingInfoUpdate
* @type { object }
* @property {object} meetingInfo - 实体
*/
export const ROOM_MEETINGINFO_UPDATE = "roomMeetingInfoUpdate";
/**
* inner
* 枚举值:会议的双流最大帧率更新
* ROOM_MEETING_DUALVIDEO_MAXFPS_UPDATE
* @event roomMeetingDualvideoMaxFpsUpdate
* @type { number }
* @property {number} dualvideoMaxFps - 值:默认15
*/
export const ROOM_MEETING_DUALVIDEO_MAXFPS_UPDATE =
"roomMeetingDualvideoMaxFpsUpdate";
/**
* 会议e164号更新
* 枚举值:ROOM_MEETINGE164_UPDATE
* @event roomMeetingE164Update
* @type { string }
* @property {string} e164 - 值
*/
export const ROOM_MEETINGE164_UPDATE = "roomMeetingE164Update";
/**
* 正在呼叫的e164号更新
* 枚举值:ROOM_CALLING_MEETINGE164_UPDATE
* @event roomCallingMeetingE164Update
* @type { string }
* @property {string} e164 - 值
*/
export const ROOM_CALLING_MEETINGE164_UPDATE = "roomCallingMeetingE164Update";
/**
* 会议名称更新
* 枚举值:ROOM_MEETINGNAME_UPDATE
* @event roomMeetingNameUpdate
* @type { string }
* @property {string} meetingName - 会议名称
*/
export const ROOM_MEETINGNAME_UPDATE = "roomMeetingNameUpdate";
/**
* 会议结束时间更新
* 枚举值:ROOM_MEETINGENDTIME_UPDATE
* @event roomMeetingEndTimeUpdate
* @type { string }
* @property {string} time - 结束时间 永久会议为0
*/
export const ROOM_MEETINGENDTIME_UPDATE = "roomMeetingEndTimeUpdate";
/**
* 会议链接更新
* 枚举值:ROOM_MEETINGLINK_UPDATE
* @event roomMeetingLinkUpdate
* @type { string }
* @property {string} link - 链接地址
*/
export const ROOM_MEETINGLINK_UPDATE = "roomMeetingLinkUpdate";
/**
* 会议状态
* 枚举值:ROOM_STATE_UPDATE
* @event roomStateUpdate
* @type { string }
* @property {string} state - 状态(new/connecting/connected/disconnected/closed)
*/
export const ROOM_STATE_UPDATE = "roomStateUpdate";
/**
* 会议流控类型更新
* 枚举值:ROOM_MEETING_TYPE_UPDATE
* @event roomMeetingTypeUpdate
* @type { string }
* @property {string} state - 会议流控类型( 默认:"Speaking", 发言会场; "Audience":观众会场)
*/
export const ROOM_MEETING_TYPE_UPDATE = "roomMeetingTypeUpdate";
/**
* inner
* 会议列表更新
* 枚举值:MEETING_LIST_UPDATE
* @event meetinglistUpdate
* @type { Array }
* @property {Array} list - 列表
*/
export const MEETING_LIST_UPDATE = "meetinglistUpdate";
/**
* 本地视频流更新
* 枚举值:LOCAL_VIDEO_TRACK_UPDATE
* @event localVideoTrackUpdate
* @type { object }
* @property {object} track - 实体
*/
export const LOCAL_VIDEO_TRACK_UPDATE = "localVideoTrackUpdate";
使用指南
使用过程
单个SDK实例应用
-
示例代码
const APP_TOKEN = "TOKEN12345678";
const USER_ID = "6666660000001";
const USER_NICKNAME = "张三";
let clientIds = KRtcClient.getClientIds();
let clientId = (clientIds && clientIds.length > 0) ? clientIds[0] : "";
let kRtcClient = new KRtcClient({clientId: clientId});
kRtcClient.init({
hostname: "dev.kedacom.com",
success: function() {
// 加入房间
doJoin();
},
error: function() {
// 未获取到用户信息,重定位到登录界面或执行登录
kRtcClient.login({
userId: USER_ID, // 用户ID
nickname: USER_NICKNAME, // 昵称
appToken: APP_TOKEN, // 应用token
success: function() {
// 加入房间
doJoin();
}
});
}
});
function doJoin(roomId) {
if (!roomId) {
roomId = kRtcClient.getRoomId();
}
kRtcClient.join({
roomId: roomId,
success: function(data) {
// 获取用户列表
// kRtcClient.getUserList();
// 订阅流
// kRtcClient.subscribe();
},
error: function(cause) {
// 加入房间失败
console.log("加入房间失败");
}
});
}
多个SDK实例应用
demo地址
https://dev.kedacom.com/sdkdemo2/index.html
示例代码
const APP_TOKEN = "TOKEN12345678";
let clientIds = KRtcClient.getClientIds();
let clientId1 = (clientIds && clientIds.length > 0) ? clientIds[0] : "";
let clientId2 = (clientIds && clientIds.length > 1) ? clientIds[1] : "";
let clientId3 = (clientIds && clientIds.length > 2) ? clientIds[2] : "";
let clientId4 = (clientIds && clientIds.length > 3) ? clientIds[3] : "";
initKRtcClient(clientId1, "dev.kedacom.com", "6660001", "监控终端别名1");
initKRtcClient(clientId2, "dev.kedacom.com", "6660002", "监控终端别名2");
initKRtcClient(clientId3, "dev.kedacom.com", "6660003", "监控终端别名3");
initKRtcClient(clientId4, "dev.kedacom.com", "6660004", "监控终端别名4");
function initKRtcClient(clientId, hostname, roomId, nickname) {
let kRtcClient = new KRtcClient({clientId: clientId});
kRtcClient.init({
hostname: hostname,
success: function(data) {
doJoin(roomId);
},
error: function(cause) {
kRtcClient.login({
appToken: APP_TOKEN, // 应用token
nickname: nickname,
success: function(data) {
doJoin(roomId);
},
error: function(cause) {
// 登录失败
console.log("登录失败");
}
})
}
});
return kRtcClient1;
}
function doJoin(roomId) {
kRtcClient1.join({
roomId: roomId,
success: function(data) {
// 获取用户列表
// kRtcClient.getUserList();
// 订阅流
// kRtcClient.subscribe();
},
error: function(cause) {
// 加入房间失败
console.log("加入房间失败");
}
})
}
下载
-
KRTC Web SDK库文件
-
KRTC Web 单实例Demo
-
KRTC Web 多实例Demo