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

修改视频上报

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