UNPKG

@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,

63 lines (62 loc) 2.33 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const Vue = require("vue"); const index$1 = require("../../../components/common/base/Select/index.js"); const index$2 = require("../../../components/common/base/Option/index.js"); const index = require("../../hooks/useAudioDeviceState/index.js"); const _sfc_main = /* @__PURE__ */ Vue.defineComponent({ __name: "MicrophoneSelect", props: { onChange: {}, disabled: { type: Boolean, default: false } }, setup(__props) { const { microphoneList, currentMicrophoneId, microphone } = index.useAudioDeviceState(); const props = __props; const currentDeviceId = Vue.ref(currentMicrophoneId.value); Vue.watch( currentMicrophoneId, (val) => { if (currentDeviceId.value !== val) { currentDeviceId.value = val; } }, { immediate: true } ); async function handleChange(deviceId) { var _a; (_a = props.onChange) == null ? void 0 : _a.call(props, deviceId); try { await microphone.setCurrentDevice({ deviceId }); } catch (error) { if (microphoneList.value.map((item) => item.deviceId).includes(currentMicrophoneId.value)) { currentDeviceId.value = currentMicrophoneId.value; } } } return (_ctx, _cache) => { return Vue.openBlock(), Vue.createBlock(Vue.unref(index$1.default), { modelValue: currentDeviceId.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => currentDeviceId.value = $event), placeholder: "placeholder", class: "select", disabled: _ctx.disabled, teleported: false, "popper-append-to-body": false, onChange: handleChange }, { default: Vue.withCtx(() => [ (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(microphoneList), (item) => { return Vue.openBlock(), Vue.createBlock(Vue.unref(index$2.default), { key: item.deviceId, label: item.deviceName, value: item.deviceId }, null, 8, ["label", "value"]); }), 128)) ]), _: 1 }, 8, ["modelValue", "disabled"]); }; } }); exports.default = _sfc_main;