|
|
@@ -140,8 +140,6 @@ import ImageToVideo from "@/components/ai/video/ImageToVideo.vue";
|
|
|
import MapGame from "@/components/blockly/MapGame.vue";
|
|
|
// 根据ID获取课程列表
|
|
|
import { getBlocklyByTypeId } from '@/api/programming/index.js'
|
|
|
-// 导入音频播放器
|
|
|
-import { useAudioPlayer } from '@/api/tts/useAudioPlayer';
|
|
|
|
|
|
// 定义常量
|
|
|
const CONSTANTS = {
|
|
|
@@ -156,8 +154,6 @@ const router = useRouter() // 获取当前路由对象
|
|
|
const boxIconTitle = ref('')
|
|
|
// AI组件refs
|
|
|
const aiTextToText = ref(null)
|
|
|
-// 音频播放器实例
|
|
|
-const { stopPlayback } = useAudioPlayer();
|
|
|
// 定义组件的props
|
|
|
const props = defineProps({
|
|
|
courseData: {
|
|
|
@@ -221,12 +217,11 @@ const playPreviousVideo = () => {
|
|
|
if (props.courseList && props.courseList.length > 0) {
|
|
|
const currentIndex = currentCourseIndex.value
|
|
|
if (currentIndex > 0) {
|
|
|
- // 停止音频播放并清理资源
|
|
|
- stopPlayback();
|
|
|
- // 终止AI问答流并清空消息列表
|
|
|
+ // 终止AI问答流并清空消息列表,同时清理语音资源
|
|
|
if (aiTextToText.value) {
|
|
|
aiTextToText.value.stopStream();
|
|
|
aiTextToText.value.clearMessageList();
|
|
|
+ aiTextToText.value.stopPlayback();
|
|
|
}
|
|
|
const previousCourse = props.courseList[currentIndex - 1]
|
|
|
// 更新当前课程数据
|
|
|
@@ -243,12 +238,11 @@ const playNextVideo = () => {
|
|
|
if (props.courseList && props.courseList.length > 0) {
|
|
|
const currentIndex = currentCourseIndex.value
|
|
|
if (currentIndex !== -1 && currentIndex < props.courseList.length - 1) {
|
|
|
- // 停止音频播放并清理资源
|
|
|
- stopPlayback();
|
|
|
- // 终止AI问答流并清空消息列表
|
|
|
+ // 终止AI问答流并清空消息列表,同时清理语音资源
|
|
|
if (aiTextToText.value) {
|
|
|
aiTextToText.value.stopStream();
|
|
|
aiTextToText.value.clearMessageList();
|
|
|
+ aiTextToText.value.stopPlayback();
|
|
|
}
|
|
|
const nextCourse = props.courseList[currentIndex + 1]
|
|
|
// 更新当前课程数据
|
|
|
@@ -427,10 +421,7 @@ onMounted(async () => {
|
|
|
})
|
|
|
|
|
|
// 清理函数
|
|
|
-onUnmounted(() => {
|
|
|
- // 组件卸载时清理音频资源
|
|
|
- stopPlayback();
|
|
|
-})
|
|
|
+onUnmounted(() => {})
|
|
|
|
|
|
// 保存视频/bockly进度接口
|
|
|
const handleSaveProgress = async (type, progress) => {
|