Commit 2434e345 by zhanghaozhe

视频播放页去掉record接口

parent 928baf55
...@@ -13,7 +13,6 @@ import { Modal } from "antd-mobile" ...@@ -13,7 +13,6 @@ import { Modal } from "antd-mobile"
import { Loading } from '@/common' import { Loading } from '@/common'
import { connect } from "react-redux" import { connect } from "react-redux"
import jsCookie from 'js-cookie' import jsCookie from 'js-cookie'
import io from 'socket.io-client'
import Single from "@/components/detail/single"; import Single from "@/components/detail/single";
import SingleSuccess from "../detail/single/singleSuccess"; import SingleSuccess from "../detail/single/singleSuccess";
import './CustomPlayButton' import './CustomPlayButton'
...@@ -83,8 +82,6 @@ class Video extends Component { ...@@ -83,8 +82,6 @@ class Video extends Component {
isCurrentVideoFirstPlay = true isCurrentVideoFirstPlay = true
WATCHTIME = "watch_time"
COUNTSCHEDULE = "count_schedule"
RECENTLEARN = "recent_learn" RECENTLEARN = "recent_learn"
state = { state = {
...@@ -136,7 +133,6 @@ class Video extends Component { ...@@ -136,7 +133,6 @@ class Video extends Component {
this.token = jsCookie.get('token') this.token = jsCookie.get('token')
this.getVideoList() this.getVideoList()
this.getDatumCatalog() this.getDatumCatalog()
this.setupRecord()
} }
// 直接购买 // 直接购买
...@@ -341,40 +337,6 @@ class Video extends Component { ...@@ -341,40 +337,6 @@ class Video extends Component {
}) })
} }
setupRecord = () => {
this.recordSocket = io(API.record, {
transports: ['websocket'],
forceNew: true
})
// this.recordSocket = io(API.record)
// this.recordSocket.on('seek', time => {
// this.player.currentTime(time)
// })
// 开启定时器 每5秒发送一次学习记录 --删除
this.recordTimer = setInterval(() => {
this.sendRecord()
}, 5000)
}
// 发送学习记录
sendRecord = () => {
if (this.recordSocket && this.player) {
this.recordSocket.emit('addRecord', this.recordUserInfo())
}
}
// 返回学习记录的数据
recordUserInfo = () => {
let {uid} = this.props.user.data
return {
uid,
course_id: this.courseID,
video_id: this.state.videoList[this.state.activeIndex]['id'],
video_time: parseInt(this.player.currentTime()),
plat: 5
}
}
// 9502 初始化 监听事件 // 9502 初始化 监听事件
setupWS = () => { setupWS = () => {
this.ws = new WebSocket(API["process-api"]); this.ws = new WebSocket(API["process-api"]);
...@@ -524,9 +486,6 @@ class Video extends Component { ...@@ -524,9 +486,6 @@ class Video extends Component {
} }
}) })
this.player.addChild('CustomPlayButtonCover') this.player.addChild('CustomPlayButtonCover')
this.player.on('ready', () => {
this.recordSocket.emit('load', this.recordUserInfo())
})
this.player.on('play', () => { this.player.on('play', () => {
const {videoList, activeIndex, vCourseId, course = {}} = this.state const {videoList, activeIndex, vCourseId, course = {}} = this.state
// 当视频播放时 看是否是第一次播放(初次进入页面 刷新页面 切换视频 都是第一次播放 需要获取上次的播放时间) // 当视频播放时 看是否是第一次播放(初次进入页面 刷新页面 切换视频 都是第一次播放 需要获取上次的播放时间)
...@@ -566,9 +525,6 @@ class Video extends Component { ...@@ -566,9 +525,6 @@ class Video extends Component {
clearInterval(this.timer); clearInterval(this.timer);
this.timer = null; this.timer = null;
}) })
this.player.on('seeked', () => {
this.sendRecord()
})
} }
sendLastRecord = () => { sendLastRecord = () => {
......
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