|
@@ -3,7 +3,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { defineEmits, computed,ref } from "vue";
|
|
|
+import { defineEmits, computed, ref } from "vue";
|
|
|
import TRTC from "trtc-js-sdk";
|
|
|
import { useStore } from "vuex";
|
|
|
import { Dialog } from "@/global_components/";
|
|
@@ -15,7 +15,7 @@ const videoDeviceId = computed(() => store.getters["rtc/videoDeviceId"]);
|
|
|
const audioDeviceId = computed(() => store.getters["rtc/audioDeviceId"]);
|
|
|
const role = ref(browser.getURLParam("role"));
|
|
|
|
|
|
-const emit = defineEmits(["switchDevice","canUseDevice"]);
|
|
|
+const emit = defineEmits(["switchDevice", "canUseDevice"]);
|
|
|
|
|
|
const updateDevice = async () => {
|
|
|
console.log("updateDevice");
|
|
@@ -42,8 +42,14 @@ const updateDevice = async () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+let quxian = { audio: true };
|
|
|
+
|
|
|
+if (role.value == "leader") {
|
|
|
+ quxian["video"] == true;
|
|
|
+}
|
|
|
+
|
|
|
navigator.mediaDevices
|
|
|
- .getUserMedia({ audio: true, video: role.value == "customer" })
|
|
|
+ .getUserMedia(quxian)
|
|
|
.then((stream) => {
|
|
|
stream.getTracks().forEach((track) => {
|
|
|
track.stop();
|
|
@@ -52,8 +58,8 @@ navigator.mediaDevices
|
|
|
emit("canUseDevice", true);
|
|
|
})
|
|
|
.catch((error) => {
|
|
|
- console.log(error,'error');
|
|
|
- Dialog.toast({ content: `请授权您的麦克风${role.value == "leader"?'和摄像头':''}权限`, type: "error" });
|
|
|
+ console.log(error, "error");
|
|
|
+ Dialog.toast({ content: `请授权您的麦克风${role.value == "leader" ? "和摄像头" : ""}权限`, type: "error" });
|
|
|
});
|
|
|
|
|
|
navigator.mediaDevices.ondevicechange = updateDevice;
|