@unified-communications/meeting-sdk-vue2
v0.1.0
Published
Vue 2 adapter for the Unified Communications meeting SDK
Readme
@unified-communications/meeting-sdk-vue2
Vue2 大屏通过统一用户中心登录、换取平台 Session、查询通讯录和接收会议邀请的完整流程见 docs/guides/USER_CENTER_CLIENT_INTEGRATION.md。
这是 @unified-communications/meeting-sdk 的 Vue 2 适配包。业务项目仍使用 Vue 2.7 组件写法,会议内部运行时由适配包私有加载 Vue 3 MeetingRoom,因此不会把 Vue 3 组件 API 暴露给 Vue 2 页面,也不需要在业务页面中使用 iframe。
安装
npm install @unified-communications/meeting-sdk-vue2 vue@^2.7.0vue 是宿主项目的 peer dependency。适配包会内置会议 SDK 运行时;发布时必须保留 dist/index.js、dist/style.css 和 dist/assets/。
该包发布在公共 npmjs(npmmirror 同步同一版本),安装后直接注册组件即可,不需要在业务项目里重新构建。
Vue 2 组件
import Vue from 'vue';
import {
createMeetingInvitationDialogComponent,
createMeetingRoomComponent
} from '@unified-communications/meeting-sdk-vue2';
import '@unified-communications/meeting-sdk-vue2/style.css';
Vue.component('MeetingRoom', createMeetingRoomComponent(Vue) as any);
Vue.component('MeetingInvitationDialog', createMeetingInvitationDialogComponent(Vue) as any);<MeetingRoom
ref="meetingRoom"
:base-url="platformUrl"
:session="meetingSession"
:auto-start="true"
:toolbar-controls="toolbarControls"
:workspace-panels="workspacePanels"
:auto-enable-transcription="false"
:auto-enable-summary="false"
@joined="handleJoined"
@left="handleLeft"
@ended="handleEnded"
@error="handleError"
/>meetingSession 应由业务服务端签发短期会话。生产环境不要把 App ID、Share Key 或服务端凭证放入浏览器代码。
autoStart=true 表示取得 meetingSession 后直接入会,不再要求用户点击组件内的“加入会议”。如果业务需要先展示设备确认或其他会前页面,省略该属性并在确认后调用组件实例的 start()。
运行时控制
组件实例提供与 Vue 3 SDK 相同的控制方法:
const room = this.$refs.meetingRoom as {
start(): Promise<void>;
leave(): Promise<void>;
endMeeting(): Promise<void>;
setTranscriptionEnabled(enabled: boolean): Promise<void>;
setSummaryEnabled(enabled: boolean): Promise<void>;
};
await room.setTranscriptionEnabled(true);
await room.setSummaryEnabled(false);toolbarControls、workspacePanels、onInvite、onEndMeeting、showPlatformDeviceTree 等配置与 Vue 3 SDK 的 MeetingRoom 保持一致。地址拉流、业务设备树、邀请和用户体系仍由业务方通过 SDK API 或回调接入;平台用户 API 还提供会议详情、邀请响应和通知读取/已读方法。
会中邀请可监听 MeetingRoom 的 invite 事件并打开 MeetingInvitationDialog。该组件复用平台端的统一邀请界面,支持受密码保护的临时分享链接、通讯录分页搜索、批量邀请、已邀请成员状态和重新邀请;宿主通过 operations 绑定自己的平台地址和认证方式。onInvite prop 与 invite 事件均可用,适配器不会再用事件转发覆盖业务传入的回调。
会议邀请通知的视觉和交互不由 MeetingRoom 固定。大屏宿主可使用 createMeetingSdkPlatformUserApi().listNotifications(...) 获取 MeetingSdkNotification,自行实现弹窗、角标、声音或全屏提示;接受后调用 respondInvitation、markNotificationRead、getMeeting 和 toMeetingSdkSession,再把生成的会话传给开启 autoStart 的会议组件。
构建和发布
源码联调时先构建 Vue 3 SDK,再构建适配包:
cd packages/meeting-sdk-vue2
npm install
npm run typecheck
npm run build
npm pack --dry-run发布到私服:
npm publish --registry https://<registry-host>/repository/npm-hosted/版本号必须在目标仓库中唯一。prepack 会重新生成完整产物;不要只上传入口 JS,dist/assets/ 中的媒体效果 Worker、背景和模型/WASM 文件也必须一起发布。
