在这里主要是讨论和总结在进度条问题上
在项目中,我为slider绑定了chang和changing事件,但是总是在拖动的时候出现抽搐,拖动过程可以播放的,但就是卡在抽搐这个问题上,最后终于发现在changing事件中就因该要seek(event.detail.value)了,因此在改进后明显没有抖动抽搐,拖动顺畅。在此处进度条改变是靠setInetval的。
但在这个问题改变后,点击slider某一段就页出现卡退现象了,状态就如:
例:currentTime=10
点击时slider.value=99
出现情况:
currentTime:10
slidervalue:99–点击时
currentTime:11
currentTime:99
解决办法就是:
进度条的控制用以下方法:
Progressdrag: function () {
clearTimeout(a);
let that = this;
a = setTimeout(() => {
iac.currentTime
iac.onTimeUpdate(() => {
this.setData({
currentimes: parseInt(iac.currentTime),
currenttimesText: this.formatSeconds(iac.currentTime)
})
})
}, 500);
},