|  | @@ -15,10 +15,15 @@ import {
 | 
	
		
			
				|  |  |  	api_openWebView,
 | 
	
		
			
				|  |  |  	api_startRecording,
 | 
	
		
			
				|  |  |  	api_stopRecording,
 | 
	
		
			
				|  |  | +	api_recordStartTime,
 | 
	
		
			
				|  |  | +	api_remove_recordStartTime,
 | 
	
		
			
				|  |  |  } from "/src/helpers/communication";
 | 
	
		
			
				|  |  |  import state, { clearSelection, handleStopPlay, resetPlaybackToStart, togglePlay } from "/src/state";
 | 
	
		
			
				|  |  |  import { IPostMessage } from "/src/utils/native-message";
 | 
	
		
			
				|  |  |  import { usePageVisibility } from "@vant/use";
 | 
	
		
			
				|  |  | +import { browser } from "/src/utils";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const browserInfo = browser();
 | 
	
		
			
				|  |  |  export const evaluatingData = reactive({
 | 
	
		
			
				|  |  |  	/** 评测数据 */
 | 
	
		
			
				|  |  |  	contentData: {} as any,
 | 
	
	
		
			
				|  | @@ -59,26 +64,20 @@ export const handleStartEvaluat = () => {
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /** 开始播放发送延迟时间 */
 | 
	
		
			
				|  |  | -export const sendEvaluatingOffsetTime = (currentTime: number) => {
 | 
	
		
			
				|  |  | +export const sendEvaluatingOffsetTime = async (currentTime: number) => {
 | 
	
		
			
				|  |  |  	const nowTime = Date.now();
 | 
	
		
			
				|  |  | -	// console.log("第一次播放时间", evaluatingData.backtime);
 | 
	
		
			
				|  |  | -	// console.log("已播放时长: ", currentTime,  currentTime * 1000);
 | 
	
		
			
				|  |  | -	// console.log("不减掉已播放时间: ", nowTime - evaluatingData.backtime , currentTime);
 | 
	
		
			
				|  |  | -	const delayTime = (nowTime - evaluatingData.backtime - currentTime * 1000) / 1000;
 | 
	
		
			
				|  |  | -	console.log("真正播放延迟", delayTime / 1000);
 | 
	
		
			
				|  |  | -	// 蓝牙耳机延迟一点发送消息确保在录音后面
 | 
	
		
			
				|  |  | -	setTimeout(async () => {
 | 
	
		
			
				|  |  | -		await api_proxyServiceMessage({
 | 
	
		
			
				|  |  | -			header: {
 | 
	
		
			
				|  |  | -				commond: "audioPlayStart",
 | 
	
		
			
				|  |  | -				type: "SOUND_COMPARE",
 | 
	
		
			
				|  |  | -			},
 | 
	
		
			
				|  |  | -			body: {
 | 
	
		
			
				|  |  | -				offsetTime: delayTime < 0 ? 0 : delayTime,
 | 
	
		
			
				|  |  | -			},
 | 
	
		
			
				|  |  | -		});
 | 
	
		
			
				|  |  | -		evaluatingData.backtime = 0;
 | 
	
		
			
				|  |  | -	}, 220);
 | 
	
		
			
				|  |  | +	const delayTime = nowTime - evaluatingData.backtime - currentTime * 1000;
 | 
	
		
			
				|  |  | +	console.log("真正播放延迟", delayTime);
 | 
	
		
			
				|  |  | +	await api_proxyServiceMessage({
 | 
	
		
			
				|  |  | +		header: {
 | 
	
		
			
				|  |  | +			commond: "audioPlayStart",
 | 
	
		
			
				|  |  | +			type: "SOUND_COMPARE",
 | 
	
		
			
				|  |  | +		},
 | 
	
		
			
				|  |  | +		body: {
 | 
	
		
			
				|  |  | +			offsetTime: delayTime < 0 ? 0 : delayTime,
 | 
	
		
			
				|  |  | +		},
 | 
	
		
			
				|  |  | +	});
 | 
	
		
			
				|  |  | +	evaluatingData.backtime = 0;
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /** 检测耳机 */
 | 
	
	
		
			
				|  | @@ -181,7 +180,7 @@ export const handleStartBegin = async () => {
 | 
	
		
			
				|  |  |  	evaluatingData.startBegin = true;
 | 
	
		
			
				|  |  |  	evaluatingData.evaluatings = {};
 | 
	
		
			
				|  |  |  	evaluatingData.resultData = {};
 | 
	
		
			
				|  |  | -	evaluatingData.backtime = Date.now();
 | 
	
		
			
				|  |  | +	evaluatingData.backtime = 0;
 | 
	
		
			
				|  |  |  	resetPlaybackToStart();
 | 
	
		
			
				|  |  |  	try {
 | 
	
		
			
				|  |  |  		console.log("🚀 ~ content:", evaluatingData.contentData, JSON.stringify(evaluatingData.contentData));
 | 
	
	
		
			
				|  | @@ -194,6 +193,15 @@ export const handleStartBegin = async () => {
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  	// 开始录音
 | 
	
		
			
				|  |  |  	api_startRecording();
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/** 录音开始,开始播放音频 */
 | 
	
		
			
				|  |  | +const recordedPlayMusic = async (res?: IPostMessage) => {
 | 
	
		
			
				|  |  | +	let inteveral = res?.content?.inteveral || 0;
 | 
	
		
			
				|  |  | +	if (browserInfo.ios) {
 | 
	
		
			
				|  |  | +		inteveral *= 1000;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +	evaluatingData.backtime = inteveral || Date.now();
 | 
	
		
			
				|  |  |  	const playState = await togglePlay("play");
 | 
	
		
			
				|  |  |  	// 取消播放
 | 
	
		
			
				|  |  |  	if (!playState) {
 | 
	
	
		
			
				|  | @@ -299,12 +307,14 @@ export default defineComponent({
 | 
	
		
			
				|  |  |  			evaluatingData.checkStep = 0;
 | 
	
		
			
				|  |  |  			evaluatingData.rendered = true;
 | 
	
		
			
				|  |  |  			sendResult(handleScoreResult);
 | 
	
		
			
				|  |  | +			api_recordStartTime(recordedPlayMusic);
 | 
	
		
			
				|  |  |  			if (!state.isSelectMeasureMode) {
 | 
	
		
			
				|  |  |  				clearSelection();
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  		});
 | 
	
		
			
				|  |  |  		onUnmounted(() => {
 | 
	
		
			
				|  |  |  			removeResult(handleScoreResult);
 | 
	
		
			
				|  |  | +			api_remove_recordStartTime(recordedPlayMusic);
 | 
	
		
			
				|  |  |  		});
 | 
	
		
			
				|  |  |  		return () => <div></div>;
 | 
	
		
			
				|  |  |  	},
 |