@tencentcloud/roomkit-electron-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,
80 lines (79 loc) • 2.93 kB
JavaScript
import { defineComponent, ref, createElementBlock, openBlock, withDirectives, createVNode, unref, withCtx, vShow } from "vue";
import IconButton from "./base/IconButton.vue.mjs";
import MessageBox from "./base/MessageBox/index.mjs";
import AudioSettingTab from "./AudioSettingTab.vue.mjs";
import AudioIcon from "./AudioIcon.vue.mjs";
import { useI18n } from "../../locales/index.mjs";
import vClickOutside from "../../directives/vClickOutside.mjs";
import { isGetUserMediaSupported, isEnumerateDevicesSupported } from "../../utils/mediaAbility.mjs";
const _hoisted_1 = { class: "audio-control-container" };
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "AudioMediaControl",
props: {
hasMore: { type: Boolean, default: true },
isMuted: { type: Boolean },
isDisabled: { type: Boolean, default: false },
audioVolume: { default: 0 }
},
emits: ["click"],
setup(__props, { emit: __emit }) {
const emits = __emit;
const showAudioSettingTab = ref(false);
const isSupportAudioMedia = isGetUserMediaSupported && isEnumerateDevicesSupported;
const { t } = useI18n();
async function handleClickIcon() {
if (!isSupportAudioMedia) {
MessageBox({
title: t("Note"),
message: t("The current browser does not support capturing audio"),
confirmButtonText: t("Sure")
});
return;
}
emits("click");
showAudioSettingTab.value = false;
}
function handleMore() {
showAudioSettingTab.value = !showAudioSettingTab.value;
}
function handleHideAudioSettingTab() {
if (showAudioSettingTab.value) {
showAudioSettingTab.value = false;
}
}
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", null, [
withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [
createVNode(IconButton, {
title: unref(t)("Mic"),
"has-more": _ctx.hasMore,
disabled: _ctx.isDisabled,
"is-not-support": !unref(isSupportAudioMedia),
onClickIcon: handleClickIcon,
onClickMore: handleMore
}, {
default: withCtx(() => [
createVNode(AudioIcon, {
"audio-volume": _ctx.audioVolume,
"is-muted": _ctx.isMuted,
"is-disabled": _ctx.isDisabled
}, null, 8, ["audio-volume", "is-muted", "is-disabled"])
]),
_: 1
}, 8, ["title", "has-more", "disabled", "is-not-support"]),
withDirectives(createVNode(AudioSettingTab, {
class: "audio-tab",
"audio-volume": _ctx.audioVolume
}, null, 8, ["audio-volume"]), [
[vShow, showAudioSettingTab.value]
])
])), [
[unref(vClickOutside), handleHideAudioSettingTab]
])
]);
};
}
});
export {
_sfc_main as default
};