When the video is playing, we have to record the playing time
We will set it back when we play it next time!
We record the playing time
The next step is to put the data in data!
Play the recorded list
// 记录播放time
eventhandle:function(event){
let vid = event.currentTarget.id;
let time = event.detail.currentTime;
let playobj = {
vid,time
}
let palyRecords = this.data.palyRecords;
// 放入播放记录列表中,有一个小逻辑,有的话更改,没有的放进去
let index = this.data.palyRecords.findIndex(item=>item.vid===vid);
if(index!== -1){
palyRecords[index].time = time;
}else{
// 若没有就放进去
palyRecords.push(playobj)
}
// 设置一下就行了
this.setData({
palyRecords
})
},
Record we got it done
Okay, in the next article, we will do the resetting of the playback record!