@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,
114 lines (113 loc) • 4.96 kB
JavaScript
import { defineComponent, watch, onMounted, onUnmounted, createElementBlock, openBlock, createElementVNode, createCommentVNode, createVNode, toDisplayString, unref, isRef, pushScopeId, popScopeId } from "vue";
import DeviceSelect from "./DeviceSelect.vue.mjs";
import VideoProfile from "./VideoProfile.vue.mjs";
import TuiSwitch from "./base/TuiSwitch.vue.mjs";
import { useBasicStore } from "../../stores/basic.mjs";
import { useI18n } from "../../locales/index.mjs";
import useGetRoomEngine from "../../hooks/useRoomEngine.mjs";
import { TRTCVideoFillMode, TRTCVideoRotation, TRTCVideoMirrorType } from "@tencentcloud/tuiroom-engine-electron";
import { isMobile, isElectron } from "../../utils/environment.mjs";
import { storeToRefs } from "pinia";
const _withScopeId = (n) => (pushScopeId("data-v-58833df9"), n = n(), popScopeId(), n);
const _hoisted_1 = { class: "video-tab" };
const _hoisted_2 = { class: "item-setting" };
const _hoisted_3 = { class: "title" };
const _hoisted_4 = {
key: 0,
class: "item-setting"
};
const _hoisted_5 = { class: "title" };
const _hoisted_6 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "video-preview-container" }, [
/* @__PURE__ */ createElementVNode("div", {
id: "test-camera-preview",
class: "video-preview"
})
], -1));
const _hoisted_7 = { class: "item-setting" };
const _hoisted_8 = { class: "title" };
const _hoisted_9 = { class: "mirror-container" };
const _hoisted_10 = {
key: 1,
class: "item-setting"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "VideoSettingTab",
props: {
withPreview: { type: Boolean },
withMore: { type: Boolean },
withMirror: { type: Boolean },
theme: {}
},
setup(__props) {
const roomEngine = useGetRoomEngine();
const props = __props;
const basicStore = useBasicStore();
const { isLocalStreamMirror } = storeToRefs(basicStore);
watch(isLocalStreamMirror, async (val) => {
var _a;
const trtcCloud = (_a = roomEngine.instance) == null ? void 0 : _a.getTRTCCloud();
if (!isMobile) {
await (trtcCloud == null ? void 0 : trtcCloud.setLocalRenderParams({
mirrorType: val ? TRTCVideoMirrorType.TRTCVideoMirrorType_Enable : TRTCVideoMirrorType.TRTCVideoMirrorType_Disable,
rotation: TRTCVideoRotation.TRTCVideoRotation0,
fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fill
}));
}
});
const { t } = useI18n();
function handleMoreCameraSetting() {
basicStore.setShowSettingDialog(true);
basicStore.setActiveSettingTab("video");
}
if (props.withPreview) {
onMounted(async () => {
var _a, _b;
(_a = roomEngine.instance) == null ? void 0 : _a.startCameraDeviceTest({ view: "test-camera-preview" });
if (isElectron) {
const trtcCloud = (_b = roomEngine.instance) == null ? void 0 : _b.getTRTCCloud();
await (trtcCloud == null ? void 0 : trtcCloud.setLocalRenderParams({
mirrorType: isLocalStreamMirror.value ? TRTCVideoMirrorType.TRTCVideoMirrorType_Enable : TRTCVideoMirrorType.TRTCVideoMirrorType_Disable,
rotation: TRTCVideoRotation.TRTCVideoRotation0,
fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fill
}));
}
});
onUnmounted(() => {
var _a;
(_a = roomEngine.instance) == null ? void 0 : _a.stopCameraDeviceTest();
});
}
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1, [
createElementVNode("div", _hoisted_2, [
createElementVNode("span", _hoisted_3, toDisplayString(unref(t)("Camera")), 1),
createVNode(DeviceSelect, { "device-type": "camera" })
]),
_ctx.withPreview ? (openBlock(), createElementBlock("div", _hoisted_4, [
createElementVNode("span", _hoisted_5, toDisplayString(unref(t)("Preview")), 1),
_hoisted_6
])) : createCommentVNode("", true),
createElementVNode("div", _hoisted_7, [
createElementVNode("span", _hoisted_8, toDisplayString(unref(t)("Resolution")), 1),
createVNode(VideoProfile)
]),
createElementVNode("div", _hoisted_9, [
createElementVNode("span", null, toDisplayString(unref(t)("Mirror")), 1),
createVNode(TuiSwitch, {
modelValue: unref(isLocalStreamMirror),
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(isLocalStreamMirror) ? isLocalStreamMirror.value = $event : null)
}, null, 8, ["modelValue"])
]),
_ctx.withMore ? (openBlock(), createElementBlock("div", _hoisted_10, [
createElementVNode("div", {
class: "item",
onClick: handleMoreCameraSetting
}, toDisplayString(unref(t)("More Camera Settings")), 1)
])) : createCommentVNode("", true)
]);
};
}
});
export {
_sfc_main as default
};