JLBA202505130001_关于吉林银行新建AI智能培训系统的需求_fix: 语音播放问题处理
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
</view>
|
||||
<view class="qns-desc">你的答案:</view>
|
||||
<view class="ans-list">
|
||||
<!-- {...item, ossAddr: 'http://25.18.122.91:9786' + item.ossAddr.slice(35,)} -->
|
||||
<esQuestionAnswer v-for="item in dataInfo.analyContentVos" :dataInfo="item" :intrctWay="item.ossKey?'02':'01'"
|
||||
:activeVoiceId="activeVoiceId" @changePlay="changePlay" />
|
||||
</view>
|
||||
@@ -55,7 +56,6 @@
|
||||
});
|
||||
const emit = defineEmits(['changePlay', 'buutton_click']);
|
||||
const changePlay = (val) => {
|
||||
console.log('esq')
|
||||
emit('changePlay', val)
|
||||
}
|
||||
watch(
|
||||
|
||||
@@ -49,7 +49,9 @@
|
||||
import {
|
||||
onUnload
|
||||
} from '@dcloudio/uni-app';
|
||||
import { getToken } from '@/common/common.js'
|
||||
import {
|
||||
getToken
|
||||
} from '@/common/common.js'
|
||||
const props = defineProps({
|
||||
dataInfo: {
|
||||
default: () => ({
|
||||
@@ -143,15 +145,16 @@
|
||||
// emit('changePlay', '');
|
||||
};
|
||||
const playVoice = () => {
|
||||
emit('changePlay', unref(dataInfo)?.ossAddr);
|
||||
// emit('changePlay', unref(dataInfo)?.ossAddr);
|
||||
if (talkVoiceObj.value && talkVoiceObj.value.src) {
|
||||
talkVoiceObj.value.play();
|
||||
isPlaying.value = true;
|
||||
return;
|
||||
} else {
|
||||
talkVoiceObj.value.src = '';
|
||||
// talkVoiceObj.value.src = '';
|
||||
if (unref(dataInfo).ossAddr) {
|
||||
setTimeout(() => {
|
||||
talkVoiceObj.value.src = unref(dataInfo).ossAddr + '?tk=' + getToken();
|
||||
talkVoiceObj.value.src = unref(dataInfo).ossAddr + '?tk=' + getToken();
|
||||
talkVoiceObj.value.play();
|
||||
isPlaying.value = true;
|
||||
}, 100);
|
||||
@@ -162,24 +165,24 @@
|
||||
talkVoiceObj.value = uni.createInnerAudioContext();
|
||||
let prevTime = -1;
|
||||
talkVoiceObj.value.onEnded(() => {
|
||||
console.log('onEnded')
|
||||
console.log('onEnded')
|
||||
emit('changePlay', '');
|
||||
prevTime = -1;
|
||||
talkVoiceObj.value.src = '';
|
||||
});
|
||||
talkVoiceObj.value.onStop(() => {
|
||||
console.log('onEnded')
|
||||
console.log('onStop')
|
||||
emit('changePlay', '');
|
||||
prevTime = -1;
|
||||
talkVoiceObj.value.src = '';
|
||||
});
|
||||
talkVoiceObj.value.onPause(() => {
|
||||
console.log('onEnded')
|
||||
console.log('onPause')
|
||||
prevTime = talkVoiceObj.value.currentTime;
|
||||
emit('changePlay', '');
|
||||
});
|
||||
talkVoiceObj.value.onError(() => {
|
||||
console.log('onError')
|
||||
console.log('onError')
|
||||
// prevTime = -1;
|
||||
// emit('changePlay', '');
|
||||
});
|
||||
@@ -200,12 +203,8 @@
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
if (unref(dataInfo).intrctWay === '02') {
|
||||
itemVoice.value = unref(dataInfo).ossAddr + '?tk=' + getToken();
|
||||
talkVoiceObj.value.src = itemVoice.value;
|
||||
setTimeout(() => {
|
||||
setVoiceTime(0);
|
||||
}, 100);
|
||||
if (unref(dataInfo).ossKey) {
|
||||
talkVoiceObj.value.src = unref(dataInfo).ossAddr + '?tk=' + getToken();
|
||||
}
|
||||
};
|
||||
const setVoiceTime = (sum) => {
|
||||
|
||||
Reference in New Issue
Block a user