初始化
更新时间:2026-06-10 13:52:30

初始化 init

描述:初始化 SDK

示例
await YlinkMeeting.init({
	clientId: CLIENT_ID,
	accessToken: accessToken,
	baseURL: 'https://meetings.ylyun.com',
	leaveURL: 'https://meetings.ylyun.com',
	meetingNum: '866666666666',
	pwd: '',
	displayName: 'WebAPP SDK',
	viewMode: 'client',
	isPrivateCloud: true,
	onJoined: () => {
		console.log('onJoined');
	},
	onReady: () => {
		console.log('onReady');
	},
	onClose: () => {
		console.log('onClose');
	},
});
参数
名称 类型 是否必须 默认值 备注
clientId string - clientId 与 clientSecret (亿联融合通信暂不支持,传入非空字符串即可)
accessToken string - accessToken 由 clientId 与 clientSecret 请求接口获取,详情可查看 demo (亿联融合通信暂不支持,传入非空字符串即可)
baseURL string - 服务器地址
videoSDKLibDir string - 媒体资源文件地址
meetingNum string - 会议号
pwd string - 会议密码
displayName string - 入会名称
leaveURL string - 退会后跳转地址,viewMode 为 Client 时生效
viewMode ViewMode client SDK 视图显示模式
themeColor string - 自定义主题色
custom Custom - 显示自定义
componentCustom ComponentCustom - 组件模式显示自定义
i18n I18n - 国际化自定义
isPrivateCloud boolean false 亿联融合通信对接需要 isPrivateCloud 设置为 true
meetingConfig MeetingConfig - 会议功能特性自定义
disableAutoCloseVideoWhenBusy boolean false 系统负载较高时,禁用自动关闭摄像头
reduceVideoResolution boolean false 降低视频订阅分辨率
onJoined (): void - 信令链接成功回调方法
onReady (): void - 入会成功回调方法
onClose (reason?: { bizCode?: number; reasonCode?: number; message?: string }) => void - 退会回调方法
onAudioSendOnChange (sendOn: boolean): void - 音频发送状态回调方法
onVideoSendOnChange (sendOn: boolean): void - 视频发送状态回调方法
onAudioInputChange (device: MediaDeviceInfo): void - 麦克风设备变更回调方法 (device 可能为null)
onAudioOutputChange (device: MediaDeviceInfo): void - 扬声器设备变更回调方法 (device 可能为null)
onVideoInputChanged (device: MediaDeviceInfo): void - 摄像头设备变更回调方法 (device 可能为null)
onAudioInputDevicesUpdated (devices: MediaDeviceInfo[]): void - 麦克风设备列表变更回调方法
onAudioOutputDevicesUpdated (devices: MediaDeviceInfo[]): void - 扬声器设备列表变更回调方法
onVideoInputDevicesUpdated (devices: MediaDeviceInfo[]): void - 摄像头设备列表变更回调方法
ViewMode

枚举值 描述
client 客户端模式
component 组件模式
Custom

名称 类型 是否必须 默认值 描述
showPreview boolean true 预览页面显示/隐藏
showMeetingHeader boolean true 顶部栏显示/隐藏
showMeetingControlBar boolean true 底部控制栏显示/隐藏
showAudioButton boolean true 控制栏音频按钮显示/隐藏
showVideoButton boolean true 控制栏视频按钮显示/隐藏
showShareContentButton boolean true 共享屏幕显示/隐藏
showFeedbackButton boolean true 问题反馈显示/隐藏
showMoreButton boolean true 更多按钮显示/隐藏
showLeaveMeetingButton boolean true 退会按钮显示/隐藏
showInviteButton boolean true 邀请入口显示/隐藏
showMemberListButton boolean true 成员列表入口显示/隐藏
showChatButton boolean true 聊天入口显示/隐藏
showHeaderMeetingStatus boolean true 会议状态显示/隐藏
showHeaderMeetingNumber boolean true 会议信息显示/隐藏
showLayoutTypeButton boolean true 布局切换按钮显示/隐藏
showFullscreenButton boolean true 切换全屏显示/隐藏
fixedMeetingHeader boolean true 顶部栏固定显示/10s 无操作时隐藏
fixedMeetingControlBar boolean true 底部栏固定显示/10s 无操作时隐藏
showInterpretationButton boolean true 同声传译按钮显示/隐藏
showQaButton boolean true 问答按钮显示/隐藏
showVoteButton boolean true 投票按钮显示/隐藏
showLiveCaptionButton boolean true 语音转写按钮显示/隐藏
ComponentCustom

名称 类型 是否必须 默认值 描述
moveable boolean true 是否可移动
mainWindowOptions MainWindowOptions - 主窗口位置大小配置
MainWindowOptions

名称 类型 是否必须 默认值 描述
width number 1024 窗口宽度,取值范围(520 - 1920)
height number 672 窗口高度,取值范围(320 - 1080)
top number 20 窗口与 body 上边界之间的偏移
left number 20 窗口与 body 左边界之间的偏移
I18n

名称 类型 是否必须 描述
zh I18nCustom 国际化中文
I18nCustom

名称 类型 是否必须 默认值 描述
join.title string 加入会议 预览页面标题(最大长度:10)
join.button.text string 立即加入 预览页面入会按钮文本(最大长度:10)
MeetingConfig

名称 类型 是否必须 默认值 描述
disableAutoCloseVideoWhenBusy boolean false 系统负载较高时,禁用自动关闭摄像头
reduceVideoResolution boolean false 降低视频订阅分辨率
turnOffVideoOnShare boolean true 共享视频时是否关闭摄像头

MediaDeviceInfo
名称 类型 描述
deviceId string 设备 ID
groupId string 设备组 ID
kind string 设备类型
label string 设备名称
返回数据

Promise

本页目录