@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,
79 lines (78 loc) • 2.95 kB
JavaScript
import { defineComponent, ref, computed, createElementBlock, openBlock, withDirectives, createVNode, unref, withCtx, vShow } from "vue";
import IconButton from "./base/IconButton.vue.mjs";
import MessageBox from "./base/MessageBox/index.mjs";
import SvgIcon from "./base/SvgIcon.vue.mjs";
import CameraOnIcon from "./icons/CameraOnIcon.vue.mjs";
import CameraOffIcon from "./icons/CameraOffIcon.vue.mjs";
import VideoSettingTab from "./VideoSettingTab.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: "video-control-container" };
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "VideoMediaControl",
props: {
hasMore: { type: Boolean, default: true },
isMuted: { type: Boolean, default: void 0 },
isDisabled: { type: Boolean, default: false }
},
emits: ["click"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
const { t } = useI18n();
const showVideoSettingTab = ref(false);
const isSupportVideoMedia = isGetUserMediaSupported && isEnumerateDevicesSupported;
const icon = computed(() => props.isMuted ? CameraOffIcon : CameraOnIcon);
async function handleClickIcon() {
if (!isSupportVideoMedia) {
MessageBox({
title: t("Note"),
message: t("The current browser does not support capturing video"),
confirmButtonText: t("Sure")
});
return;
}
emits("click");
showVideoSettingTab.value = false;
}
function handleMore() {
showVideoSettingTab.value = !showVideoSettingTab.value;
}
function handleHideVideoSettingTab() {
if (showVideoSettingTab.value) {
showVideoSettingTab.value = false;
}
}
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", null, [
withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [
createVNode(IconButton, {
title: unref(t)("Camera"),
"has-more": _ctx.hasMore,
disabled: _ctx.isDisabled,
"is-not-support": !unref(isSupportVideoMedia),
onClickIcon: handleClickIcon,
onClickMore: handleMore
}, {
default: withCtx(() => [
createVNode(SvgIcon, { icon: icon.value }, null, 8, ["icon"])
]),
_: 1
}, 8, ["title", "has-more", "disabled", "is-not-support"]),
withDirectives(createVNode(VideoSettingTab, {
class: "video-tab",
"with-mirror": true
}, null, 512), [
[vShow, showVideoSettingTab.value]
])
])), [
[unref(vClickOutside), handleHideVideoSettingTab]
])
]);
};
}
});
export {
_sfc_main as default
};