Commit eae3e49f by wangshuo

只要播放就发送时间和进度

parent 0ab97133
...@@ -388,6 +388,7 @@ class Video extends Component { ...@@ -388,6 +388,7 @@ class Video extends Component {
}, 1000) }, 1000)
} }
clearInterval(this.timer) clearInterval(this.timer)
this.timer = null;
}) })
this.ws.addEventListener('message', e => { this.ws.addEventListener('message', e => {
const data = JSON.parse(e.data); const data = JSON.parse(e.data);
...@@ -482,7 +483,7 @@ class Video extends Component { ...@@ -482,7 +483,7 @@ class Video extends Component {
uid: this.props.user.data.uid, uid: this.props.user.data.uid,
token: this.token, token: this.token,
platform: 5, platform: 5,
position: this.player.currentTime(), position: parseInt(this.player.currentTime()),
ctype: ctype, ctype: ctype,
}) })
} }
...@@ -491,6 +492,7 @@ class Video extends Component { ...@@ -491,6 +492,7 @@ class Video extends Component {
this.count = 0 this.count = 0
this.watchSec = 0 this.watchSec = 0
clearInterval(this.timer) clearInterval(this.timer)
this.timer = null;
this.timer = setInterval(() => { this.timer = setInterval(() => {
if (this.player && this.player.player()) { if (this.player && this.player.player()) {
if (this.count === 5) { if (this.count === 5) {
...@@ -561,6 +563,7 @@ class Video extends Component { ...@@ -561,6 +563,7 @@ class Video extends Component {
this.getShareProgressInfo() this.getShareProgressInfo()
} }
clearInterval(this.timer); clearInterval(this.timer);
this.timer = null;
}) })
this.player.on('seeked', () => { this.player.on('seeked', () => {
this.sendRecord() this.sendRecord()
...@@ -578,6 +581,7 @@ class Video extends Component { ...@@ -578,6 +581,7 @@ class Video extends Component {
this.player && this.player.dispose() this.player && this.player.dispose()
clearInterval(this.timer) clearInterval(this.timer)
this.timer = null;
this.ws && this.ws.close() this.ws && this.ws.close()
this.ws = null this.ws = null
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment