diff --git a/pages/study/courseStudy.vue b/pages/study/courseStudy.vue index 07765e2..3eb7039 100644 --- a/pages/study/courseStudy.vue +++ b/pages/study/courseStudy.vue @@ -411,8 +411,6 @@ toScore:toScore, formatUserNumber:formatUserNumber, getConType:getContentType, - - isPlaying:false, onplay:false, touchNum : 0, playerBoxShow:false, @@ -430,7 +428,6 @@ sectionList:[], contentList:[], videoScore:3, - videoPlayer:null, videoPlayingTime:0, speedListShow:false, speedList:["2.0", "1.5", "1.25", "1.0", "0.75", "0.5"], @@ -518,12 +515,15 @@ //实时渲染当前的播放状态 }, onReady() { - this.videoPlayer=uni.createVideoContext("myVideo", this); + }, onHide(){ //清除定时任务 this.clearTimeHandle(); }, + destroyed() { + this.clearTimeHandle(); + }, methods:{ ...mapActions({ // getResOwnerTree:'resOwner/getResOwnerTree', @@ -783,10 +783,6 @@ this.articleMore=true; this.clearTimeHandle(); // console.log(con,'con'); - if(this.videoPlayer){ - //console.log('切换视频'); - this.videoPlayer.stop(); - } this.playerBoxShow=false; if(con.contentType==40){ //如果是文档,需要再次加载pdf @@ -1255,22 +1251,6 @@ $this.appendStudyOtherTime(); }, 1000*60); - }, - doubleClickVideo(e){ - // this.onPlayerPause() - this.touchNum ++ - setTimeout(()=>{ - if(this.touchNum == 1){ - // console.log('单击') - }else if(this.touchNum >= 2){ - if(this.isPlaying){ - this.onPlayerPause() - } else { - this.onPlayerPlay() - } - } - this.touchNum = 0 - },250) }, //先保存学习的内容,针对于音视频的内容 saveStudyItem(){ @@ -1323,32 +1303,8 @@ //console.log(e,'e'); }, - onPlayerPlay(){ - this.isPlaying = true; - this.videoPlayingTime=0; - // console.log("开始播放"); - this.playerBoxShow=false; - this.isAppendTime=true;//可以追加学习时长 - this.videoSpeed=studyUtil.getVideoSpeed(); - this.videoPlayer.playbackRate(this.videoSpeed); - this.videoPlayer.play(); - this.appendStudyTime();//开始追加学习时长 - let $this=this; - if(this.curContent.status<9){ - let completeType=this.curriculumData.completeSetup; - //console.log(completeType,'completeType'); - if(completeType==0){ - //默认5秒后学习完成. - //$this.handleTimeout= setTimeout(function() {$this.saveStudyInfo();}, 5000); //5秒后记录学习完成 - }else{ - //先记录进行中的学习内容 - this.saveStudyItem(); - } - } - }, + onPlayerPause(){ - this.isPlaying = false; - this.videoPlayer.pause(); this.stopStudyTime(); }, onPlayerEnded(){ @@ -1358,35 +1314,6 @@ this.finishStudyItem(); } }, - changeSpeed(e) { - // 获取选择的倍速 - let value = e; - this.videoSpeed = Number(value); - this.videoPlayer.playbackRate(this.videoSpeed); - studyUtil.setVideoSpeed(this.videoSpeed); - this.speedListShow=false; - }, - showSpeedCtrl(){ - if(this.speedListShow){ - this.speedListShow=false; - }else{ - this.speedListShow=true; - } - }, - formatSeconds(a) { - var hh = parseInt(a/3600); - var mm = parseInt((a-hh*3600)/60); - if(mm<10) mm = "0" + mm; - var ss = parseInt((a-hh*3600)%60); - if(ss<10) ss = "0" + ss; - if(hh<10) hh = hh == 0?'':`0${hh}:`; - var length = hh + mm + ":" + ss; - if(a>=0){ - return length; - }else{ - return "00:00"; - } - }, onPlayerPlaying(e){ //console.log("当前播放11",itme); //console.log("当前播放11"+itme);