Aliplayer 如何获取记忆组件 记忆的时间
绑定'timeupdate'事件,保存播放进度到缓存中
player.on('timeupdate',function (e) {
localStorage.setItem('memory_time:'+video_id,player.getCurrentTime());
//console.log('time:',player.getCurrentTime());
})
加载播放器的时获取缓存中上次播放时间点
var player = new Aliplayer({},function(player){
var memory_time = localStorage.getItem('memory_time:'+video_id);
//console.log(memory_time);
if (memory_time){
player.seek(memory_time);
}
});
赞2
踩0