UNPKG

@tencentcloud/roomkit-web-vue3

Version:

<h1 align="center"> TUIRoomKit</h1> Conference (TUIRoomKit) is a product suitable for multi-person audio and video conversation scenarios such as business meetings, webinars, and online education. By integrating this product, you can add room management,

51 lines (50 loc) 2.09 kB
import { defineComponent, ref, computed, onMounted, onUnmounted, createElementBlock, createCommentVNode, openBlock, Fragment, renderList, toDisplayString, unref } from "vue"; import "../../../../services/main.mjs"; import { roomService } from "../../../../services/roomService.mjs"; import "../../../../locales/index.mjs"; import "@tencentcloud/tuiroom-engine-js"; import "../../../../utils/environment.mjs"; import "mitt"; import "../../../../services/manager/roomActionManager.mjs"; import "@tencentcloud/tui-core"; import { MetricsKey } from "../../../../services/manager/dataReportManager.mjs"; import { AI_TASK } from "../../../../services/function/aiTask.mjs"; const _hoisted_1 = { key: 0, class: "ai-subtitles" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "AISubtitles", setup(__props) { const subtitleMessages = ref({}); const subtitleLines = computed(() => { const arr = Object.keys(subtitleMessages.value).map((userId) => { return subtitleMessages.value[userId]; }); return arr.sort((a, b) => a.startMsTs - b.startMsTs); }); const handleAISubtitles = (data) => { if (!data) return; subtitleMessages.value = Object.assign({}, data.subtitleMessages); }; onMounted(() => { roomService.dataReportManager.reportCount(MetricsKey.aiTask); roomService.aiTask.on(AI_TASK.TRANSCRIPTION_TASK, handleAISubtitles); }); onUnmounted(() => { roomService.aiTask.off(AI_TASK.TRANSCRIPTION_TASK, handleAISubtitles); }); return (_ctx, _cache) => { return subtitleLines.value.length ? (openBlock(), createElementBlock("div", _hoisted_1, [ (openBlock(true), createElementBlock(Fragment, null, renderList(subtitleLines.value, (line) => { return openBlock(), createElementBlock("div", { key: line.sender }, toDisplayString(`${unref(roomService).roomStore.getDisplayName(line.sender)}: ${line == null ? void 0 : line.text}`), 1); }), 128)) ])) : createCommentVNode("", true); }; } }); export { _sfc_main as default };