From 3d3bceb5fac0947a35fb7200833f299296990b4f Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期二, 28 九月 2021 17:47:32 +0800
Subject: [PATCH] 视频下载与全屏

---
 src/components/wasmPlayer/wasm/player.js |    5 +++++
 src/components/wasmPlayer/wasm/webgl.js  |    2 +-
 src/components/wasmPlayer/index.vue      |   18 ++++++++++++++----
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/components/wasmPlayer/index.vue b/src/components/wasmPlayer/index.vue
index 9d6c06c..0dcf7f5 100644
--- a/src/components/wasmPlayer/index.vue
+++ b/src/components/wasmPlayer/index.vue
@@ -13,8 +13,8 @@
           v-loading="videoLoading"
           element-loading-background="rgba(0, 0, 0, 0.8)"
           style="position: unset !important"
-        ></div>
-        <canvas
+        ></div>       
+          <canvas
           ref="playCanvas"
           id="paly-canvas"
           width="960"
@@ -194,6 +194,7 @@
       isEmptyUrl: false,
       videoLoading: false,
       loadUrl:'',
+      isFullScreen:false
     }
   },
   watch: {
@@ -485,7 +486,13 @@
     },
 
     fullScreen() {
-      this.player.fullscreen()
+      if(!this.isFullScreen){
+       this.player.fullscreen()     
+      }
+      else{
+      this.player.exitfullscreen()
+      }
+      this.isFullScreen = !this.isFullScreen
     },
 
     async downLoad() {
@@ -493,7 +500,10 @@
           title: '娑堟伅',
           message: '璧勬簮涓嬭浇涓�,璇风◢鍚�...'
         });
-      let url = 'http:/'+this.loadUrl.substring(10)
+      let url = 'http://'+window.location.host+this.loadUrl
+
+     // let url = "http://localhost:8080/httpImage/192.168.20.189:6700/283,2f49bf283ad7?collection=2021-09-28-DSVAD010120190703-video"
+      console.log(url);
       let name = url.substring(url.lastIndexOf("/") + 1)      
       let responsePromise = await fetch(url)
       let blob = await responsePromise.blob()
diff --git a/src/components/wasmPlayer/wasm/player.js b/src/components/wasmPlayer/wasm/player.js
index a02ccde..307117f 100644
--- a/src/components/wasmPlayer/wasm/player.js
+++ b/src/components/wasmPlayer/wasm/player.js
@@ -173,6 +173,11 @@
   if (this.webglPlayer) this.webglPlayer.fullscreen()
 }
 
+Player.prototype.exitfullscreen = function() {
+  if (this.webglPlayer) this.webglPlayer.exitfullscreen()
+}
+
+
 Player.prototype.startTrackTimer = function() {
   var This = this
   this.trackTimer = setInterval(function() {
diff --git a/src/components/wasmPlayer/wasm/webgl.js b/src/components/wasmPlayer/wasm/webgl.js
index 7d2c0cf..b28af6a 100644
--- a/src/components/wasmPlayer/wasm/webgl.js
+++ b/src/components/wasmPlayer/wasm/webgl.js
@@ -159,7 +159,7 @@
 }
 
 WebGLPlayer.prototype.fullscreen = function() {
-  var canvas = this.canvas
+  let canvas = this.canvas.parentNode.parentNode.parentNode
   if (canvas.RequestFullScreen) {
     canvas.RequestFullScreen()
   } else if (canvas.webkitRequestFullScreen) {

--
Gitblit v1.8.0