UNPKG

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,

74 lines (73 loc) 2.54 kB
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, createVNode, withCtx, createCommentVNode } from "vue"; import _imports_0 from "../../assets/imgs/room_mic_on.png.mjs"; import _imports_1 from "../../assets/imgs/room_mic_off.png.mjs"; import SvgIcon from "./base/SvgIcon.vue.mjs"; import { useRoomStore } from "../../stores/room.mjs"; import { storeToRefs } from "pinia"; import { isUndefined } from "../../utils/utils.mjs"; import MicOnIcon from "./icons/MicOnIcon.vue.mjs"; import MicOffIcon from "./icons/MicOffIcon.vue.mjs"; const _hoisted_1 = { class: "audio-level-container" }; const _hoisted_2 = { key: 0, src: _imports_0, style: { "width": "24px", "height": "24px" } }; const _hoisted_3 = { key: 1, src: _imports_1, style: { "width": "24px", "height": "24px" } }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "AudioIcon", props: { userId: {}, audioVolume: {}, isMuted: { type: Boolean }, size: {}, isDisabled: { type: Boolean } }, setup(__props) { const roomStore = useRoomStore(); const { userVolumeObj } = storeToRefs(roomStore); const currentAudioVolume = computed(() => { if (!isUndefined(props.audioVolume)) { return props.audioVolume; } if (userVolumeObj.value && props.userId) { return userVolumeObj.value[props.userId]; } return 0; }); const props = __props; computed(() => props.isMuted ? MicOffIcon : MicOnIcon); const audioLevelStyle = computed(() => { if (props.isMuted || !currentAudioVolume.value) { return ""; } return `height: ${currentAudioVolume.value * 4}%`; }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: normalizeClass(["audio-icon-container", `${_ctx.size == "small" && "small"}`]) }, [ createElementVNode("div", _hoisted_1, [ createElementVNode("div", { class: "audio-level", style: normalizeStyle(audioLevelStyle.value) }, null, 4) ]), createVNode(SvgIcon, { class: "audio-icon" }, { default: withCtx(() => [ !_ctx.isMuted ? (openBlock(), createElementBlock("img", _hoisted_2)) : createCommentVNode("", true), _ctx.isMuted ? (openBlock(), createElementBlock("img", _hoisted_3)) : createCommentVNode("", true) ]), _: 1 }) ], 2); }; } }); export { _sfc_main as default };