Commit 70d9f3d8 authored by lvtz's avatar lvtz

fi

parent 88921047
......@@ -734,7 +734,7 @@ Page({
}
})
this.innerAudioContext.seek(audioStorage[value].currentTime)
this.innerAudioContext.play();
this.innerAudioContext.play()
this.innerAudioContext.onError((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
audioStorage[actPalyaudioValue].isWaiting = false;
......
......@@ -112,10 +112,52 @@ Page({
{type: 5,label:"今日练字作业",title: '请各位同学认真查看今日要练习的作业,并跟着练习'}
],
currentMockType: 0,
successDailogShow: false
successDailogShow: false,
actPalyaudioValue: ''
},
onLoad: function(options) { // Do some initialize when page load.
const that = this;
this.innerAudioContext = wx.createInnerAudioContext(); // 当前页面唯一的一个音频容器
this.innerAudioContext.onWaiting((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
if(audioStorage[actPalyaudioValue].isWaiting){
return
}
audioStorage[actPalyaudioValue].isWaiting = true
that.setData({
audioStorage,
})
setTimeout((e)=>{
this.data.audioStorage[actPalyaudioValue].isWaiting = false;
this.setData({
audioStorage: this.data.audioStorage
})
},5000)
})
this.innerAudioContext.onTimeUpdate((e) => {
const { actPalyaudioValue, audioStorage} = this.data
if (audioStorage[actPalyaudioValue].isWaiting) {
clearInterval(that.data.voiceInterval);
that.voiceIntervalPlay(actPalyaudioValue);
audioStorage[actPalyaudioValue].isWaiting = false
that.setData({
audioStorage,
})
}
})
this.innerAudioContext.onError((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
audioStorage[actPalyaudioValue].isWaiting = false;
audioStorage[actPalyaudioValue].play = false;
wx.showToast({
title: '音频播放出错啦',
icon: 'none',
duration: 2000
})
that.setData({
audioStorage,
})
});
const {
id,
tid,
......@@ -612,60 +654,22 @@ Page({
audioStorage[value].play = true;
}
}
this.innerAudioContext.onWaiting((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
if(audioStorage[actPalyaudioValue].isWaiting){
return
}
audioStorage[actPalyaudioValue].isWaiting = true
that.setData({
audioStorage,
})
setTimeout((e)=>{
this.data.audioStorage[actPalyaudioValue].isWaiting = false;
this.setData({
audioStorage: this.data.audioStorage
})
},5000)
})
this.innerAudioContext.onTimeUpdate((e) => {
const { actPalyaudioValue, audioStorage} = this.data
if (audioStorage[actPalyaudioValue].isWaiting) {
clearInterval(that.data.voiceInterval);
that.voiceIntervalPlay(actPalyaudioValue);
audioStorage[actPalyaudioValue].isWaiting = false
that.setData({
audioStorage,
})
}
})
this.innerAudioContext.onCanplay((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
if (audioStorage[actPalyaudioValue].isWaiting) {
clearInterval(that.data.voiceInterval);
that.voiceIntervalPlay(actPalyaudioValue);
audioStorage[actPalyaudioValue].isWaiting = false
that.setData({
audioStorage,
})
}
})
// this.innerAudioContext.onCanplay((e)=>{
// const { actPalyaudioValue, audioStorage} = this.data
// if (audioStorage[actPalyaudioValue].isWaiting) {
// clearInterval(that.data.voiceInterval);
// that.voiceIntervalPlay(actPalyaudioValue);
// audioStorage[actPalyaudioValue].isWaiting = false
// that.setData({
// audioStorage,
// })
// }
// })
console.log(audioStorage[value].currentTime, 'audioStorage[value].currentTime');
this.innerAudioContext.seek(audioStorage[value].currentTime)
this.innerAudioContext.play();
this.innerAudioContext.onError((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
audioStorage[actPalyaudioValue].isWaiting = false;
audioStorage[actPalyaudioValue].play = false;
wx.showToast({
title: '音频播放出错啦',
icon: 'none',
duration: 2000
})
that.setData({
audioStorage,
})
});
//that.voiceIntervalPlay(value);
that.setData({
audioStorage,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment