
SDKAppID for billing and analytics.iframe.npm create vite@latest roomkit-vue3 -- --template vue
pnpm create vite roomkit-vue3 --template vue
yarn create vite roomkit-vue3 --template vue
cd roomkit-vue3/npm install @tencentcloud/roomkit-web-vue3@latest tuikit-atomicx-vue3 @tencentcloud/uikit-base-component-vue3 @tencentcloud/universal-api
cd roomkit-vue3/pnpm install @tencentcloud/roomkit-web-vue3@latest tuikit-atomicx-vue3 @tencentcloud/uikit-base-component-vue3 @tencentcloud/universal-api
cd roomkit-vue3/yarn add @tencentcloud/roomkit-web-vue3@latest tuikit-atomicx-vue3 @tencentcloud/uikit-base-component-vue3 @tencentcloud/universal-api
roomkit-vue3/src/App.vue file.<template><UIKitProvider theme="light" language="zh-CN"><ConferenceMainView v-if="isPC"></ConferenceMainView><ConferenceMainViewH5 v-else></ConferenceMainViewH5></UIKitProvider></template><script setup>import { ref, onMounted } from 'vue';import { UIKitProvider } from '@tencentcloud/uikit-base-component-vue3';import { ConferenceMainView, ConferenceMainViewH5, conference } from '@tencentcloud/roomkit-web-vue3';import { getPlatform } from '@tencentcloud/universal-api';import { RoomType } from 'tuikit-atomicx-vue3/room';const isPC = ref(getPlatform() === 'pc');function getUrlParam(key) {const params = new URLSearchParams(window.location.search);return params.get(key) || '';}const sdkAppId = Number(getUrlParam('sdkAppId'));const userId = getUrlParam('userId');const userSig = getUrlParam('userSig');const roomId = getUrlParam('roomId');const action = getUrlParam('action') || 'start';onMounted(async () => {try {await conference.login({ sdkAppId, userId, userSig });if (action === 'start') {await conference.start({ roomId, roomType: RoomType.Standard });} else {await conference.join({ roomId, roomType: RoomType.Standard });}} catch (error) {console.error('Initialization failed:', error);}});</script><style>html, body {padding: 0 !important;margin: 0 !important;}#app {width: 100% !important;height: 100% !important;padding: 0 !important;margin: 0 !important;max-width: 100% !important;max-height: 100% !important;text-align: left !important;overflow: hidden;}</style>
cd roomkit-vue3/npm run build
dist directory) to your web server (such as Nginx, COS, etc.) to obtain the access URL.allow attribute, or the browser will block access to camera, microphone, and screen sharing.start to create a room, join to join a room.<iframeid="tuiRoomFrame"src="https://your-domain.com/index.html?sdkAppId=xxxx&userId=xxxx&userSig=xxxx&roomId=xxxx&action=start"allow="microphone; camera; fullscreen; display-capture;"width="100%"height="100%"style="border: none; min-height: 600px;"></iframe>
postMessage API to send messages between the iframe and the parent.// Send events from the TUIRoomKit integration projectimport { useRoomState, RoomEvent } from 'tuikit-atomicx-vue3/room';const { subscribeEvent } = useRoomState();subscribeEvent(RoomEvent.onRoomEnded, () => {window.parent.postMessage({ event: 'onRoomEnded', data: {} }, '*');});// Receive events in your parent pagewindow.addEventListener('message', (event) => {if (event.data.event === 'onRoomEnded') {console.log('The room has been dissolved');}});
Check Item | Verification Criteria |
Page Load | The TUIRoomKit meeting interface displays correctly in the iframe. |
Audio/Video Permissions | Click "Unmute" or "Turn on Video" in the meeting interface and confirm the status icon updates as expected. |
Screen Sharing | Click screen sharing and confirm the system-level sharing window appears. |
iframe URL use https://.allow="microphone; camera; fullscreen; display-capture;".// Set internal network proxy parameters before entering the roomimport TUIRoomEngine from '@tencentcloud/tuiroom-engine-js';import { useRoomEngine } from 'tuikit-atomicx-vue3/room';const { roomEngine } = useRoomEngine();TUIRoomEngine.once('ready', () => {const trtcCloud = roomEngine.instance?.getTRTCCloud();trtcCloud.callExperimentalAPI(JSON.stringify({api: 'setNetworkProxy',params: {websocketProxy: "wss://proxy.example.com/ws/",turnServer: [{url: '14.3.3.3:3478',username: 'turn',credential: 'turn',}],iceTransportPolicy: 'relay',},}));});
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan