@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,
107 lines (106 loc) • 4.67 kB
JavaScript
import { defineComponent, computed, createElementBlock, openBlock, normalizeClass, createCommentVNode, createElementVNode, createVNode, createBlock, unref, toDisplayString } from "vue";
import { useRoomStore } from "../../../../stores/room.mjs";
import TuiAvatar from "../../../common/Avatar.vue.mjs";
import AudioIcon from "../../../common/AudioIcon.vue.mjs";
import SvgIcon from "../../../common/base/SvgIcon.vue.mjs";
import UserIcon from "../../../common/icons/UserIcon.vue.mjs";
import { useI18n } from "../../../../locales/index.mjs";
import { TUIVideoStreamType, TUIRole } from "@tencentcloud/tuiroom-engine-electron";
import ScreenOpenIcon from "../../../common/icons/ScreenOpenIcon.vue.mjs";
import { isPC, isMobile } from "../../../../utils/environment.mjs";
import { storeToRefs } from "pinia";
import LoadingIcon from "../../../common/icons/LoadingIcon.vue.mjs";
const _hoisted_1 = {
key: 0,
class: "loading-region"
};
const _hoisted_2 = {
key: 1,
class: "center-user-info-container"
};
const _hoisted_3 = { class: "corner-user-info-container" };
const _hoisted_4 = ["title"];
const _hoisted_5 = { key: 3 };
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "index",
props: {
streamInfo: {},
enlargeDomId: {},
changeLargeStream: { type: Boolean }
},
setup(__props) {
const roomStore = useRoomStore();
const { t } = useI18n();
const props = __props;
const { userVolumeObj } = storeToRefs(roomStore);
const userInfo = computed(() => roomStore.userInfoObj[props.streamInfo.userId]);
const displayName = computed(() => {
return roomStore.getDisplayName(props.streamInfo.userId);
});
const showMasterIcon = computed(() => {
const { userId, streamType } = props.streamInfo;
return userId === roomStore.masterUserId && streamType === TUIVideoStreamType.kCameraStream;
});
const showAdminIcon = computed(() => {
const { userId, streamType } = props.streamInfo;
return roomStore.getUserRole(userId) === TUIRole.kAdministrator && streamType === TUIVideoStreamType.kCameraStream;
});
const showVoiceBorder = computed(() => {
if (isPC) {
return false;
}
return props.streamInfo.hasAudioStream && userVolumeObj.value[props.streamInfo.userId] !== 0;
});
const showIcon = computed(() => showMasterIcon.value || showAdminIcon.value);
const isScreenStream = computed(
() => props.streamInfo.streamType === TUIVideoStreamType.kScreenStream
);
return (_ctx, _cache) => {
var _a;
return openBlock(), createElementBlock("div", {
class: normalizeClass(["stream-cover-container", [showVoiceBorder.value ? "border" : ""]])
}, [
_ctx.streamInfo.isLoading ? (openBlock(), createElementBlock("div", _hoisted_1, [
createVNode(SvgIcon, {
icon: LoadingIcon,
class: "loading"
})
])) : createCommentVNode("", true),
!_ctx.streamInfo.hasVideoStream ? (openBlock(), createElementBlock("div", _hoisted_2, [
createVNode(TuiAvatar, {
class: "avatar-region",
"img-src": (_a = userInfo.value) == null ? void 0 : _a.avatarUrl
}, null, 8, ["img-src"])
])) : createCommentVNode("", true),
createElementVNode("div", _hoisted_3, [
showIcon.value ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(showMasterIcon.value ? "master-icon" : "admin-icon")
}, [
createVNode(UserIcon)
], 2)) : createCommentVNode("", true),
!isScreenStream.value ? (openBlock(), createBlock(AudioIcon, {
key: 1,
class: normalizeClass(["audio-icon", { "is-mobile": unref(isMobile) }]),
"user-id": _ctx.streamInfo.userId,
"is-muted": !_ctx.streamInfo.hasAudioStream,
size: "small"
}, null, 8, ["class", "user-id", "is-muted"])) : createCommentVNode("", true),
isScreenStream.value ? (openBlock(), createBlock(SvgIcon, {
key: 2,
icon: ScreenOpenIcon,
class: "screen-icon"
})) : createCommentVNode("", true),
createElementVNode("span", {
class: normalizeClass(["user-name", unref(isPC) ? "is-pc" : "is-mobile"]),
title: displayName.value
}, toDisplayString(displayName.value), 11, _hoisted_4),
isScreenStream.value ? (openBlock(), createElementBlock("span", _hoisted_5, toDisplayString(unref(t)("is sharing their screen")), 1)) : createCommentVNode("", true)
])
], 2);
};
}
});
export {
_sfc_main as default
};