Explorar o código

Merge branch 'master' into online

liushengqiang hai 1 ano
pai
achega
23b06e84a0

+ 3 - 34
src/pages/detail/runtime.ts

@@ -512,12 +512,10 @@ export const play = async () => {
         songID: detailState.activeDetail.examSongId,
       },
     })
-    startCapture()
   } else {
     state.playState = state.audiosInstance.getStatus()
     clearAccelerateRefreshPlayer()
     accelerateRefreshPlayer()
-    startCapture()
   }
 }
 
@@ -701,12 +699,10 @@ const cloudToggleState = async () => {
         hertz: SettingState.sett.hertz,
       },
     })
-    startCapture()
   } else {
     await promisefiyPostMessage({
       api: 'cloudSuspend',
     })
-    endCapture()
   }
   const cloudGetMediaStatused = await promisefiyPostMessage({
     api: 'cloudGetMediaStatus',
@@ -1008,50 +1004,23 @@ export const noteClick = (evt: MouseEvent) => {
 let playStartTime: number = 0
 
 export const startCapture = async () => {
-  if (detailState.activeDetail?.isAppPlay) {
-    playStartTime = new Date().getTime()
-    console.log('startCapture', playStartTime)
-  }
-  // console.log('startCapture:',SettingState.sett.camera, browserInfo.isApp, !state.captureStatus, state.evaluatingStatus, SettingState.eva.save)
+  console.log('SettingState.sett.camera:', SettingState.sett.camera, " SettingState.eva.save:",  SettingState.eva.save)
   if (
     SettingState.sett.camera &&
-    browserInfo.isApp &&
-    !state.captureStatus &&
-    state.evaluatingStatus &&
     SettingState.eva.save
   ) {
-    state.captureStatus = true
     postMessage({
       api: 'startCapture',
-    }, () => {
-      postMessage({
-        api: 'setCaptureMode',
-        content: {
-          mode: 'evaluating',
-        },
-      })
     })
   }
 }
 
 export const endCapture = async () => {
-  if (detailState.activeDetail?.isAppPlay) {
-    const playTime = new Date().getTime() - playStartTime
-    if (playStartTime !== 0 && playTime > 0) {
-      state.audiosInstance?.event.emit('updatePlayTime', playTime / 1000)
-      playStartTime = 0
-    }
-  }
-  if (browserInfo.isApp && state.evaluatingStatus && SettingState.sett.camera && state.captureStatus) {
+  if (SettingState.eva.save && SettingState.sett.camera ) {
     postMessage(
       {
         api: 'endCapture',
-      },
-      () => {
-        state.captureStatus = false
-      }
-    )
-    evaluatPlayerStop()
+      })
   }
 }
 

+ 2 - 0
src/subpages/colexiu/buttons/evaluating.tsx

@@ -330,6 +330,7 @@ const playerStop = () => {
       // RuntimeUtils.setCaptureMode()
     }
   )
+  RuntimeUtils.endCapture()
 }
 export const evaluatPlayerStop = playerStop
 
@@ -384,6 +385,7 @@ const evaluatStart = () => {
       }
     }
   )
+  RuntimeUtils.startCapture()
 }
 
 /**

+ 3 - 5
src/subpages/colexiu/popups/evaluating/index.tsx

@@ -38,9 +38,6 @@ export default defineComponent({
   setup(props) {
     const confirmShow = ref<boolean>(false)
 
-    //
-    const isSaveVideo = SettingState.sett.camera && SettingState.eva.save
-
     const sendUploadMessage = (res?: IPostMessage) => {
       postMessage({
         api: 'proxyServiceMessage',
@@ -58,12 +55,13 @@ export default defineComponent({
       })
     }
     const videoUpdate = () => {
-      if (isSaveVideo) {
+      if (SettingState.sett.camera && SettingState.eva.save) {
         postMessage(
           {
             api: 'videoUpdate',
           },
           (res) => {
+            console.log('保存视频', res)
             confirmShow.value = false
             if (res?.content) {
               if (res.content.type === 'error') {
@@ -116,7 +114,7 @@ export default defineComponent({
               ),
             }}
             v-model:show={confirmShow.value}
-            message={`评测${isSaveVideo ? '音视频' : '音频'}是否保存演奏?`}
+            message={`评测${SettingState.sett.camera && SettingState.eva.save ? '音视频' : '音频'}是否保存演奏?`}
           />
         </div>
       )