@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,
54 lines (53 loc) • 1.46 kB
JavaScript
import { useI18n } from "../locales/index.mjs";
import MessageBox from "../components/common/base/MessageBox/index.mjs";
import { ref, onBeforeMount } from "vue";
import { isGetUserMediaSupported, isEnumerateDevicesSupported } from "../utils/mediaAbility.mjs";
import RTCDetect from "rtc-detect";
const isSupportTRTC = ref(true);
const detect = new RTCDetect();
detect.isTRTCSupported().then((res) => {
isSupportTRTC.value = !!(res == null ? void 0 : res.result);
});
function useTRTCDetect() {
const { t } = useI18n();
async function rtcDetect() {
if (!isGetUserMediaSupported) {
MessageBox({
title: t("Note"),
message: t(
"The current browser does not support capturing audio and video"
),
confirmButtonText: t("Sure")
});
return;
}
if (!isEnumerateDevicesSupported) {
MessageBox({
title: t("Note"),
message: t(
"The current browser does not support getting microphone and camera list"
),
confirmButtonText: t("Sure")
});
return;
}
if (!isSupportTRTC.value) {
MessageBox({
title: t("Note"),
message: t(
"The current browser does not support audio and video communication capabilities"
),
confirmButtonText: t("Sure")
});
}
}
onBeforeMount(() => {
rtcDetect();
});
return {
isSupportTRTC
};
}
export {
useTRTCDetect as default
};