跳到主要内容

接口概览

SDK接口

SDK接口导出类命名KRtcClient,超元RTC客户端

类型接口描述
全局接口getVersion 获取SDK版本号
getClientIds 获取可用的SDK实例ID列表
数据接口getRoomId 获取SDK实例缓存房间ID
getNickname 获取SDK实例缓存用户昵称
getUserId 获取用户ID
getRoomInfo 获取Room信息
getUserList 获取Room用户列表
getStatsInfo 获取订阅/发布流信息
基础接口init 初始化
login 登录
join 进入房间
exit 离开房间
accept 接受呼叫
reject 拒绝呼叫
destroy 销毁SDK实例
订阅相关接口subscribe 订阅
subscribeChange 改变订阅
unsubscribe 取消订阅
麦克风相关接口listMicrophone 获取麦克风列表
getCurrentMicrophone 获取当前使用的麦克风
enableMicrophone 开启麦克风
disableMicrophone 关闭麦克风
changeMicrophone 切换麦克风
testMicrophoneVolume 获取麦克风测试音量
摄像头相关接口listCamera 获取摄像头列表
getCurrentCamera 获取当前使用的摄像头
enableCamera 开启摄像头
disableCamera 关闭摄像头
changeCamera 切换摄像头
扬声器相关接口listLoudspeaker 获取扬声器列表
getCurrentLoudspeaker 获取当前使用的扬声器
enableLoudspeaker 开启扬声器
disableLoudspeaker 关闭扬声器
changeLoudspeaker 切换扬声器
testLoudspeaker 开始测试扬声器
stopTestLoudspeaker 停止测试扬声器
testLoudspeakerVolume 获取扬声器测试音量
共享相关接口enableShare 开启共享屏幕
disableShare 关闭共享屏幕

SDK事件

SDK事件导出类命名KRtcEvent

/*******************
* 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";



/**
* 会议结束,免登录用户需要跳转
* 枚举值: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";

/**
* 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";

/**
* 显示名更新
* 枚举值:ME_DISPLAYNAME_UPDATE
* @event meDisplayNameUpdate
* @type {string}
* @property {string} displayName - 显示名
*/
export const ME_DISPLAYNAME_UPDATE = "meDisplayNameUpdate";

/**
* 音量值更新
* 枚举值:ME_VOLUME_UPDATE
* @event meVolumeUpdate
* @type { number}
* @property {number} volume - 音量值
*/
export const ME_VOLUME_UPDATE = "meVolumeUpdate";

/**
* 麦克风是否可发送
* 枚举值: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";

/**
* 摄像头是否处理中
* 枚举值: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";

/**
* 本地主流发布成功与否
* 枚举值: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";

/**
* 成员列表,正常房间在上,免登录在下
* 枚举值:MTLIST_MEMBERLIST_UPDATE
* @event mtlistMemberListUpdate
* @type { Array }
* @property {Array} list - 数组
*/
export const MTLIST_MEMBERLIST_UPDATE = "mtlistMemberListUpdate";

/**
* 观众终端成员列表
* AUDIENCE_MTLIST_MEMBERLIST_UPDATE
* @event audienceMtlistMemberListUpdate
* @type { Array }
* @property {Array} list - 数组
*/
export const AUDIENCE_MTLIST_MEMBERLIST_UPDATE = "audienceMtlistMemberListUpdate";

/**
* 大视图标识
* 枚举值: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";

/**
* audiencePeers更新
* 枚举值:AUDIENCE_MTLIST_PEERS_UPDATE
* @event audienceMtlistPeersUpdate
* @type { Map }
* @property {Map} peers - 键值对象
* @property {object} peer - 实体
*/
export const AUDIENCE_MTLIST_PEERS_UPDATE = "audienceMtlistPeersUpdate";

/**
* 发言方标识通知
* 枚举值: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";export const MTLIST_VMPINFO_UPDATE = "mtlistVmpInfoUpdate";export const MTLIST_CLOSEALLSMALLPEER_UPDATE = "mtlistCloseAllSmallPeerUpdate";export const MTLIST_PEERSORDER_UPDATE = "mtlistPeersOrderUpdate";

/**
* 大画面锁定状态变更原因
* 枚举值: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";

/**
* 是否画面合成模式变更
* 枚举值:MTLIST_VMPMOD_UPDATE
* @event mtlistVmpmodUpdate
* @type { boolean }
* @property {boolean} yesOrNo - 是否
*/
export const MTLIST_VMPMOD_UPDATE = "mtlistVmpmodUpdate";

/**
* 画面合成信息更新
* MEDIAS_VMPCONSUMERS_UPDATE
* @event mediasVmpConsumersUpdate
*/
const MEDIAS_VMPCONSUMERS_UPDATE = "mediasVmpConsumersUpdate"

/**
* 是否强制选看变更
* 枚举值:MTLIST_BFORCEBROAD_UPDATE
* @event mtlistBforceBroadUpdate
* @type { boolean }
* @property {boolean} yesOrNo - 是否
*/
export const MEDIAS_VMPCONSUMERS_UPDATE = "mediasVmpConsumersUpdate"

/**
* 是否强制选看变更
* 枚举值: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";

/**
* 被呼会议通知
* 枚举值:BECALLING
* @event beCalling
* @type { Array }
* @property {Array} beCallingMeetingList - 列表
*/
export const BECALLING = "beCalling";

/**
* 是否进入房间状态更新
* 枚举值:ROOM_ISINMEETING_UPDATE
* @event roomIsInMeetingUpdate
* @type { boolean }
* @property {boolean} yesOrNo - 是否
*/
export const ROOM_ISINMEETING_UPDATE = "roomIsInMeetingUpdate";

/**
* 会议详情更新
* 枚举值:ROOM_MEETINGINFO_UPDATE
* @event roomMeetingInfoUpdate
* @type { object }
* @property {object} meetingInfo - 实体
*/
export const ROOM_MEETINGINFO_UPDATE = "roomMeetingInfoUpdate";

/**
* 会议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";

/**
* 本地视频流更新
* 枚举值:LOCAL_VIDEO_TRACK_UPDATE
* @event localVideoTrackUpdate
* @type { object }
* @property {object} track - 实体
*/
export const LOCAL_VIDEO_TRACK_UPDATE = "localVideoTrackUpdate";

/**
* 是否正在获取用户权限
* 枚举值:USER_MEDIA_ING
* @event USER_MEDIA_ING
* @type {boolean}
* @property {boolean} yesOrNo
*/
export const USER_MEDIA_ING = "userMediaIng";