提交 50888ec7 编写于 作者: guofeng.chen's avatar guofeng.chen

修改视频上报

上级 227f7957
......@@ -152,6 +152,8 @@ export default {
if (this.isWechat) {
const player = document.getElementById(this.vid);
player.addEventListener("timeupdate", this.onTimeUpdate, false);
player.addEventListener("play", this.onPlay, false);
player.addEventListener("pause", this.onPause, false);
this.player = player;
}
},
......@@ -165,6 +167,15 @@ export default {
}
},
methods: {
// 被接管时,监听上报
onPlay() {
this.reportOnOff(1);
this.isPaused = false;
},
onPause() {
this.reportOnOff(2);
this.isPaused = true;
},
togglePlay() {
if (!this.logged) {
this.$store.dispatch('goLogin');
......@@ -186,7 +197,7 @@ export default {
} else {
this.player.pause();
}
this.reportOnOff(isPaused ? 1 : 2);
// this.reportOnOff(isPaused ? 1 : 2); // 使用监听发送
this.isPaused = !isPaused;
},
// 切换视频
......@@ -220,7 +231,9 @@ export default {
if (!this.isPaused && !this.finish) {
this.reportOnOff(2);
}
this.reportLeave();
if (!this.finish) {
this.reportLeave();
}
if (this.playTime === 0) {
this.player.play();
}
......@@ -384,6 +397,7 @@ export default {
if (!this.provedOver) {
this.$emit('onVideoEnd', { type: 2 });
this.reportOnOff(2);
this.reportLeave();
}
this.finish = true;
this.showReplay = true;
......@@ -398,6 +412,7 @@ export default {
this.player.style.display = 'none';
}
this.reportOnOff(2);
this.reportLeave();
this.$nextTick(() => {
if (this.coverType > 0 && this.coverType !== 13) {
this.isFullScreen = false;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册