|
@@ -168,9 +168,25 @@ const _sfc_main = {
|
|
beforeDestroy() {
|
|
beforeDestroy() {
|
|
this.stopUserCamera();
|
|
this.stopUserCamera();
|
|
if (this.aiAudioPlayer) {
|
|
if (this.aiAudioPlayer) {
|
|
- this.aiAudioPlayer.destroy();
|
|
|
|
|
|
+ try {
|
|
|
|
+ this.aiAudioPlayer.destroy();
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.error("销毁音频播放器失败:", e);
|
|
|
|
+ }
|
|
this.aiAudioPlayer = null;
|
|
this.aiAudioPlayer = null;
|
|
}
|
|
}
|
|
|
|
+ if (this.recordingTimer) {
|
|
|
|
+ clearInterval(this.recordingTimer);
|
|
|
|
+ this.recordingTimer = null;
|
|
|
|
+ }
|
|
|
|
+ if (this.countdownTimer) {
|
|
|
|
+ clearInterval(this.countdownTimer);
|
|
|
|
+ this.countdownTimer = null;
|
|
|
|
+ }
|
|
|
|
+ if (this.mediaRecorderTimeout) {
|
|
|
|
+ clearTimeout(this.mediaRecorderTimeout);
|
|
|
|
+ this.mediaRecorderTimeout = null;
|
|
|
|
+ }
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
// 初始化相机
|
|
// 初始化相机
|
|
@@ -1103,8 +1119,10 @@ const _sfc_main = {
|
|
questionId,
|
|
questionId,
|
|
attempts: 0,
|
|
attempts: 0,
|
|
// 上传尝试次数
|
|
// 上传尝试次数
|
|
- maxAttempts: 3
|
|
|
|
|
|
+ maxAttempts: 3,
|
|
// 最大尝试次数
|
|
// 最大尝试次数
|
|
|
|
+ hasAudio: true
|
|
|
|
+ // 明确标记包含音频
|
|
};
|
|
};
|
|
this.uploadQueue.push(uploadTask);
|
|
this.uploadQueue.push(uploadTask);
|
|
this.uploadProgress[uploadTask.id] = 0;
|
|
this.uploadProgress[uploadTask.id] = 0;
|
|
@@ -1174,7 +1192,7 @@ const _sfc_main = {
|
|
formData.append("tenant_id", tenant_id);
|
|
formData.append("tenant_id", tenant_id);
|
|
formData.append("application_id", common_vendor.index.getStorageSync("appId"));
|
|
formData.append("application_id", common_vendor.index.getStorageSync("appId"));
|
|
formData.append("question_id", task.questionId);
|
|
formData.append("question_id", task.questionId);
|
|
- formData.append("video_duration", 0);
|
|
|
|
|
|
+ formData.append("video_duration", this.recordingTimerCount || 0);
|
|
formData.append("has_audio", "true");
|
|
formData.append("has_audio", "true");
|
|
const xhr = new XMLHttpRequest();
|
|
const xhr = new XMLHttpRequest();
|
|
xhr.open("POST", `${common_config.apiBaseUrl}/api/upload/`, true);
|
|
xhr.open("POST", `${common_config.apiBaseUrl}/api/upload/`, true);
|
|
@@ -1232,8 +1250,9 @@ const _sfc_main = {
|
|
tenant_id,
|
|
tenant_id,
|
|
application_id: common_vendor.index.getStorageSync("appId"),
|
|
application_id: common_vendor.index.getStorageSync("appId"),
|
|
question_id: task.questionId,
|
|
question_id: task.questionId,
|
|
- video_duration: 0,
|
|
|
|
|
|
+ video_duration: this.recordingTimerCount || 0,
|
|
has_audio: "true"
|
|
has_audio: "true"
|
|
|
|
+ // 明确标记包含音频
|
|
},
|
|
},
|
|
success: (uploadRes) => {
|
|
success: (uploadRes) => {
|
|
try {
|
|
try {
|
|
@@ -1314,63 +1333,15 @@ const _sfc_main = {
|
|
questionId = 10;
|
|
questionId = 10;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- const requestData = {
|
|
|
|
|
|
+ ({
|
|
application_id: common_vendor.index.getStorageSync("appId"),
|
|
application_id: common_vendor.index.getStorageSync("appId"),
|
|
question_id: questionId,
|
|
question_id: questionId,
|
|
video_url: videoUrl,
|
|
video_url: videoUrl,
|
|
- tenant_id: common_vendor.index.getStorageSync("tenant_id") || "1"
|
|
|
|
- };
|
|
|
|
- common_vendor.index.request({
|
|
|
|
- url: `${common_config.apiBaseUrl}/api/job/upload_video`,
|
|
|
|
- method: "POST",
|
|
|
|
- data: requestData,
|
|
|
|
- header: {
|
|
|
|
- "content-type": "application/x-www-form-urlencoded"
|
|
|
|
- },
|
|
|
|
- success: (res) => {
|
|
|
|
- console.log("面试接口提交成功:", res);
|
|
|
|
- if (res.data.code === 0 || res.data.code === 2e3) {
|
|
|
|
- if (task) {
|
|
|
|
- this.uploadQueue.shift();
|
|
|
|
- this.processUploadQueue();
|
|
|
|
- } else {
|
|
|
|
- common_vendor.index.showToast({
|
|
|
|
- title: "回答已提交",
|
|
|
|
- icon: "success"
|
|
|
|
- });
|
|
|
|
- this.lastUploadedVideoUrl = videoUrl;
|
|
|
|
- this.showRetryButton = false;
|
|
|
|
- this.lastVideoToRetry = null;
|
|
|
|
- }
|
|
|
|
- this.submitToAiVoiceInteraction(videoUrl);
|
|
|
|
- } else {
|
|
|
|
- if (task) {
|
|
|
|
- this.handleSubmitFailure(task, res.data.msg || "提交失败");
|
|
|
|
- } else {
|
|
|
|
- common_vendor.index.showToast({
|
|
|
|
- title: res.data.msg || "提交失败,请重试",
|
|
|
|
- icon: "none"
|
|
|
|
- });
|
|
|
|
- this.lastVideoToRetry = videoUrl;
|
|
|
|
- this.showRetryButton = true;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- fail: (err) => {
|
|
|
|
- console.error("面试接口提交失败:", err);
|
|
|
|
- if (task) {
|
|
|
|
- this.handleSubmitFailure(task, err.errMsg || "网络错误");
|
|
|
|
- } else {
|
|
|
|
- common_vendor.index.hideLoading();
|
|
|
|
- common_vendor.index.showToast({
|
|
|
|
- title: "网络错误,请重试",
|
|
|
|
- icon: "none"
|
|
|
|
- });
|
|
|
|
- this.lastVideoToRetry = videoUrl;
|
|
|
|
- this.showRetryButton = true;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ tenant_id: common_vendor.index.getStorageSync("tenant_id") || "1",
|
|
|
|
+ has_audio: true
|
|
|
|
+ // 明确标记包含音频
|
|
});
|
|
});
|
|
|
|
+ this.submitToAiVoiceInteraction(videoUrl);
|
|
},
|
|
},
|
|
// 添加新方法:处理提交失败
|
|
// 添加新方法:处理提交失败
|
|
handleSubmitFailure(task, errorMsg) {
|
|
handleSubmitFailure(task, errorMsg) {
|
|
@@ -1429,7 +1400,6 @@ const _sfc_main = {
|
|
console.log("AI语音正在播放,等待播放完成后再跳转");
|
|
console.log("AI语音正在播放,等待播放完成后再跳转");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- this.navigateToNextPage();
|
|
|
|
if (this.uploadQueue.length > 0) {
|
|
if (this.uploadQueue.length > 0) {
|
|
console.log("上传队列将在后台继续处理...");
|
|
console.log("上传队列将在后台继续处理...");
|
|
this.saveUploadStatus();
|
|
this.saveUploadStatus();
|
|
@@ -1842,30 +1812,34 @@ const _sfc_main = {
|
|
console.error("保存上传状态失败:", e);
|
|
console.error("保存上传状态失败:", e);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- // 修改 submitToAiVoiceInteraction 方法,使用 FormData 提交
|
|
|
|
|
|
+ // 增强 submitToAiVoiceInteraction 方法
|
|
submitToAiVoiceInteraction(videoUrl) {
|
|
submitToAiVoiceInteraction(videoUrl) {
|
|
console.log("提交视频到AI语音交互接口:", videoUrl);
|
|
console.log("提交视频到AI语音交互接口:", videoUrl);
|
|
common_vendor.index.showLoading({
|
|
common_vendor.index.showLoading({
|
|
- title: "AI正在思考...",
|
|
|
|
|
|
+ title: "面试官正在思考...",
|
|
mask: true
|
|
mask: true
|
|
});
|
|
});
|
|
const tenant_id = common_vendor.index.getStorageSync("tenant_id") || "1";
|
|
const tenant_id = common_vendor.index.getStorageSync("tenant_id") || "1";
|
|
const userInfo = common_vendor.index.getStorageSync("userInfo");
|
|
const userInfo = common_vendor.index.getStorageSync("userInfo");
|
|
- const openid = userInfo ? JSON.parse(userInfo).openid || "" : "";
|
|
|
|
|
|
+ userInfo ? JSON.parse(userInfo).openid || "" : "";
|
|
const systemInfo = common_vendor.index.getSystemInfoSync();
|
|
const systemInfo = common_vendor.index.getSystemInfoSync();
|
|
const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith("mp-");
|
|
const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith("mp-");
|
|
|
|
+ const requestData = {
|
|
|
|
+ url: videoUrl,
|
|
|
|
+ tenant_id
|
|
|
|
+ /* openid: openid,
|
|
|
|
+ application_id: uni.getStorageSync('appId') || '',
|
|
|
|
+ has_audio: true, // 明确标记包含音频
|
|
|
|
+ audio_format: 'mp4', // 指定音频格式
|
|
|
|
+ duration: this.recordingTimerCount || 0 // 添加录制时长 */
|
|
|
|
+ };
|
|
if (isMiniProgram) {
|
|
if (isMiniProgram) {
|
|
common_vendor.index.request({
|
|
common_vendor.index.request({
|
|
url: `${common_config.apiBaseUrl}/api/voice_ai_interaction`,
|
|
url: `${common_config.apiBaseUrl}/api/voice_ai_interaction`,
|
|
method: "POST",
|
|
method: "POST",
|
|
- data: {
|
|
|
|
- url: videoUrl,
|
|
|
|
- tenant_id,
|
|
|
|
- openid,
|
|
|
|
- application_id: common_vendor.index.getStorageSync("appId") || ""
|
|
|
|
- },
|
|
|
|
|
|
+ data: requestData,
|
|
header: {
|
|
header: {
|
|
- "content-type": "application/json"
|
|
|
|
|
|
+ "content-type": "application/x-www-form-urlencoded"
|
|
},
|
|
},
|
|
success: (res) => {
|
|
success: (res) => {
|
|
this.handleAiInteractionResponse(res.data);
|
|
this.handleAiInteractionResponse(res.data);
|
|
@@ -1876,10 +1850,9 @@ const _sfc_main = {
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
const formData = new FormData();
|
|
const formData = new FormData();
|
|
- formData.append("url", videoUrl);
|
|
|
|
- formData.append("tenant_id", tenant_id);
|
|
|
|
- formData.append("openid", openid);
|
|
|
|
- formData.append("application_id", common_vendor.index.getStorageSync("appId") || "");
|
|
|
|
|
|
+ for (const key in requestData) {
|
|
|
|
+ formData.append(key, requestData[key]);
|
|
|
|
+ }
|
|
const xhr = new XMLHttpRequest();
|
|
const xhr = new XMLHttpRequest();
|
|
xhr.open("POST", `${common_config.apiBaseUrl}/api/voice_ai_interaction`, true);
|
|
xhr.open("POST", `${common_config.apiBaseUrl}/api/voice_ai_interaction`, true);
|
|
xhr.timeout = 6e4;
|
|
xhr.timeout = 6e4;
|
|
@@ -1917,7 +1890,13 @@ const _sfc_main = {
|
|
this.aiVoiceUrl = aiVoiceUrl.startsWith("http") ? aiVoiceUrl : `${common_config.apiBaseUrl}${aiVoiceUrl}`;
|
|
this.aiVoiceUrl = aiVoiceUrl.startsWith("http") ? aiVoiceUrl : `${common_config.apiBaseUrl}${aiVoiceUrl}`;
|
|
console.log("AI语音URL:", this.aiVoiceUrl);
|
|
console.log("AI语音URL:", this.aiVoiceUrl);
|
|
this.currentSubtitle = this.aiText;
|
|
this.currentSubtitle = this.aiText;
|
|
- this.playAiVoice();
|
|
|
|
|
|
+ const systemInfo = common_vendor.index.getSystemInfoSync();
|
|
|
|
+ const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith("mp-");
|
|
|
|
+ if (isMiniProgram) {
|
|
|
|
+ this.playMiniProgramAudio();
|
|
|
|
+ } else {
|
|
|
|
+ this.playAiVoice();
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
console.warn("未获取到AI语音URL");
|
|
console.warn("未获取到AI语音URL");
|
|
this.navigateToNextPage();
|
|
this.navigateToNextPage();
|
|
@@ -1942,10 +1921,159 @@ const _sfc_main = {
|
|
playAiVoice() {
|
|
playAiVoice() {
|
|
console.log("开始播放AI语音:", this.aiVoiceUrl);
|
|
console.log("开始播放AI语音:", this.aiVoiceUrl);
|
|
this.isPlayingAiVoice = true;
|
|
this.isPlayingAiVoice = true;
|
|
- this.aiAudioPlayer = common_vendor.index.createInnerAudioContext();
|
|
|
|
- this.aiAudioPlayer.src = this.aiVoiceUrl;
|
|
|
|
- this.aiAudioPlayer.autoplay = true;
|
|
|
|
- this.aiAudioPlayer.onPlay(() => {
|
|
|
|
|
|
+ const systemInfo = common_vendor.index.getSystemInfoSync();
|
|
|
|
+ const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith("mp-");
|
|
|
|
+ try {
|
|
|
|
+ if (this.aiAudioPlayer) {
|
|
|
|
+ this.aiAudioPlayer.destroy();
|
|
|
|
+ }
|
|
|
|
+ this.aiAudioPlayer = common_vendor.index.createInnerAudioContext();
|
|
|
|
+ this.aiAudioPlayer.onPlay(() => {
|
|
|
|
+ console.log("AI语音开始播放");
|
|
|
|
+ common_vendor.index.showToast({
|
|
|
|
+ title: "正在播放面试官的回复",
|
|
|
|
+ icon: "none",
|
|
|
|
+ duration: 2e3
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ this.aiAudioPlayer.onEnded(() => {
|
|
|
|
+ console.log("AI语音播放结束");
|
|
|
|
+ this.isPlayingAiVoice = false;
|
|
|
|
+ this.currentSubtitle = "";
|
|
|
|
+ if (this.aiAudioPlayer) {
|
|
|
|
+ this.aiAudioPlayer.destroy();
|
|
|
|
+ this.aiAudioPlayer = null;
|
|
|
|
+ }
|
|
|
|
+ this.navigateToNextPage();
|
|
|
|
+ });
|
|
|
|
+ this.aiAudioPlayer.onError((err) => {
|
|
|
|
+ console.error("AI语音播放错误:", err);
|
|
|
|
+ this.isPlayingAiVoice = false;
|
|
|
|
+ this.currentSubtitle = "";
|
|
|
|
+ if (this.aiAudioPlayer) {
|
|
|
|
+ this.aiAudioPlayer.destroy();
|
|
|
|
+ this.aiAudioPlayer = null;
|
|
|
|
+ }
|
|
|
|
+ this.navigateToNextPage();
|
|
|
|
+ });
|
|
|
|
+ if (isMiniProgram) {
|
|
|
|
+ if (!this.aiVoiceUrl) {
|
|
|
|
+ throw new Error("无效的音频URL");
|
|
|
|
+ }
|
|
|
|
+ this.aiAudioPlayer.src = this.aiVoiceUrl;
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.aiAudioPlayer.play();
|
|
|
|
+ }, 100);
|
|
|
|
+ } else {
|
|
|
|
+ this.aiAudioPlayer.src = this.aiVoiceUrl;
|
|
|
|
+ this.aiAudioPlayer.play();
|
|
|
|
+ }
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.error("播放AI语音时发生错误:", e);
|
|
|
|
+ this.isPlayingAiVoice = false;
|
|
|
|
+ this.currentSubtitle = "";
|
|
|
|
+ if (this.aiAudioPlayer) {
|
|
|
|
+ try {
|
|
|
|
+ this.aiAudioPlayer.destroy();
|
|
|
|
+ } catch (destroyError) {
|
|
|
|
+ console.error("销毁音频播放器失败:", destroyError);
|
|
|
|
+ }
|
|
|
|
+ this.aiAudioPlayer = null;
|
|
|
|
+ }
|
|
|
|
+ this.navigateToNextPage();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 添加新方法:从视频中提取音频
|
|
|
|
+ async extractAudioFromVideo(videoBlob) {
|
|
|
|
+ console.log("开始从视频中提取音频");
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ try {
|
|
|
|
+ const videoElement = document.createElement("video");
|
|
|
|
+ videoElement.muted = false;
|
|
|
|
+ videoElement.autoplay = false;
|
|
|
|
+ const audioContext = new (window.AudioContext || window.webkitAudioContext)();
|
|
|
|
+ let audioDestination = null;
|
|
|
|
+ let mediaRecorder = null;
|
|
|
|
+ const audioChunks = [];
|
|
|
|
+ videoElement.src = URL.createObjectURL(videoBlob);
|
|
|
|
+ videoElement.onloadedmetadata = () => {
|
|
|
|
+ console.log("视频元数据已加载,视频时长:", videoElement.duration);
|
|
|
|
+ const source = audioContext.createMediaElementSource(videoElement);
|
|
|
|
+ audioDestination = audioContext.createMediaStreamDestination();
|
|
|
|
+ source.connect(audioDestination);
|
|
|
|
+ mediaRecorder = new MediaRecorder(audioDestination.stream);
|
|
|
|
+ mediaRecorder.ondataavailable = (event) => {
|
|
|
|
+ if (event.data.size > 0) {
|
|
|
|
+ audioChunks.push(event.data);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ mediaRecorder.onstop = () => {
|
|
|
|
+ const audioBlob = new Blob(audioChunks, { type: "audio/wav" });
|
|
|
|
+ console.log("音频提取完成,大小:", audioBlob.size);
|
|
|
|
+ resolve(audioBlob);
|
|
|
|
+ };
|
|
|
|
+ videoElement.onplay = () => {
|
|
|
|
+ mediaRecorder.start(100);
|
|
|
|
+ };
|
|
|
|
+ videoElement.onended = () => {
|
|
|
|
+ mediaRecorder.stop();
|
|
|
|
+ audioContext.close();
|
|
|
|
+ };
|
|
|
|
+ videoElement.play();
|
|
|
|
+ };
|
|
|
|
+ videoElement.onerror = (err) => {
|
|
|
|
+ console.error("视频加载失败:", err);
|
|
|
|
+ reject(new Error("视频加载失败"));
|
|
|
|
+ };
|
|
|
|
+ } catch (err) {
|
|
|
|
+ console.error("提取音频失败:", err);
|
|
|
|
+ reject(err);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 添加新方法:上传音频文件
|
|
|
|
+ async uploadAudioFile(audioBlob, videoUrl) {
|
|
|
|
+ console.log("准备上传音频文件");
|
|
|
|
+ const formData = new FormData();
|
|
|
|
+ const fileName = `audio_${Date.now()}.wav`;
|
|
|
|
+ const audioFile = new File([audioBlob], fileName, { type: "audio/wav" });
|
|
|
|
+ formData.append("audio_file", audioFile);
|
|
|
|
+ formData.append("video_url", videoUrl);
|
|
|
|
+ formData.append("tenant_id", common_vendor.index.getStorageSync("tenant_id") || "1");
|
|
|
|
+ formData.append("openid", common_vendor.index.getStorageSync("userInfo") ? JSON.parse(common_vendor.index.getStorageSync("userInfo")).openid : "");
|
|
|
|
+ formData.append("application_id", common_vendor.index.getStorageSync("appId") || "");
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ const xhr = new XMLHttpRequest();
|
|
|
|
+ xhr.open("POST", `${common_config.apiBaseUrl}/api/voice_ai_interaction`, true);
|
|
|
|
+ xhr.timeout = 6e4;
|
|
|
|
+ xhr.onload = () => {
|
|
|
|
+ if (xhr.status === 200) {
|
|
|
|
+ try {
|
|
|
|
+ const response = JSON.parse(xhr.responseText);
|
|
|
|
+ resolve(response);
|
|
|
|
+ } catch (e) {
|
|
|
|
+ reject(new Error("解析响应失败"));
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ reject(new Error("HTTP状态: " + xhr.status));
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ xhr.onerror = () => {
|
|
|
|
+ reject(new Error("网络错误"));
|
|
|
|
+ };
|
|
|
|
+ xhr.ontimeout = () => {
|
|
|
|
+ reject(new Error("请求超时"));
|
|
|
|
+ };
|
|
|
|
+ xhr.send(formData);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 添加一个新方法:使用小程序原生音频API
|
|
|
|
+ playMiniProgramAudio() {
|
|
|
|
+ console.log("使用小程序原生音频API播放:", this.aiVoiceUrl);
|
|
|
|
+ this.isPlayingAiVoice = true;
|
|
|
|
+ const audioContext = common_vendor.wx$1.createInnerAudioContext();
|
|
|
|
+ audioContext.src = this.aiVoiceUrl;
|
|
|
|
+ audioContext.onPlay(() => {
|
|
console.log("AI语音开始播放");
|
|
console.log("AI语音开始播放");
|
|
common_vendor.index.showToast({
|
|
common_vendor.index.showToast({
|
|
title: "正在播放AI回复",
|
|
title: "正在播放AI回复",
|
|
@@ -1953,26 +2081,23 @@ const _sfc_main = {
|
|
duration: 2e3
|
|
duration: 2e3
|
|
});
|
|
});
|
|
});
|
|
});
|
|
- this.aiAudioPlayer.onEnded(() => {
|
|
|
|
|
|
+ audioContext.onEnded(() => {
|
|
console.log("AI语音播放结束");
|
|
console.log("AI语音播放结束");
|
|
this.isPlayingAiVoice = false;
|
|
this.isPlayingAiVoice = false;
|
|
this.currentSubtitle = "";
|
|
this.currentSubtitle = "";
|
|
- if (this.aiAudioPlayer) {
|
|
|
|
- this.aiAudioPlayer.destroy();
|
|
|
|
- this.aiAudioPlayer = null;
|
|
|
|
- }
|
|
|
|
|
|
+ audioContext.destroy();
|
|
this.navigateToNextPage();
|
|
this.navigateToNextPage();
|
|
});
|
|
});
|
|
- this.aiAudioPlayer.onError((err) => {
|
|
|
|
|
|
+ audioContext.onError((err) => {
|
|
console.error("AI语音播放错误:", err);
|
|
console.error("AI语音播放错误:", err);
|
|
this.isPlayingAiVoice = false;
|
|
this.isPlayingAiVoice = false;
|
|
this.currentSubtitle = "";
|
|
this.currentSubtitle = "";
|
|
- if (this.aiAudioPlayer) {
|
|
|
|
- this.aiAudioPlayer.destroy();
|
|
|
|
- this.aiAudioPlayer = null;
|
|
|
|
- }
|
|
|
|
|
|
+ audioContext.destroy();
|
|
this.navigateToNextPage();
|
|
this.navigateToNextPage();
|
|
});
|
|
});
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ audioContext.play();
|
|
|
|
+ }, 100);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|