@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,
61 lines (60 loc) • 1.98 kB
JavaScript
import { defineComponent, computed, createElementBlock, openBlock, normalizeClass, createElementVNode, createBlock, normalizeStyle, unref } from "vue";
import { IconMicOff, IconMicOn } from "@tencentcloud/uikit-base-component-vue3";
import { useRoomStore } from "../../stores/room.mjs";
import { storeToRefs } from "pinia";
import { isUndefined } from "../../utils/utils.mjs";
const _hoisted_1 = { class: "audio-level-container" };
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;
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)
]),
props.isMuted ? (openBlock(), createBlock(unref(IconMicOff), {
key: 0,
class: "audio-icon",
size: "24"
})) : (openBlock(), createBlock(unref(IconMicOn), {
key: 1,
class: "audio-icon",
size: "24"
}))
], 2);
};
}
});
export {
_sfc_main as default
};