|
@@ -28,6 +28,7 @@ import { usePageVisibility } from "@vant/use";
|
|
|
import { browser } from "/src/utils";
|
|
|
import { getAudioCurrentTime, setAudioCurrentTime, toggleMutePlayAudio } from "../audio-list";
|
|
|
import testAudio from "./testAudio.mp3";
|
|
|
+import { createRecordAudio, startRecordingAudio, stopRecordingAudio } from "./recordAudio";
|
|
|
|
|
|
const browserInfo = browser();
|
|
|
export const evaluatingData = reactive({
|
|
@@ -213,13 +214,16 @@ export const handleStartBegin = async () => {
|
|
|
// console.log("🚀 ~ content:", evaluatingData.contentData, JSON.stringify(evaluatingData.contentData));
|
|
|
} catch (error) {}
|
|
|
const res = await startEvaluating(evaluatingData.contentData);
|
|
|
- if (res?.api !== "startEvaluating") {
|
|
|
- Snackbar.error("请在APP端进行评测");
|
|
|
- evaluatingData.startBegin = false;
|
|
|
- return;
|
|
|
- }
|
|
|
+ startRecordingAudio();
|
|
|
+ evaluatingData.startBegin = true
|
|
|
+ // if (res?.api !== "startEvaluating") {
|
|
|
+ // Snackbar.error("请在APP端进行评测");
|
|
|
+ // evaluatingData.startBegin = false;
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
// 开始录音
|
|
|
- api_startRecording();
|
|
|
+ // api_startRecording();
|
|
|
+
|
|
|
};
|
|
|
|
|
|
/** 播放音乐 */
|
|
@@ -306,7 +310,8 @@ export const handleEndEvaluat = (isComplete = false) => {
|
|
|
if (!evaluatingData.startBegin || state.modeType !== "evaluating") return;
|
|
|
evaluatingData.startBegin = false;
|
|
|
// 结束录音
|
|
|
- api_stopRecording();
|
|
|
+ // api_stopRecording();
|
|
|
+ stopRecordingAudio();
|
|
|
// 结束评测
|
|
|
endEvaluating({
|
|
|
musicScoreId: state.examSongId,
|
|
@@ -423,6 +428,7 @@ export default defineComponent({
|
|
|
handleEndBegin();
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
hanlde_record();
|
|
|
evaluatingData.resultData = {};
|
|
@@ -440,14 +446,7 @@ export default defineComponent({
|
|
|
}
|
|
|
console.log("加载评测模块成功");
|
|
|
|
|
|
- //@ts-ignore
|
|
|
- if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
|
|
|
- // 浏览器支持音频录制
|
|
|
- console.log('浏览器支持音频录制');
|
|
|
- } else {
|
|
|
- // 浏览器不支持音频录制
|
|
|
- console.log('浏览器不支持音频录制');
|
|
|
- }
|
|
|
+ createRecordAudio();
|
|
|
});
|
|
|
onUnmounted(() => {
|
|
|
removeResult(handleScoreResult);
|