mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-08 02:16:43 +08:00
修改视频时长的拖拽计时问题
This commit is contained in:
@@ -292,6 +292,8 @@ export default {
|
||||
fullTimeFormat: "00:00:00", // 视频总长度的文字
|
||||
barrageTimelineStart: 0, // 弹幕时间轴的起始时间点(手动调整进度条触发更新)
|
||||
isInit:false, // 是否初始化过
|
||||
videoTime:0,
|
||||
oldVideoTime:0,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -376,6 +378,9 @@ export default {
|
||||
this.videoDom.pause();
|
||||
this.isPlaying = false;
|
||||
this.$emit('onPlayerPause', {})//暂停(暂停时调用)
|
||||
// 清楚记录的时间
|
||||
this.videoTime = 0
|
||||
this.oldVideoTime = 0
|
||||
}
|
||||
this.isShowCover = false;
|
||||
},
|
||||
@@ -551,12 +556,23 @@ export default {
|
||||
},
|
||||
currentProgress: function () {
|
||||
// 进度条到终点时修改播放状态
|
||||
//console.log('播放中', this.videoDom.currentTime)
|
||||
this.$emit('onPlayerPlaying', this.videoDom.currentTime,this.videoDom.duration)
|
||||
if (this.currentProgress === 1) {
|
||||
this.isPlaying = false;
|
||||
this.$emit('onPlayerEnded', {})
|
||||
}
|
||||
// 拉伸进度条计时长
|
||||
if(this.isPlaying){
|
||||
this.videoTime = this.videoDom.currentTime
|
||||
let sendTime = this.videoTime -this.oldVideoTime
|
||||
// console.log('sendTime', sendTime)
|
||||
// 超过两秒就算是拉进度了
|
||||
if(sendTime > 2 && this.oldVideoTime !== 0){
|
||||
console.log('开始计时发送sendTime',sendTime);
|
||||
this.$emit('onPlayerSendTime', sendTime)
|
||||
}
|
||||
this.oldVideoTime = this.videoDom.currentTime
|
||||
}
|
||||
},
|
||||
// notePlay: function(val) {
|
||||
// if(val) {
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<videoPlayer ref="myVideoPlayer" id="myVideoPlayer" :src="blobUrl" @onPlayerPlaying="onPlayerPlaying"
|
||||
:initTime="contentData.lastStudyTime" :notePlay="notePlay" @onPlayerPlay="onPlayerPlay"
|
||||
:isDrag="curriculumData.isDrag" @onFullscreen="onFullscreen" @onPlayerPause="onPlayerPause"
|
||||
@onPlayerEnded="onPlayerEnded" :isCrowd="isCrowd"></videoPlayer>
|
||||
@onPlayerEnded="onPlayerEnded" :isCrowd="isCrowd" @onPlayerSendTime="onPlayerSendTime"></videoPlayer>
|
||||
<div class="player-box" v-if="playerBoxShow">
|
||||
<div class="player-praise" style="cursor: pointer;">
|
||||
<div @click="praiseContent">
|
||||
@@ -449,6 +449,28 @@
|
||||
this.stopStudyTime();
|
||||
},
|
||||
methods: {
|
||||
onPlayerSendTime(sendTime){
|
||||
console.log(sendTime,'发送的时间');
|
||||
let postData={
|
||||
"key": "StudyCourseOther",//课程学习的key
|
||||
"title": "非音视频课内容",//事件的标题
|
||||
"parameters":"second:" + Math.floor(sendTime),//second:value 本次的学习时长
|
||||
"content": "学习课程",//事件的内容
|
||||
"objId": this.courseInfo.id,//课程的id
|
||||
"objType": "1",//类型
|
||||
"source":"page",
|
||||
"objInfo": ""+this.courseInfo.name,
|
||||
"aid":this.userInfo.aid, //当前登录人的id
|
||||
"aname":this.userInfo.name,//当前人的姓名
|
||||
"status": 1 //状态
|
||||
}
|
||||
//静默处理
|
||||
apiStat.sendEvent(postData).then(rs=>{
|
||||
if(rs.status != 200) {
|
||||
console.log(rs.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
toUserHome(tea){
|
||||
this.$router.push({path:this.$xpage.getHomePath(tea.teacherId)})
|
||||
},
|
||||
@@ -471,8 +493,8 @@
|
||||
if (!this.contentData.id) {
|
||||
return;
|
||||
}
|
||||
// 跳转链接的时候不计时了
|
||||
if(resType == 50) return
|
||||
// 跳转scorm链接的时候不计时了
|
||||
if(this.resType == 50) return
|
||||
let postData={
|
||||
"key": "StudyCourseOther",//课程学习的key
|
||||
"title": "非音视频课内容",//事件的标题
|
||||
|
||||
Reference in New Issue
Block a user