Pārlūkot izejas kodu

添加开启关闭直播

wolyshaw 3 gadi atpakaļ
vecāks
revīzija
37c43e9fb9
1 mainītis faili ar 14 papildinājumiem un 7 dzēšanām
  1. 14 7
      src/components/live-broadcast/runtime.ts

+ 14 - 7
src/components/live-broadcast/runtime.ts

@@ -392,6 +392,13 @@ export const startLive = async (resetTime = true) => {
     // await builder.setOutputVideoRenderMode?.(RTC.MixVideoRenderMode.WHOLE)
     // // @ts-ignore
     // await builder.flush()
+    await request.post('/api-web/imLiveBroadcastRoom/opsLiveVideo', {
+      data: {
+        type: '1',
+        roomUid: runtime.roomUid,
+        userId: state.user?.speakerId,
+      }
+    })
     runtime.videoStatus = 'liveing'
   }
   if (resetTime) {
@@ -405,13 +412,13 @@ export const startLive = async (resetTime = true) => {
  */
 export const closeLive = async () => {
   // removeMedia(runtime.mediaStreams, runtime.mediaStreamTrack)
-  // await request.post('/api-im/user/statusImUser', {
-  //   data: {
-  //     os: 'PC',
-  //     status: 3,
-  //     userId: state.user?.id,
-  //   }
-  // })
+  await request.post('/api-web/imLiveBroadcastRoom/opsLiveVideo', {
+    data: {
+      type: '2',
+      roomUid: runtime.roomUid,
+      userId: state.user?.speakerId,
+    }
+  })
   sessionStorage.removeItem(START_LIVE_TIME)
   sessionStorage.removeItem(START_LIVE_STATUS)
   runtime.videoStatus = 'stream'