|
@@ -25,7 +25,7 @@ import state, { clearSelection, handleStopPlay, resetPlaybackToStart, togglePlay
|
|
|
import { IPostMessage } from "/src/utils/native-message";
|
|
|
import { usePageVisibility } from "@vant/use";
|
|
|
import { browser } from "/src/utils";
|
|
|
-import { toggleMutePlayAudio } from "../audio-list";
|
|
|
+import { getAudioCurrentTime, toggleMutePlayAudio } from "../audio-list";
|
|
|
|
|
|
const browserInfo = browser();
|
|
|
export const evaluatingData = reactive({
|
|
@@ -67,15 +67,32 @@ export const handleStartEvaluat = () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+const check_currentTime = () => {
|
|
|
+ let preTime = 0
|
|
|
+ // 选段评测模式
|
|
|
+ if (state.isSelectMeasureMode) {
|
|
|
+ preTime = state.section[0].time * 1000;
|
|
|
+ }
|
|
|
+ const currentTime = getAudioCurrentTime() * 1000 - preTime
|
|
|
+
|
|
|
+ if (currentTime >= 500){
|
|
|
+ sendEvaluatingOffsetTime(500)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ check_currentTime()
|
|
|
+ }, 10)
|
|
|
+}
|
|
|
+
|
|
|
/** 开始播放发送延迟时间 */
|
|
|
export const sendEvaluatingOffsetTime = async (currentTime: number) => {
|
|
|
console.log("🚀 ~ currentTime:", currentTime)
|
|
|
// 没有开始时间点, 不处理
|
|
|
if (!evaluatingData.backtime) return;
|
|
|
const nowTime = Date.now();
|
|
|
- const delayTime = nowTime - evaluatingData.backtime
|
|
|
+ const delayTime = nowTime - evaluatingData.backtime - currentTime
|
|
|
evaluatingData.backtime = 0
|
|
|
- console.log("真正播放延迟", delayTime);
|
|
|
+ console.log("真正播放延迟", delayTime, 'currentTime:', currentTime);
|
|
|
await api_proxyServiceMessage({
|
|
|
header: {
|
|
|
commond: "audioPlayStart",
|
|
@@ -217,6 +234,8 @@ const playMusic = async () => {
|
|
|
// toggleMutePlayAudio(state.playSource, false)
|
|
|
return;
|
|
|
}
|
|
|
+ // 检测播放进度, 计算延迟
|
|
|
+ check_currentTime()
|
|
|
// 如果开启了摄像头, 开启录制视频
|
|
|
if (state.setting.camera && state.setting.saveToAlbum){
|
|
|
console.log('开始录制视频')
|
|
@@ -232,7 +251,7 @@ const recordStartTimePoint = async (res?: IPostMessage) => {
|
|
|
if (browserInfo.ios) {
|
|
|
inteveral *= 1000;
|
|
|
}
|
|
|
- console.log("🚀 ~ 开始时间点:", inteveral)
|
|
|
+ console.log("🚀 ~ 开始时间点:", inteveral, '已经录的时间:', Date.now() - inteveral)
|
|
|
evaluatingData.backtime = inteveral || Date.now();
|
|
|
// toggleMutePlayAudio(state.playSource, false)
|
|
|
// resetPlaybackToStart();
|