Explorar el Código

Update runtime.ts

lex-xin hace 3 años
padre
commit
b26f0547da
Se han modificado 1 ficheros con 6 adiciones y 1 borrados
  1. 6 1
      src/components/live-broadcast/runtime.ts

+ 6 - 1
src/components/live-broadcast/runtime.ts

@@ -1,3 +1,4 @@
+import { ElMessage } from 'element-plus';
 import { reactive, ref, Ref } from 'vue'
 import * as RongIMLib from '@rongcloud/imlib-next'
 import * as RTC from '@rongcloud/plugin-rtc'
@@ -380,7 +381,11 @@ export const joinRoom = async (roomId: string, type: RTC.RCLivingType, listenEve
  */
 
 export const startLive = async (resetTime = true) => {
-  if (runtime.videoStatus !== 'stream') throw Error('当前无视频流')
+  if (runtime.videoStatus !== 'stream') {
+    const errorMessage = '请确定摄像头已经开启'
+    ElMessage.error(errorMessage)
+    throw Error(errorMessage)
+  }
   const room = runtime.joinedRoom
   if (room) {
     // const microphoneAudioTrack = await getTrack('microphone')