From dfaa65c7a2563e5b6241b462eb207d8d18c22905 Mon Sep 17 00:00:00 2001 From: "@fawn-nine" <1271023382@qq.com> Date: Tue, 23 Jul 2024 16:24:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commonComponents/video/index.vue | 62 +++++-------------- 1 file changed, 15 insertions(+), 47 deletions(-) diff --git a/pages/component/commonComponents/video/index.vue b/pages/component/commonComponents/video/index.vue index 4387abe..296a747 100644 --- a/pages/component/commonComponents/video/index.vue +++ b/pages/component/commonComponents/video/index.vue @@ -167,18 +167,8 @@ // 退出全屏 const ctx = this.$refs.myVideo; ctx.exitFullScreen(); - }, - // 播放进度改变 - // videoTimeUpdateEvent(e) { - // this.playTime = parseInt(e.detail.currentTime); - // this.currentTime = parseInt(e.detail.currentTime); - - // this.allTime = parseInt(e.detail.duration); - - // this.recordTime({ - // time: this.playTime, - // }); - // }, + }, + // async init(data, isChange) { this.show = false; this.platform = this.$platform; @@ -248,6 +238,7 @@ }); }); }, + // 配置播放项 async getData(data, isChange) { var that = this; if (!this.isSetFirstTime) { @@ -289,10 +280,7 @@ } this.isSetFirstTime = true; }, - async playVideo(e) { - this.videoContext = uni.createVideoContext("videoId", this); - this.videoContext.seek(this.firstTime); - }, + // 存储本地播放时间 recordTime(data) { // console.log('recordTime',data.time); this.currentTime = data.time; @@ -301,9 +289,7 @@ if (uni.getStorageSync("videoOssList")) { list = JSON.parse(uni.getStorageSync("videoOssList")); } - - var index = list.findIndex((e) => e.id == this.videoData.id); - // console.log('recordTime------',index,list ); + var index = list.findIndex((e) => e.id == this.videoData.id); if (list.length > 0 && index >= 0) { list[index] = { @@ -316,10 +302,9 @@ time: data.time, }); } - uni.setStorageSync("videoOssList", JSON.stringify(list)); }, - // 获取数据 + // 获取播放凭证 async getLive(isChange) { var that = this; this.isfresh = false; @@ -385,13 +370,10 @@ that.$forceUpdate(); }); }, - async handleEnd() { - // console.log('进来了吗,handleEnd') - console.log("找到了吗????",this.videoData.id); + + async handleEnd() { var list = JSON.parse(uni.getStorageSync("videoOssList")); - var data = list.find((e) => e.id == this.videoData.id); - console.log("找到了吗????"); - // data.time ? this.currentTime = data.time : this.currentTime = 0; + var data = list.find((e) => e.id == this.videoData.id); this.currentTime = data.time; console.log( "this.currentTime at line 这是结束的时候掉的存储视频:", @@ -401,12 +383,14 @@ clearInterval(this.$store.state.videoTimer); this.timer = null; }, + // 存储时长到线上 setVideoTime(time) { var data = {}; console.log("是否走了存储视屏," + this.videoData.id, this.currentTime); var data = { videoId: this.videoData.id, position: this.currentTime, //秒数 + loadAnimate: 'none', }; $http @@ -433,7 +417,7 @@ delta: 1, }); }, - + // 设置初始播放时间 并开启定时器 async setVideoFirtsetTime(time) { this.currentTime = this.firstTime; console.log("这里准备开始设置播放时间:", this.currentTime); @@ -738,23 +722,11 @@ source: this.videoData.videoUrl } console.log('这是没有加密的视频'); - } + } var player = new Aliplayer(playerOptions, function(player) {}); this.player = player; - console.log('是否拿到第一次初始值呢', this.platform, typeof this.firstTime, this.firstTime) - // if (this.platform == 'ios') { - - // this.player.one('timeupdate', () => { - // this.player.seek(this.firstTime); - // }) - - // } else { - // // if(player){ - // this.player.seek(this.firstTime) - // // } - - // } + console.log('是否拿到第一次初始值呢', this.platform, typeof this.firstTime, this.firstTime) clearInterval(this.videoTimer); @@ -763,8 +735,6 @@ var that = this; that.curTime = parseInt(this.player.getCurrentTime()); that.curStatus = this.player.getStatus() - - }, 1000); this.$refs.videoContent4.click() player.on('ready', function() { @@ -777,9 +747,7 @@ this.player.on('playing', function() { console.log('正在播放') }) - this.player.on('ended', function() { - // console.log('that.curTime at line 242:', this.curTime) - // console.log('that.curStatus at line 210:', this.curStatus) + this.player.on('ended', function() { this.$refs.videoContent2.click() }) },