提交 d3b27796 authored 作者: haodaking's avatar haodaking

fix: 修复safair浏览器视频观看时长统计错误的问题

上级 7867dd00
...@@ -75,7 +75,8 @@ export default { ...@@ -75,7 +75,8 @@ export default {
}, },
player: null, player: null,
watchedTimePoint: [], // 视频观看的时间点 watchedTimePoint: [], // 视频观看的时间点
timer: null timer: null,
isPlaying: false
} }
}, },
watch: { watch: {
...@@ -155,6 +156,7 @@ export default { ...@@ -155,6 +156,7 @@ export default {
}, },
// 当前播放时间更新 // 当前播放时间更新
onTimeupdate(time) { onTimeupdate(time) {
this.isPlaying = true
const ppts = this.chatperResources.ppts || [] const ppts = this.chatperResources.ppts || []
let index = this.chatperResources.ppts.findIndex( let index = this.chatperResources.ppts.findIndex(
(item) => item.ppt_point > time (item) => item.ppt_point > time
...@@ -259,12 +261,14 @@ export default { ...@@ -259,12 +261,14 @@ export default {
// 默认增加时间 // 默认增加时间
this.progress.pt = this.progress.pt || this.throttleWait this.progress.pt = this.progress.pt || this.throttleWait
this.timer = setInterval(() => { this.timer = setInterval(() => {
const status = this.player.getStatus() // safair 浏览器下有bug
if (status === 'playing') { // const status = this.player.getStatus()
if (this.isPlaying) {
// 播放倍速 // 播放倍速
const speed = this.player._originalPlaybackRate || 1 const speed = this.player._originalPlaybackRate || 1
this.progress.pt = this.progress.pt + 1 * speed this.progress.pt = this.progress.pt + 1 * speed
} }
this.isPlaying = false
}, 1000) }, 1000)
} }
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论