From 37fe75213634cabe7928c1dfd62c3bb72f777c22 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Tue, 27 Sep 2022 16:18:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/jlmap3d/passflow/jl3dpassflow.vue | 24 +++++++++++++++---- .../newMap/jointTrainingNew/realCCTV.vue | 11 +++++---- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/views/jlmap3d/passflow/jl3dpassflow.vue b/src/views/jlmap3d/passflow/jl3dpassflow.vue index 839f67a95..21eb6b0ac 100644 --- a/src/views/jlmap3d/passflow/jl3dpassflow.vue +++ b/src/views/jlmap3d/passflow/jl3dpassflow.vue @@ -4,7 +4,7 @@
@@ -112,7 +112,7 @@ export default { { controls: false, autoplay: 'muted', - loop: true, + loop: false, preload: 'auto', width: window.innerWidth / 4 + 'px', height: window.innerHeight / 2 + 'px', @@ -122,20 +122,34 @@ export default { }, function () { console.log('videojs播放器初始化成功'); + const video = this; + // this.on('loadstart', function() { + // // 开始加载 + // console.log('loadstart'); + // }); + // this.on('loadeddata', function() { + // console.log('loadeddata'); + // }); + // this.on('seeked', function() { + // // 已经拿到视频流,可以播放 + // console.log('seeked'); + // }); this.on('loadedmetadata', function() { console.log('loadedmetadata'); // 加载到元数据后开始播放视频 // startVideo(); + video.autoplay(true); var lastTime = -1; // var tryTimes = 0; let isVideoBreak = null; clearInterval(isVideoBreak); isVideoBreak = setInterval(function() { - var currentTime = videoPlay.currentTime(); + // debugger; + var currentTime = video.currentTime(); console.log('currentTime' + currentTime + 'lastTime' + lastTime); if (currentTime == lastTime) { - videoPlay.currentTime(currentTime + 10000); - videoPlay.play(); + video.currentTime(currentTime + 10000); + video.play(); // // 尝试5次播放后,如仍未播放成功提示刷新 // if (++tryTimes > 5) { // alert('您的网速有点慢,刷新下试试'); diff --git a/src/views/newMap/jointTrainingNew/realCCTV.vue b/src/views/newMap/jointTrainingNew/realCCTV.vue index 618024175..28b79a0ba 100644 --- a/src/views/newMap/jointTrainingNew/realCCTV.vue +++ b/src/views/newMap/jointTrainingNew/realCCTV.vue @@ -42,7 +42,7 @@ export default { const videoPlay = new Video('myvideo' + i, { controls: false, autoplay: 'muted', - loop:true, + loop: false, preload: 'auto', width: window.innerWidth / 2 + 'px', height: window.innerHeight + 'px', @@ -51,20 +51,23 @@ export default { } }, function () { console.log('videojs播放器初始化成功'); + const video = this; this.on('loadedmetadata', function() { console.log('loadedmetadata'); // 加载到元数据后开始播放视频 // startVideo(); + video.autoplay(true); var lastTime = -1; // var tryTimes = 0; let isVideoBreak = null; clearInterval(isVideoBreak); isVideoBreak = setInterval(function() { - var currentTime = videoPlay.currentTime(); + // debugger; + var currentTime = video.currentTime(); console.log('currentTime' + currentTime + 'lastTime' + lastTime); if (currentTime == lastTime) { - videoPlay.currentTime(currentTime + 10000); - videoPlay.play(); + video.currentTime(currentTime + 10000); + video.play(); // // 尝试5次播放后,如仍未播放成功提示刷新 // if (++tryTimes > 5) { // alert('您的网速有点慢,刷新下试试');