xjzh-component 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -112,27 +112,6 @@ module.exports = {
112
112
  module.exports = {};
113
113
 
114
114
 
115
- /***/ }),
116
-
117
- /***/ 479:
118
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
119
-
120
- "use strict";
121
- __webpack_require__.r(__webpack_exports__);
122
- /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1601);
123
- /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
124
- /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6314);
125
- /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
126
- // Imports
127
-
128
-
129
- var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
130
- // Module
131
- ___CSS_LOADER_EXPORT___.push([module.id, ".video-canvas[data-v-50940904]{width:100%;height:100%;display:flex;flex-direction:column;justify-content:space-evenly;margin-top:16px}.video-canvas .itemBox[data-v-50940904]{border-radius:4px;transform:translateZ(0);margin-bottom:11px;position:relative;overflow:hidden}.video-canvas canvas[data-v-50940904]{margin:0;padding:0;width:100%;height:100%;will-change:transform;image-rendering:optimizeSpeed;image-rendering:-moz-crisp-edges;image-rendering:-o-crisp-edges;image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges}.video-canvas .full-screen[data-v-50940904]{width:100%;height:100%;position:fixed;top:0;bottom:0;left:0;right:0;z-index:999}", ""]);
132
- // Exports
133
- /* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___);
134
-
135
-
136
115
  /***/ }),
137
116
 
138
117
  /***/ 616:
@@ -407,6 +386,22 @@ var userAgent = navigator && navigator.userAgent;
407
386
  module.exports = userAgent ? String(userAgent) : '';
408
387
 
409
388
 
389
+ /***/ }),
390
+
391
+ /***/ 3008:
392
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
393
+
394
+ // style-loader: Adds some css to the DOM by adding a <style> tag
395
+
396
+ // load the styles
397
+ var content = __webpack_require__(3570);
398
+ if(content.__esModule) content = content.default;
399
+ if(typeof content === 'string') content = [[module.id, content, '']];
400
+ if(content.locals) module.exports = content.locals;
401
+ // add the styles to the DOM
402
+ var add = (__webpack_require__(9548)/* ["default"] */ .A)
403
+ var update = add("4e066afe", content, true, {"sourceMap":false,"shadowMode":false});
404
+
410
405
  /***/ }),
411
406
 
412
407
  /***/ 3392:
@@ -425,6 +420,27 @@ module.exports = function (key) {
425
420
  };
426
421
 
427
422
 
423
+ /***/ }),
424
+
425
+ /***/ 3570:
426
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
427
+
428
+ "use strict";
429
+ __webpack_require__.r(__webpack_exports__);
430
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1601);
431
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
432
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6314);
433
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
434
+ // Imports
435
+
436
+
437
+ var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
438
+ // Module
439
+ ___CSS_LOADER_EXPORT___.push([module.id, ".xjzh-img-canvas[data-v-5aa81db6]{width:100%;height:100%;display:flex;justify-content:space-evenly;align-items:center;flex-wrap:wrap}.xjzh-img-canvas .itemBox[data-v-5aa81db6]{border-radius:4px;transform:translateZ(0);position:relative;overflow:hidden}.xjzh-img-canvas .itemBox .item-title[data-v-5aa81db6]{width:30px;height:30px;padding:0;margin:0;font-size:20px;border-radius:50%;text-align:center;line-height:30px;position:absolute;left:10px;top:10px;z-index:999;background-color:#fff;color:#0076f6}.xjzh-img-canvas .itemBox canvas[data-v-5aa81db6]{margin:0;padding:0;width:100%;height:100%;will-change:transform;image-rendering:optimizeSpeed;image-rendering:-moz-crisp-edges;image-rendering:-o-crisp-edges;image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges}.xjzh-img-canvas .itemBox[data-v-5aa81db6]:last-child{margin-bottom:0}.xjzh-img-canvas .full-screen[data-v-5aa81db6]{width:100%!important;height:100%!important;position:fixed;top:0;bottom:0;left:0;right:0;z-index:999}", ""]);
440
+ // Exports
441
+ /* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___);
442
+
443
+
428
444
  /***/ }),
429
445
 
430
446
  /***/ 3706:
@@ -497,22 +513,6 @@ module.exports = function (it) {
497
513
  };
498
514
 
499
515
 
500
- /***/ }),
501
-
502
- /***/ 4185:
503
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
504
-
505
- // style-loader: Adds some css to the DOM by adding a <style> tag
506
-
507
- // load the styles
508
- var content = __webpack_require__(479);
509
- if(content.__esModule) content = content.default;
510
- if(typeof content === 'string') content = [[module.id, content, '']];
511
- if(content.locals) module.exports = content.locals;
512
- // add the styles to the DOM
513
- var add = (__webpack_require__(9548)/* ["default"] */ .A)
514
- var update = add("1237ea75", content, true, {"sourceMap":false,"shadowMode":false});
515
-
516
516
  /***/ }),
517
517
 
518
518
  /***/ 4270:
@@ -1845,12 +1845,12 @@ if (typeof window !== 'undefined') {
1845
1845
  // Indicate to webpack that this file can be concatenated
1846
1846
  /* harmony default export */ var setPublicPath = (null);
1847
1847
 
1848
- ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/babel-loader/lib/index.js!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/components/videoCanvas.vue?vue&type=template&id=50940904&scoped=true
1848
+ ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/babel-loader/lib/index.js!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/components/xjzhImgCanvas.vue?vue&type=template&id=5aa81db6&scoped=true
1849
1849
  var render = function render() {
1850
1850
  var _vm = this,
1851
1851
  _c = _vm._self._c;
1852
1852
  return _c('div', {
1853
- staticClass: "video-canvas"
1853
+ staticClass: "xjzh-img-canvas"
1854
1854
  }, _vm._l(_vm.cameraObj, function (item, index) {
1855
1855
  return _c('div', {
1856
1856
  key: index,
@@ -1886,15 +1886,15 @@ var web_url_search_params_delete = __webpack_require__(4603);
1886
1886
  var web_url_search_params_has = __webpack_require__(7566);
1887
1887
  // EXTERNAL MODULE: ./node_modules/core-js/modules/web.url-search-params.size.js
1888
1888
  var web_url_search_params_size = __webpack_require__(8721);
1889
- ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/babel-loader/lib/index.js!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/components/videoCanvas.vue?vue&type=script&lang=js
1889
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/babel-loader/lib/index.js!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/components/xjzhImgCanvas.vue?vue&type=script&lang=js
1890
1890
 
1891
1891
 
1892
1892
 
1893
1893
 
1894
1894
 
1895
1895
 
1896
- /* harmony default export */ var videoCanvasvue_type_script_lang_js = ({
1897
- name: "VideoCanvas",
1896
+ /* harmony default export */ var xjzhImgCanvasvue_type_script_lang_js = ({
1897
+ name: "XjzhImgCanvas",
1898
1898
  props: {
1899
1899
  videoUrl: {
1900
1900
  type: String,
@@ -1902,11 +1902,11 @@ var web_url_search_params_size = __webpack_require__(8721);
1902
1902
  },
1903
1903
  width: {
1904
1904
  type: String,
1905
- default: '640px'
1905
+ default: '480px'
1906
1906
  },
1907
1907
  height: {
1908
1908
  type: String,
1909
- default: '360px'
1909
+ default: '270px'
1910
1910
  },
1911
1911
  showTitle: {
1912
1912
  type: Boolean,
@@ -1915,15 +1915,15 @@ var web_url_search_params_size = __webpack_require__(8721);
1915
1915
  isSwitchSide: {
1916
1916
  type: Boolean,
1917
1917
  default: false
1918
+ },
1919
+ canvasSize: {
1920
+ type: Array,
1921
+ default: () => {
1922
+ return [1920, 1080];
1923
+ }
1918
1924
  }
1919
1925
  },
1920
1926
  watch: {
1921
- videoUrl: {
1922
- handler(val) {
1923
- console.log('object :>> ', val);
1924
- this.initWorker();
1925
- }
1926
- },
1927
1927
  isSwitchSide: {
1928
1928
  handler(val) {
1929
1929
  console.log('object :>> ', val);
@@ -1947,35 +1947,38 @@ var web_url_search_params_size = __webpack_require__(8721);
1947
1947
  currentFullScreen: '',
1948
1948
  answerPhoto: {
1949
1949
  canvas: null,
1950
- context: null,
1951
- isPhoto: false
1950
+ ctx: null,
1951
+ isPhoto: false,
1952
+ canvasSize: [1920, 1080]
1952
1953
  },
1953
- canvasSize: [1920, 1080]
1954
+ cameraObj: null
1954
1955
  };
1955
1956
  },
1956
- mounted() {},
1957
+ mounted() {
1958
+ this.initWorker();
1959
+ },
1957
1960
  methods: {
1958
1961
  initAnswerPhoto() {
1959
1962
  this.answerPhoto.canvas = document.createElement('canvas');
1960
- this.answerPhoto.context = this.answerPhoto.canvas.getContext('2d');
1963
+ this.answerPhoto.ctx = this.answerPhoto.canvas.getContext('2d');
1961
1964
  this.answerPhoto.canvas.width = this.canvasSize[0] * this.cameraNum;
1962
1965
  this.answerPhoto.canvas.height = this.canvasSize[1];
1963
1966
  },
1964
1967
  initCanvas() {
1965
1968
  for (let i = 0; i < this.cameraNum; i++) {
1966
1969
  let type = this.cameraType[i].value;
1967
- this.cameraObj[type].canvas = document.getElementById(this.cameraObj[type].domeId);
1968
- this.cameraObj[type].content = this.cameraObj[type].canvas.getContext('2d');
1970
+ this.cameraObj[type].canvas = this.$refs[this.cameraObj[type].domeId][0];
1971
+ this.cameraObj[type].ctx = this.cameraObj[type].canvas.getContext('2d');
1969
1972
  this.cameraObj[type].canvas.width = this.canvasSize[0];
1970
1973
  this.cameraObj[type].canvas.height = this.canvasSize[1];
1971
1974
  this.cameraObj[type].imgBox = new Image();
1972
- this.cameraObj[type].videoUrl = '';
1973
1975
  }
1974
1976
  },
1975
1977
  initWorker() {
1976
1978
  const url = `ws://${this.videoUrl}/socket`;
1977
1979
  let count = 0;
1978
1980
  this.destroyWorker();
1981
+ this.destroyCanvasData();
1979
1982
  this.worker = new Worker(new URL(/* worker import */ __webpack_require__.p + __webpack_require__.u(906), __webpack_require__.b));
1980
1983
  this.worker.onmessage = async event => {
1981
1984
  const {
@@ -1988,35 +1991,43 @@ var web_url_search_params_size = __webpack_require__(8721);
1988
1991
  if (type === 'message') {
1989
1992
  if (typeof data === 'number') {
1990
1993
  this.cameraNum = data;
1991
- localStorage.setItem('cameraNum', this.cameraNum);
1992
1994
  for (let i = 0; i < this.cameraNum; i++) {
1993
- this.cameraObj[this.cameraType[i].value] = {
1994
- domeId: `canvas_${this.cameraType[i].value}`,
1995
+ let typeVal = this.cameraType[i].value;
1996
+ this.cameraObj[typeVal] = {
1997
+ domeId: `canvas_${typeVal}`,
1998
+ title: this.cameraType[i].label,
1999
+ // 摄像头名称
1995
2000
  canvas: null,
1996
- content: null,
1997
- videoUrl: '',
2001
+ ctx: null,
1998
2002
  totalFPS: 0,
2003
+ // 单个摄像头 - 收到总帧数
1999
2004
  showTotalFPS: 0,
2000
- frameSkip: 1,
2005
+ // 单个摄像头 - 渲染总帧数
2006
+ frameSkip: 0,
2007
+ // 单个摄像头 - 跳帧 1(30),2(15),3(10)
2008
+
2001
2009
  imgBox: null,
2010
+ allUrl: [],
2011
+ // 所有图片地址
2002
2012
  isLoading: false,
2003
- isFullScreen: false,
2004
- title: this.cameraType[i].label
2013
+ // 图片是否加载完
2014
+ isFullScreen: false // 画面是否全屏
2005
2015
  };
2006
2016
  }
2017
+ this.$forceUpdate();
2018
+ // 根据摄像头数量,初始化画布
2007
2019
  this.$nextTick(() => {
2008
2020
  this.initAnswerPhoto();
2009
2021
  this.initCanvas();
2010
2022
  });
2011
2023
  return;
2012
2024
  }
2025
+
2026
+ // 摄像头画面渲染
2013
2027
  count++;
2014
2028
  this.showCanvas(this.cameraType[count - 1].value, data);
2015
2029
  count = count >= this.cameraNum ? 0 : count;
2016
2030
  }
2017
- if (type === 'message') {
2018
- console.log('WebSocket open:');
2019
- }
2020
2031
  if (type === 'close') {
2021
2032
  console.log('WebSocket closed:', wsEvent);
2022
2033
  }
@@ -2040,61 +2051,110 @@ var web_url_search_params_size = __webpack_require__(8721);
2040
2051
  this.worker = null;
2041
2052
  }
2042
2053
  },
2043
- showVideoCanvas(type, blod) {
2044
- // 当其中一个全屏时,其它画面不做渲染操作,并且清理其他缓存
2054
+ showCanvas(type, blod) {
2055
+ this.cameraObj[type].totalFPS++;
2056
+ if (!this.cameraObj[type] || !this.cameraObj[type].imgBox || !this.cameraObj[type].ctx) {
2057
+ return;
2058
+ }
2045
2059
  if (this.currentFullScreen && this.currentFullScreen !== type) {
2046
- if (this.cameraObj[type].videoUrl) {
2047
- URL.revokeObjectURL(this.cameraObj[type].videoUrl);
2048
- this.cameraObj[type].videoUrl = '';
2049
- }
2060
+ this.destroyUrl(type);
2050
2061
  return;
2051
2062
  }
2052
2063
  if (this.cameraObj[type].isLoading) return;
2053
- this.cameraObj[type].videoUrl = URL.createObjectURL(blod);
2054
2064
  this.cameraObj[type].isLoading = true;
2055
- this.cameraObj[type].imgBox.src = this.cameraObj[type].videoUrl;
2065
+ this.cameraObj[type].allUrl.unshift(URL.createObjectURL(blod));
2066
+ this.cameraObj[type].imgBox.src = this.cameraObj[type].allUrl[0];
2056
2067
  this.cameraObj[type].imgBox.onload = () => {
2068
+ if (!this.cameraObj[type].ctx) return;
2069
+ this.cameraObj[type].ctx.drawImage(this.cameraObj[type].imgBox, 0, 0, this.canvasSize[0], this.canvasSize[1]);
2057
2070
  this.cameraObj[type].isLoading = false;
2058
- this.cameraObj[type].content.drawImage(this.cameraObj[type].imgBox, 0, 0, this.canvasSize[0], this.canvasSize[1]);
2059
- if (this.cameraObj[type].videoUrl) {
2060
- URL.revokeObjectURL(this.cameraObj[type].videoUrl);
2061
- this.cameraObj[type].videoUrl = '';
2071
+ if (this.answerPhoto.isPhoto) {
2072
+ // 拍照使用
2073
+ if (this.cameraNum > 0) {
2074
+ this.answerPhoto.ctx.drawImage(this.cameraObj.main.imgBox, this.answerPhoto.canvasSize[0] * 0, 0, this.answerPhoto.canvasSize[0], this.answerPhoto.canvasSize[1]);
2075
+ }
2076
+ if (this.cameraNum > 1) {
2077
+ this.answerPhoto.ctx.drawImage(this.cameraObj.sub.imgBox, this.answerPhoto.canvasSize[0] * 1, 0, this.answerPhoto.canvasSize[0], this.answerPhoto.canvasSize[1]);
2078
+ }
2079
+ if (this.cameraNum > 2) {
2080
+ this.answerPhoto.ctx.drawImage(this.cameraObj.side.imgBox, this.answerPhoto.canvasSize[0] * 2, 0, this.answerPhoto.canvasSize[0], this.answerPhoto.canvasSize[1]);
2081
+ }
2082
+ return;
2062
2083
  }
2084
+ // 清除内存
2085
+ this.cameraObj[type].imgBox.src = '';
2086
+ this.destroyUrl(type, this.cameraObj[type].maxUrlNum);
2063
2087
  };
2064
2088
  this.cameraObj[type].imgBox.onerror = () => {
2065
2089
  this.cameraObj[type].isLoading = false;
2066
- // 清除内存
2067
- if (this.cameraObj[type].videoUrl) {
2068
- URL.revokeObjectURL(this.cameraObj[type].videoUrl);
2069
- this.cameraObj[type].videoUrl = '';
2070
- }
2090
+ if (!this.cameraObj[type] || !this.cameraObj[type].imgBox) return;
2091
+ this.cameraObj[type].imgBox.src = '';
2092
+ this.destroyUrl(type, this.cameraObj[type].maxUrlNum);
2071
2093
  };
2072
2094
  },
2073
- AllPhoto() {
2074
- let type = this.cameraType[this.cameraNum - 1].value;
2075
- this.videoObj.videoSrc = this.cameraObj[type].canvas.toDataURL('image/jpeg');
2076
- return this.videoObj.videoSrc;
2095
+ handleScreen(type) {
2096
+ this.$set(this.cameraObj[type], 'isFullScreen', !this.cameraObj[type].isFullScreen);
2097
+ this.currentFullScreen = this.cameraObj[type].isFullScreen ? type : '';
2098
+ this.$forceUpdate();
2077
2099
  },
2100
+ destroyCanvasData() {
2101
+ for (let i = 0; i < this.cameraNum; i++) {
2102
+ let type = this.cameraType[i].value;
2103
+ this.destroyUrl(type);
2104
+ this.destroyCanvas(type);
2105
+ }
2106
+ },
2107
+ destroyUrl(type) {
2108
+ for (let i = 0; i < this.cameraObj[type].allUrl.length; i++) {
2109
+ URL.revokeObjectURL(this.cameraObj[type].allUrl[i]);
2110
+ delete this.cameraObj[type].allUrl[i];
2111
+ }
2112
+ this.cameraObj[type].allUrl = [];
2113
+ },
2114
+ destroyCanvas(type) {
2115
+ if (!this.cameraObj[type]) return;
2116
+ for (let key in this.cameraObj[type]) {
2117
+ if (typeof this.cameraObj[type][key] == 'object') {
2118
+ this.cameraObj[type][key] = '';
2119
+ }
2120
+ delete this.cameraObj[type][key];
2121
+ }
2122
+ },
2123
+ // 所有摄像头横向照片
2124
+ allPhoto() {
2125
+ this.answerPhoto.isPhoto = true;
2126
+ let startTime = new Date().getTime();
2127
+ return new Promise(resolve => {
2128
+ setTimeout(() => {
2129
+ resolve(this.answerPhoto.canvas.toDataURL('image/jpeg'));
2130
+ let endTime = new Date().getTime();
2131
+ let second = (endTime - startTime) / 1000;
2132
+ this.cameraObj.main.totalFPS = this.cameraObj.main.totalFPS + ~~(second * 30);
2133
+ this.cameraObj.sub.totalFPS = this.cameraObj.sub.totalFPS + ~~(second * 30);
2134
+ this.cameraObj.side.totalFPS = this.cameraObj.side.totalFPS + ~~(second * 30);
2135
+ this.answerPhoto.isPhoto = false;
2136
+ }, 200);
2137
+ });
2138
+ },
2139
+ // 单个摄像头照片
2078
2140
  selectPhoto(num) {
2079
2141
  let type = this.cameraType[num - 1].value;
2080
2142
  this.videoObj.videoMergeSrc = this.cameraObj[type].canvas.toDataURL('image/jpeg');
2081
2143
  return this.videoObj.videoMergeSrc;
2082
- },
2083
- handleScreen(type) {
2084
- this.$set(this.cameraObj[type], 'isFullScreen', !this.cameraObj[type].isFullScreen);
2085
- this.currentFullScreen = this.cameraObj[type].isFullScreen ? type : '';
2086
2144
  }
2087
2145
  },
2088
2146
  beforeDestroy() {
2089
2147
  this.answerPhoto.canvas = null;
2090
- this.answerPhoto.context = null;
2148
+ this.answerPhoto.ctx = null;
2149
+ this.destroyWorker();
2150
+ this.destroyCanvasData();
2091
2151
  }
2092
2152
  });
2093
- ;// ./packages/components/videoCanvas.vue?vue&type=script&lang=js
2094
- /* harmony default export */ var components_videoCanvasvue_type_script_lang_js = (videoCanvasvue_type_script_lang_js);
2095
- // EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[4]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/components/videoCanvas.vue?vue&type=style&index=0&id=50940904&prod&lang=scss&scoped=true
2096
- var videoCanvasvue_type_style_index_0_id_50940904_prod_lang_scss_scoped_true = __webpack_require__(4185);
2097
- ;// ./packages/components/videoCanvas.vue?vue&type=style&index=0&id=50940904&prod&lang=scss&scoped=true
2153
+ ;// ./packages/components/xjzhImgCanvas.vue?vue&type=script&lang=js
2154
+ /* harmony default export */ var components_xjzhImgCanvasvue_type_script_lang_js = (xjzhImgCanvasvue_type_script_lang_js);
2155
+ // EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[4]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/components/xjzhImgCanvas.vue?vue&type=style&index=0&id=5aa81db6&prod&lang=scss&scoped=true
2156
+ var xjzhImgCanvasvue_type_style_index_0_id_5aa81db6_prod_lang_scss_scoped_true = __webpack_require__(3008);
2157
+ ;// ./packages/components/xjzhImgCanvas.vue?vue&type=style&index=0&id=5aa81db6&prod&lang=scss&scoped=true
2098
2158
 
2099
2159
  ;// ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
2100
2160
  /* globals __VUE_SSR_CONTEXT__ */
@@ -2194,7 +2254,7 @@ function normalizeComponent(
2194
2254
  }
2195
2255
  }
2196
2256
 
2197
- ;// ./packages/components/videoCanvas.vue
2257
+ ;// ./packages/components/xjzhImgCanvas.vue
2198
2258
 
2199
2259
 
2200
2260
 
@@ -2204,17 +2264,17 @@ function normalizeComponent(
2204
2264
  /* normalize component */
2205
2265
 
2206
2266
  var component = normalizeComponent(
2207
- components_videoCanvasvue_type_script_lang_js,
2267
+ components_xjzhImgCanvasvue_type_script_lang_js,
2208
2268
  render,
2209
2269
  staticRenderFns,
2210
2270
  false,
2211
2271
  null,
2212
- "50940904",
2272
+ "5aa81db6",
2213
2273
  null
2214
2274
 
2215
2275
  )
2216
2276
 
2217
- /* harmony default export */ var videoCanvas = (component.exports);
2277
+ /* harmony default export */ var xjzhImgCanvas = (component.exports);
2218
2278
  ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/babel-loader/lib/index.js!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/components/videoRtsp.vue?vue&type=template&id=345d94c7
2219
2279
  var videoRtspvue_type_template_id_345d94c7_render = function render() {
2220
2280
  var _vm = this,
@@ -2293,7 +2353,7 @@ var videoWebGl_component = normalizeComponent(
2293
2353
 
2294
2354
 
2295
2355
 
2296
- const components = [videoCanvas, videoRtsp, videoWebGl];
2356
+ const components = [xjzhImgCanvas, videoRtsp, videoWebGl];
2297
2357
  const install = function (Vue) {
2298
2358
  if (install.installed) return;
2299
2359
  components.map(component => Vue.component(component.name, component));
@@ -281,6 +281,27 @@ var uncurryThis = __webpack_require__(9504);
281
281
  module.exports = uncurryThis({}.isPrototypeOf);
282
282
 
283
283
 
284
+ /***/ }),
285
+
286
+ /***/ 1762:
287
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
288
+
289
+ "use strict";
290
+ __webpack_require__.r(__webpack_exports__);
291
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1601);
292
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
293
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6314);
294
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
295
+ // Imports
296
+
297
+
298
+ var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
299
+ // Module
300
+ ___CSS_LOADER_EXPORT___.push([module.id, ".xjzh-img-canvas[data-v-5aa81db6]{width:100%;height:100%;display:flex;justify-content:space-evenly;align-items:center;flex-wrap:wrap}.xjzh-img-canvas .itemBox[data-v-5aa81db6]{border-radius:4px;transform:translateZ(0);position:relative;overflow:hidden}.xjzh-img-canvas .itemBox .item-title[data-v-5aa81db6]{width:30px;height:30px;padding:0;margin:0;font-size:20px;border-radius:50%;text-align:center;line-height:30px;position:absolute;left:10px;top:10px;z-index:999;background-color:#fff;color:#0076f6}.xjzh-img-canvas .itemBox canvas[data-v-5aa81db6]{margin:0;padding:0;width:100%;height:100%;will-change:transform;image-rendering:optimizeSpeed;image-rendering:-moz-crisp-edges;image-rendering:-o-crisp-edges;image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges}.xjzh-img-canvas .itemBox[data-v-5aa81db6]:last-child{margin-bottom:0}.xjzh-img-canvas .full-screen[data-v-5aa81db6]{width:100%!important;height:100%!important;position:fixed;top:0;bottom:0;left:0;right:0;z-index:999}", ""]);
301
+ // Exports
302
+ /* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___);
303
+
304
+
284
305
  /***/ }),
285
306
 
286
307
  /***/ 2106:
@@ -620,19 +641,19 @@ if (params + '' !== 'a=2') {
620
641
 
621
642
  /***/ }),
622
643
 
623
- /***/ 4707:
644
+ /***/ 4710:
624
645
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
625
646
 
626
647
  // style-loader: Adds some css to the DOM by adding a <style> tag
627
648
 
628
649
  // load the styles
629
- var content = __webpack_require__(5807);
650
+ var content = __webpack_require__(1762);
630
651
  if(content.__esModule) content = content.default;
631
652
  if(typeof content === 'string') content = [[module.id, content, '']];
632
653
  if(content.locals) module.exports = content.locals;
633
654
  // add the styles to the DOM
634
655
  var add = (__webpack_require__(9548)/* ["default"] */ .A)
635
- var update = add("59b0a0b9", content, true, {"sourceMap":false,"shadowMode":false});
656
+ var update = add("21f25f42", content, true, {"sourceMap":false,"shadowMode":false});
636
657
 
637
658
  /***/ }),
638
659
 
@@ -720,27 +741,6 @@ module.exports = function (key, value) {
720
741
  };
721
742
 
722
743
 
723
- /***/ }),
724
-
725
- /***/ 5807:
726
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
727
-
728
- "use strict";
729
- __webpack_require__.r(__webpack_exports__);
730
- /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1601);
731
- /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
732
- /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6314);
733
- /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
734
- // Imports
735
-
736
-
737
- var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
738
- // Module
739
- ___CSS_LOADER_EXPORT___.push([module.id, ".video-canvas[data-v-50940904]{width:100%;height:100%;display:flex;flex-direction:column;justify-content:space-evenly;margin-top:16px}.video-canvas .itemBox[data-v-50940904]{border-radius:4px;transform:translateZ(0);margin-bottom:11px;position:relative;overflow:hidden}.video-canvas canvas[data-v-50940904]{margin:0;padding:0;width:100%;height:100%;will-change:transform;image-rendering:optimizeSpeed;image-rendering:-moz-crisp-edges;image-rendering:-o-crisp-edges;image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges}.video-canvas .full-screen[data-v-50940904]{width:100%;height:100%;position:fixed;top:0;bottom:0;left:0;right:0;z-index:999}", ""]);
740
- // Exports
741
- /* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___);
742
-
743
-
744
744
  /***/ }),
745
745
 
746
746
  /***/ 5917:
@@ -1855,12 +1855,12 @@ if (typeof window !== 'undefined') {
1855
1855
  // Indicate to webpack that this file can be concatenated
1856
1856
  /* harmony default export */ var setPublicPath = (null);
1857
1857
 
1858
- ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/babel-loader/lib/index.js!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/components/videoCanvas.vue?vue&type=template&id=50940904&scoped=true
1858
+ ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/babel-loader/lib/index.js!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/components/xjzhImgCanvas.vue?vue&type=template&id=5aa81db6&scoped=true
1859
1859
  var render = function render() {
1860
1860
  var _vm = this,
1861
1861
  _c = _vm._self._c;
1862
1862
  return _c('div', {
1863
- staticClass: "video-canvas"
1863
+ staticClass: "xjzh-img-canvas"
1864
1864
  }, _vm._l(_vm.cameraObj, function (item, index) {
1865
1865
  return _c('div', {
1866
1866
  key: index,
@@ -1896,15 +1896,15 @@ var web_url_search_params_delete = __webpack_require__(4603);
1896
1896
  var web_url_search_params_has = __webpack_require__(7566);
1897
1897
  // EXTERNAL MODULE: ./node_modules/core-js/modules/web.url-search-params.size.js
1898
1898
  var web_url_search_params_size = __webpack_require__(8721);
1899
- ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/babel-loader/lib/index.js!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/components/videoCanvas.vue?vue&type=script&lang=js
1899
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/babel-loader/lib/index.js!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/components/xjzhImgCanvas.vue?vue&type=script&lang=js
1900
1900
 
1901
1901
 
1902
1902
 
1903
1903
 
1904
1904
 
1905
1905
 
1906
- /* harmony default export */ var videoCanvasvue_type_script_lang_js = ({
1907
- name: "VideoCanvas",
1906
+ /* harmony default export */ var xjzhImgCanvasvue_type_script_lang_js = ({
1907
+ name: "XjzhImgCanvas",
1908
1908
  props: {
1909
1909
  videoUrl: {
1910
1910
  type: String,
@@ -1912,11 +1912,11 @@ var web_url_search_params_size = __webpack_require__(8721);
1912
1912
  },
1913
1913
  width: {
1914
1914
  type: String,
1915
- default: '640px'
1915
+ default: '480px'
1916
1916
  },
1917
1917
  height: {
1918
1918
  type: String,
1919
- default: '360px'
1919
+ default: '270px'
1920
1920
  },
1921
1921
  showTitle: {
1922
1922
  type: Boolean,
@@ -1925,15 +1925,15 @@ var web_url_search_params_size = __webpack_require__(8721);
1925
1925
  isSwitchSide: {
1926
1926
  type: Boolean,
1927
1927
  default: false
1928
+ },
1929
+ canvasSize: {
1930
+ type: Array,
1931
+ default: () => {
1932
+ return [1920, 1080];
1933
+ }
1928
1934
  }
1929
1935
  },
1930
1936
  watch: {
1931
- videoUrl: {
1932
- handler(val) {
1933
- console.log('object :>> ', val);
1934
- this.initWorker();
1935
- }
1936
- },
1937
1937
  isSwitchSide: {
1938
1938
  handler(val) {
1939
1939
  console.log('object :>> ', val);
@@ -1957,35 +1957,38 @@ var web_url_search_params_size = __webpack_require__(8721);
1957
1957
  currentFullScreen: '',
1958
1958
  answerPhoto: {
1959
1959
  canvas: null,
1960
- context: null,
1961
- isPhoto: false
1960
+ ctx: null,
1961
+ isPhoto: false,
1962
+ canvasSize: [1920, 1080]
1962
1963
  },
1963
- canvasSize: [1920, 1080]
1964
+ cameraObj: null
1964
1965
  };
1965
1966
  },
1966
- mounted() {},
1967
+ mounted() {
1968
+ this.initWorker();
1969
+ },
1967
1970
  methods: {
1968
1971
  initAnswerPhoto() {
1969
1972
  this.answerPhoto.canvas = document.createElement('canvas');
1970
- this.answerPhoto.context = this.answerPhoto.canvas.getContext('2d');
1973
+ this.answerPhoto.ctx = this.answerPhoto.canvas.getContext('2d');
1971
1974
  this.answerPhoto.canvas.width = this.canvasSize[0] * this.cameraNum;
1972
1975
  this.answerPhoto.canvas.height = this.canvasSize[1];
1973
1976
  },
1974
1977
  initCanvas() {
1975
1978
  for (let i = 0; i < this.cameraNum; i++) {
1976
1979
  let type = this.cameraType[i].value;
1977
- this.cameraObj[type].canvas = document.getElementById(this.cameraObj[type].domeId);
1978
- this.cameraObj[type].content = this.cameraObj[type].canvas.getContext('2d');
1980
+ this.cameraObj[type].canvas = this.$refs[this.cameraObj[type].domeId][0];
1981
+ this.cameraObj[type].ctx = this.cameraObj[type].canvas.getContext('2d');
1979
1982
  this.cameraObj[type].canvas.width = this.canvasSize[0];
1980
1983
  this.cameraObj[type].canvas.height = this.canvasSize[1];
1981
1984
  this.cameraObj[type].imgBox = new Image();
1982
- this.cameraObj[type].videoUrl = '';
1983
1985
  }
1984
1986
  },
1985
1987
  initWorker() {
1986
1988
  const url = `ws://${this.videoUrl}/socket`;
1987
1989
  let count = 0;
1988
1990
  this.destroyWorker();
1991
+ this.destroyCanvasData();
1989
1992
  this.worker = new Worker(new URL(/* worker import */ __webpack_require__.p + __webpack_require__.u(600), __webpack_require__.b));
1990
1993
  this.worker.onmessage = async event => {
1991
1994
  const {
@@ -1998,35 +2001,43 @@ var web_url_search_params_size = __webpack_require__(8721);
1998
2001
  if (type === 'message') {
1999
2002
  if (typeof data === 'number') {
2000
2003
  this.cameraNum = data;
2001
- localStorage.setItem('cameraNum', this.cameraNum);
2002
2004
  for (let i = 0; i < this.cameraNum; i++) {
2003
- this.cameraObj[this.cameraType[i].value] = {
2004
- domeId: `canvas_${this.cameraType[i].value}`,
2005
+ let typeVal = this.cameraType[i].value;
2006
+ this.cameraObj[typeVal] = {
2007
+ domeId: `canvas_${typeVal}`,
2008
+ title: this.cameraType[i].label,
2009
+ // 摄像头名称
2005
2010
  canvas: null,
2006
- content: null,
2007
- videoUrl: '',
2011
+ ctx: null,
2008
2012
  totalFPS: 0,
2013
+ // 单个摄像头 - 收到总帧数
2009
2014
  showTotalFPS: 0,
2010
- frameSkip: 1,
2015
+ // 单个摄像头 - 渲染总帧数
2016
+ frameSkip: 0,
2017
+ // 单个摄像头 - 跳帧 1(30),2(15),3(10)
2018
+
2011
2019
  imgBox: null,
2020
+ allUrl: [],
2021
+ // 所有图片地址
2012
2022
  isLoading: false,
2013
- isFullScreen: false,
2014
- title: this.cameraType[i].label
2023
+ // 图片是否加载完
2024
+ isFullScreen: false // 画面是否全屏
2015
2025
  };
2016
2026
  }
2027
+ this.$forceUpdate();
2028
+ // 根据摄像头数量,初始化画布
2017
2029
  this.$nextTick(() => {
2018
2030
  this.initAnswerPhoto();
2019
2031
  this.initCanvas();
2020
2032
  });
2021
2033
  return;
2022
2034
  }
2035
+
2036
+ // 摄像头画面渲染
2023
2037
  count++;
2024
2038
  this.showCanvas(this.cameraType[count - 1].value, data);
2025
2039
  count = count >= this.cameraNum ? 0 : count;
2026
2040
  }
2027
- if (type === 'message') {
2028
- console.log('WebSocket open:');
2029
- }
2030
2041
  if (type === 'close') {
2031
2042
  console.log('WebSocket closed:', wsEvent);
2032
2043
  }
@@ -2050,61 +2061,110 @@ var web_url_search_params_size = __webpack_require__(8721);
2050
2061
  this.worker = null;
2051
2062
  }
2052
2063
  },
2053
- showVideoCanvas(type, blod) {
2054
- // 当其中一个全屏时,其它画面不做渲染操作,并且清理其他缓存
2064
+ showCanvas(type, blod) {
2065
+ this.cameraObj[type].totalFPS++;
2066
+ if (!this.cameraObj[type] || !this.cameraObj[type].imgBox || !this.cameraObj[type].ctx) {
2067
+ return;
2068
+ }
2055
2069
  if (this.currentFullScreen && this.currentFullScreen !== type) {
2056
- if (this.cameraObj[type].videoUrl) {
2057
- URL.revokeObjectURL(this.cameraObj[type].videoUrl);
2058
- this.cameraObj[type].videoUrl = '';
2059
- }
2070
+ this.destroyUrl(type);
2060
2071
  return;
2061
2072
  }
2062
2073
  if (this.cameraObj[type].isLoading) return;
2063
- this.cameraObj[type].videoUrl = URL.createObjectURL(blod);
2064
2074
  this.cameraObj[type].isLoading = true;
2065
- this.cameraObj[type].imgBox.src = this.cameraObj[type].videoUrl;
2075
+ this.cameraObj[type].allUrl.unshift(URL.createObjectURL(blod));
2076
+ this.cameraObj[type].imgBox.src = this.cameraObj[type].allUrl[0];
2066
2077
  this.cameraObj[type].imgBox.onload = () => {
2078
+ if (!this.cameraObj[type].ctx) return;
2079
+ this.cameraObj[type].ctx.drawImage(this.cameraObj[type].imgBox, 0, 0, this.canvasSize[0], this.canvasSize[1]);
2067
2080
  this.cameraObj[type].isLoading = false;
2068
- this.cameraObj[type].content.drawImage(this.cameraObj[type].imgBox, 0, 0, this.canvasSize[0], this.canvasSize[1]);
2069
- if (this.cameraObj[type].videoUrl) {
2070
- URL.revokeObjectURL(this.cameraObj[type].videoUrl);
2071
- this.cameraObj[type].videoUrl = '';
2081
+ if (this.answerPhoto.isPhoto) {
2082
+ // 拍照使用
2083
+ if (this.cameraNum > 0) {
2084
+ this.answerPhoto.ctx.drawImage(this.cameraObj.main.imgBox, this.answerPhoto.canvasSize[0] * 0, 0, this.answerPhoto.canvasSize[0], this.answerPhoto.canvasSize[1]);
2085
+ }
2086
+ if (this.cameraNum > 1) {
2087
+ this.answerPhoto.ctx.drawImage(this.cameraObj.sub.imgBox, this.answerPhoto.canvasSize[0] * 1, 0, this.answerPhoto.canvasSize[0], this.answerPhoto.canvasSize[1]);
2088
+ }
2089
+ if (this.cameraNum > 2) {
2090
+ this.answerPhoto.ctx.drawImage(this.cameraObj.side.imgBox, this.answerPhoto.canvasSize[0] * 2, 0, this.answerPhoto.canvasSize[0], this.answerPhoto.canvasSize[1]);
2091
+ }
2092
+ return;
2072
2093
  }
2094
+ // 清除内存
2095
+ this.cameraObj[type].imgBox.src = '';
2096
+ this.destroyUrl(type, this.cameraObj[type].maxUrlNum);
2073
2097
  };
2074
2098
  this.cameraObj[type].imgBox.onerror = () => {
2075
2099
  this.cameraObj[type].isLoading = false;
2076
- // 清除内存
2077
- if (this.cameraObj[type].videoUrl) {
2078
- URL.revokeObjectURL(this.cameraObj[type].videoUrl);
2079
- this.cameraObj[type].videoUrl = '';
2080
- }
2100
+ if (!this.cameraObj[type] || !this.cameraObj[type].imgBox) return;
2101
+ this.cameraObj[type].imgBox.src = '';
2102
+ this.destroyUrl(type, this.cameraObj[type].maxUrlNum);
2081
2103
  };
2082
2104
  },
2083
- AllPhoto() {
2084
- let type = this.cameraType[this.cameraNum - 1].value;
2085
- this.videoObj.videoSrc = this.cameraObj[type].canvas.toDataURL('image/jpeg');
2086
- return this.videoObj.videoSrc;
2105
+ handleScreen(type) {
2106
+ this.$set(this.cameraObj[type], 'isFullScreen', !this.cameraObj[type].isFullScreen);
2107
+ this.currentFullScreen = this.cameraObj[type].isFullScreen ? type : '';
2108
+ this.$forceUpdate();
2109
+ },
2110
+ destroyCanvasData() {
2111
+ for (let i = 0; i < this.cameraNum; i++) {
2112
+ let type = this.cameraType[i].value;
2113
+ this.destroyUrl(type);
2114
+ this.destroyCanvas(type);
2115
+ }
2116
+ },
2117
+ destroyUrl(type) {
2118
+ for (let i = 0; i < this.cameraObj[type].allUrl.length; i++) {
2119
+ URL.revokeObjectURL(this.cameraObj[type].allUrl[i]);
2120
+ delete this.cameraObj[type].allUrl[i];
2121
+ }
2122
+ this.cameraObj[type].allUrl = [];
2087
2123
  },
2124
+ destroyCanvas(type) {
2125
+ if (!this.cameraObj[type]) return;
2126
+ for (let key in this.cameraObj[type]) {
2127
+ if (typeof this.cameraObj[type][key] == 'object') {
2128
+ this.cameraObj[type][key] = '';
2129
+ }
2130
+ delete this.cameraObj[type][key];
2131
+ }
2132
+ },
2133
+ // 所有摄像头横向照片
2134
+ allPhoto() {
2135
+ this.answerPhoto.isPhoto = true;
2136
+ let startTime = new Date().getTime();
2137
+ return new Promise(resolve => {
2138
+ setTimeout(() => {
2139
+ resolve(this.answerPhoto.canvas.toDataURL('image/jpeg'));
2140
+ let endTime = new Date().getTime();
2141
+ let second = (endTime - startTime) / 1000;
2142
+ this.cameraObj.main.totalFPS = this.cameraObj.main.totalFPS + ~~(second * 30);
2143
+ this.cameraObj.sub.totalFPS = this.cameraObj.sub.totalFPS + ~~(second * 30);
2144
+ this.cameraObj.side.totalFPS = this.cameraObj.side.totalFPS + ~~(second * 30);
2145
+ this.answerPhoto.isPhoto = false;
2146
+ }, 200);
2147
+ });
2148
+ },
2149
+ // 单个摄像头照片
2088
2150
  selectPhoto(num) {
2089
2151
  let type = this.cameraType[num - 1].value;
2090
2152
  this.videoObj.videoMergeSrc = this.cameraObj[type].canvas.toDataURL('image/jpeg');
2091
2153
  return this.videoObj.videoMergeSrc;
2092
- },
2093
- handleScreen(type) {
2094
- this.$set(this.cameraObj[type], 'isFullScreen', !this.cameraObj[type].isFullScreen);
2095
- this.currentFullScreen = this.cameraObj[type].isFullScreen ? type : '';
2096
2154
  }
2097
2155
  },
2098
2156
  beforeDestroy() {
2099
2157
  this.answerPhoto.canvas = null;
2100
- this.answerPhoto.context = null;
2158
+ this.answerPhoto.ctx = null;
2159
+ this.destroyWorker();
2160
+ this.destroyCanvasData();
2101
2161
  }
2102
2162
  });
2103
- ;// ./packages/components/videoCanvas.vue?vue&type=script&lang=js
2104
- /* harmony default export */ var components_videoCanvasvue_type_script_lang_js = (videoCanvasvue_type_script_lang_js);
2105
- // EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-64.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-64.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-64.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-64.use[3]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-64.use[4]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/components/videoCanvas.vue?vue&type=style&index=0&id=50940904&prod&lang=scss&scoped=true
2106
- var videoCanvasvue_type_style_index_0_id_50940904_prod_lang_scss_scoped_true = __webpack_require__(4707);
2107
- ;// ./packages/components/videoCanvas.vue?vue&type=style&index=0&id=50940904&prod&lang=scss&scoped=true
2163
+ ;// ./packages/components/xjzhImgCanvas.vue?vue&type=script&lang=js
2164
+ /* harmony default export */ var components_xjzhImgCanvasvue_type_script_lang_js = (xjzhImgCanvasvue_type_script_lang_js);
2165
+ // EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-64.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-64.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-64.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-64.use[3]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-64.use[4]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/components/xjzhImgCanvas.vue?vue&type=style&index=0&id=5aa81db6&prod&lang=scss&scoped=true
2166
+ var xjzhImgCanvasvue_type_style_index_0_id_5aa81db6_prod_lang_scss_scoped_true = __webpack_require__(4710);
2167
+ ;// ./packages/components/xjzhImgCanvas.vue?vue&type=style&index=0&id=5aa81db6&prod&lang=scss&scoped=true
2108
2168
 
2109
2169
  ;// ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
2110
2170
  /* globals __VUE_SSR_CONTEXT__ */
@@ -2204,7 +2264,7 @@ function normalizeComponent(
2204
2264
  }
2205
2265
  }
2206
2266
 
2207
- ;// ./packages/components/videoCanvas.vue
2267
+ ;// ./packages/components/xjzhImgCanvas.vue
2208
2268
 
2209
2269
 
2210
2270
 
@@ -2214,17 +2274,17 @@ function normalizeComponent(
2214
2274
  /* normalize component */
2215
2275
 
2216
2276
  var component = normalizeComponent(
2217
- components_videoCanvasvue_type_script_lang_js,
2277
+ components_xjzhImgCanvasvue_type_script_lang_js,
2218
2278
  render,
2219
2279
  staticRenderFns,
2220
2280
  false,
2221
2281
  null,
2222
- "50940904",
2282
+ "5aa81db6",
2223
2283
  null
2224
2284
 
2225
2285
  )
2226
2286
 
2227
- /* harmony default export */ var videoCanvas = (component.exports);
2287
+ /* harmony default export */ var xjzhImgCanvas = (component.exports);
2228
2288
  ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/babel-loader/lib/index.js!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/components/videoRtsp.vue?vue&type=template&id=345d94c7
2229
2289
  var videoRtspvue_type_template_id_345d94c7_render = function render() {
2230
2290
  var _vm = this,
@@ -2303,7 +2363,7 @@ var videoWebGl_component = normalizeComponent(
2303
2363
 
2304
2364
 
2305
2365
 
2306
- const components = [videoCanvas, videoRtsp, videoWebGl];
2366
+ const components = [xjzhImgCanvas, videoRtsp, videoWebGl];
2307
2367
  const install = function (Vue) {
2308
2368
  if (install.installed) return;
2309
2369
  components.map(component => Vue.component(component.name, component));
@@ -1,2 +1,2 @@
1
- (function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["xjzh-component"]=e():t["xjzh-component"]=e()})("undefined"!==typeof self?self:this,function(){return function(){var t={34:function(t,e,r){"use strict";var n=r(4901);t.exports=function(t){return"object"==typeof t?null!==t:n(t)}},283:function(t,e,r){"use strict";var n=r(9504),o=r(9039),i=r(4901),a=r(9297),s=r(3724),c=r(350).CONFIGURABLE,u=r(3706),l=r(1181),f=l.enforce,d=l.get,p=String,h=Object.defineProperty,v=n("".slice),m=n("".replace),g=n([].join),b=s&&!o(function(){return 8!==h(function(){},"length",{value:8}).length}),y=String(String).split("String"),w=t.exports=function(t,e,r){"Symbol("===v(p(e),0,7)&&(e="["+m(p(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(e="get "+e),r&&r.setter&&(e="set "+e),(!a(t,"name")||c&&t.name!==e)&&(s?h(t,"name",{value:e,configurable:!0}):t.name=e),b&&r&&a(r,"arity")&&t.length!==r.arity&&h(t,"length",{value:r.arity});try{r&&a(r,"constructor")&&r.constructor?s&&h(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(o){}var n=f(t);return a(n,"source")||(n.source=g(y,"string"==typeof e?e:"")),t};Function.prototype.toString=w(function(){return i(this)&&d(this).source||u(this)},"toString")},350:function(t,e,r){"use strict";var n=r(3724),o=r(9297),i=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,s=o(i,"name"),c=s&&"something"===function(){}.name,u=s&&(!n||n&&a(i,"name").configurable);t.exports={EXISTS:s,PROPER:c,CONFIGURABLE:u}},421:function(t){"use strict";t.exports={}},616:function(t,e,r){"use strict";var n=r(9039);t.exports=!n(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})},655:function(t,e,r){"use strict";var n=r(6955),o=String;t.exports=function(t){if("Symbol"===n(t))throw new TypeError("Cannot convert a Symbol value to a string");return o(t)}},757:function(t,e,r){"use strict";var n=r(7751),o=r(4901),i=r(1625),a=r(7040),s=Object;t.exports=a?function(t){return"symbol"==typeof t}:function(t){var e=n("Symbol");return o(e)&&i(e.prototype,s(t))}},1181:function(t,e,r){"use strict";var n,o,i,a=r(8622),s=r(4576),c=r(34),u=r(6699),l=r(9297),f=r(7629),d=r(6119),p=r(421),h="Object already initialized",v=s.TypeError,m=s.WeakMap,g=function(t){return i(t)?o(t):n(t,{})},b=function(t){return function(e){var r;if(!c(e)||(r=o(e)).type!==t)throw new v("Incompatible receiver, "+t+" required");return r}};if(a||f.state){var y=f.state||(f.state=new m);y.get=y.get,y.has=y.has,y.set=y.set,n=function(t,e){if(y.has(t))throw new v(h);return e.facade=t,y.set(t,e),e},o=function(t){return y.get(t)||{}},i=function(t){return y.has(t)}}else{var w=d("state");p[w]=!0,n=function(t,e){if(l(t,w))throw new v(h);return e.facade=t,u(t,w,e),e},o=function(t){return l(t,w)?t[w]:{}},i=function(t){return l(t,w)}}t.exports={set:n,get:o,has:i,enforce:g,getterFor:b}},1601:function(t){"use strict";t.exports=function(t){return t[1]}},1625:function(t,e,r){"use strict";var n=r(9504);t.exports=n({}.isPrototypeOf)},2106:function(t,e,r){"use strict";var n=r(283),o=r(4913);t.exports=function(t,e,r){return r.get&&n(r.get,e,{getter:!0}),r.set&&n(r.set,e,{setter:!0}),o.f(t,e,r)}},2140:function(t,e,r){"use strict";var n=r(8227),o=n("toStringTag"),i={};i[o]="z",t.exports="[object z]"===String(i)},2195:function(t,e,r){"use strict";var n=r(9504),o=n({}.toString),i=n("".slice);t.exports=function(t){return i(o(t),8,-1)}},2777:function(t,e,r){"use strict";var n=r(9565),o=r(34),i=r(757),a=r(5966),s=r(4270),c=r(8227),u=TypeError,l=c("toPrimitive");t.exports=function(t,e){if(!o(t)||i(t))return t;var r,c=a(t,l);if(c){if(void 0===e&&(e="default"),r=n(c,t,e),!o(r)||i(r))return r;throw new u("Can't convert object to primitive value")}return void 0===e&&(e="number"),s(t,e)}},2812:function(t){"use strict";var e=TypeError;t.exports=function(t,r){if(t<r)throw new e("Not enough arguments");return t}},2839:function(t,e,r){"use strict";var n=r(4576),o=n.navigator,i=o&&o.userAgent;t.exports=i?String(i):""},3392:function(t,e,r){"use strict";var n=r(9504),o=0,i=Math.random(),a=n(1.1.toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++o+i,36)}},3435:function(t,e,r){"use strict";r.r(e);var n=r(1601),o=r.n(n),i=r(6314),a=r.n(i),s=a()(o());s.push([t.id,".video-canvas[data-v-50940904]{width:100%;height:100%;display:flex;flex-direction:column;justify-content:space-evenly;margin-top:16px}.video-canvas .itemBox[data-v-50940904]{border-radius:4px;transform:translateZ(0);margin-bottom:11px;position:relative;overflow:hidden}.video-canvas canvas[data-v-50940904]{margin:0;padding:0;width:100%;height:100%;will-change:transform;image-rendering:optimizeSpeed;image-rendering:-moz-crisp-edges;image-rendering:-o-crisp-edges;image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges}.video-canvas .full-screen[data-v-50940904]{width:100%;height:100%;position:fixed;top:0;bottom:0;left:0;right:0;z-index:999}",""]),e["default"]=s},3706:function(t,e,r){"use strict";var n=r(9504),o=r(4901),i=r(7629),a=n(Function.toString);o(i.inspectSource)||(i.inspectSource=function(t){return a(t)}),t.exports=i.inspectSource},3724:function(t,e,r){"use strict";var n=r(9039);t.exports=!n(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},4055:function(t,e,r){"use strict";var n=r(4576),o=r(34),i=n.document,a=o(i)&&o(i.createElement);t.exports=function(t){return a?i.createElement(t):{}}},4117:function(t){"use strict";t.exports=function(t){return null===t||void 0===t}},4270:function(t,e,r){"use strict";var n=r(9565),o=r(4901),i=r(34),a=TypeError;t.exports=function(t,e){var r,s;if("string"===e&&o(r=t.toString)&&!i(s=n(r,t)))return s;if(o(r=t.valueOf)&&!i(s=n(r,t)))return s;if("string"!==e&&o(r=t.toString)&&!i(s=n(r,t)))return s;throw new a("Can't convert object to primitive value")}},4495:function(t,e,r){"use strict";var n=r(9519),o=r(9039),i=r(4576),a=i.String;t.exports=!!Object.getOwnPropertySymbols&&!o(function(){var t=Symbol("symbol detection");return!a(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&n&&n<41})},4576:function(t,e,r){"use strict";var n=function(t){return t&&t.Math===Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof r.g&&r.g)||n("object"==typeof this&&this)||function(){return this}()||Function("return this")()},4603:function(t,e,r){"use strict";var n=r(6840),o=r(9504),i=r(655),a=r(2812),s=URLSearchParams,c=s.prototype,u=o(c.append),l=o(c["delete"]),f=o(c.forEach),d=o([].push),p=new s("a=1&a=2&b=3");p["delete"]("a",1),p["delete"]("b",void 0),p+""!=="a=2"&&n(c,"delete",function(t){var e=arguments.length,r=e<2?void 0:arguments[1];if(e&&void 0===r)return l(this,t);var n=[];f(this,function(t,e){d(n,{key:e,value:t})}),a(e,1);var o,s=i(t),c=i(r),p=0,h=0,v=!1,m=n.length;while(p<m)o=n[p++],v||o.key===s?(v=!0,l(this,o.key)):h++;while(h<m)o=n[h++],o.key===s&&o.value===c||u(this,o.key,o.value)},{enumerable:!0,unsafe:!0})},4901:function(t){"use strict";var e="object"==typeof document&&document.all;t.exports="undefined"==typeof e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(t){return"function"==typeof t}},4913:function(t,e,r){"use strict";var n=r(3724),o=r(5917),i=r(8686),a=r(8551),s=r(6969),c=TypeError,u=Object.defineProperty,l=Object.getOwnPropertyDescriptor,f="enumerable",d="configurable",p="writable";e.f=n?i?function(t,e,r){if(a(t),e=s(e),a(r),"function"===typeof t&&"prototype"===e&&"value"in r&&p in r&&!r[p]){var n=l(t,e);n&&n[p]&&(t[e]=r.value,r={configurable:d in r?r[d]:n[d],enumerable:f in r?r[f]:n[f],writable:!1})}return u(t,e,r)}:u:function(t,e,r){if(a(t),e=s(e),a(r),o)try{return u(t,e,r)}catch(n){}if("get"in r||"set"in r)throw new c("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},5745:function(t,e,r){"use strict";var n=r(7629);t.exports=function(t,e){return n[t]||(n[t]=e||{})}},5917:function(t,e,r){"use strict";var n=r(3724),o=r(9039),i=r(4055);t.exports=!n&&!o(function(){return 7!==Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a})},5966:function(t,e,r){"use strict";var n=r(9306),o=r(4117);t.exports=function(t,e){var r=t[e];return o(r)?void 0:n(r)}},6119:function(t,e,r){"use strict";var n=r(5745),o=r(3392),i=n("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},6314:function(t){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var r="",n="undefined"!==typeof e[5];return e[4]&&(r+="@supports (".concat(e[4],") {")),e[2]&&(r+="@media ".concat(e[2]," {")),n&&(r+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),r+=t(e),n&&(r+="}"),e[2]&&(r+="}"),e[4]&&(r+="}"),r}).join("")},e.i=function(t,r,n,o,i){"string"===typeof t&&(t=[[null,t,void 0]]);var a={};if(n)for(var s=0;s<this.length;s++){var c=this[s][0];null!=c&&(a[c]=!0)}for(var u=0;u<t.length;u++){var l=[].concat(t[u]);n&&a[l[0]]||("undefined"!==typeof i&&("undefined"===typeof l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=i),r&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=r):l[2]=r),o&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=o):l[4]="".concat(o)),e.push(l))}},e}},6368:function(t,e,r){var n=r(3435);n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[t.id,n,""]]),n.locals&&(t.exports=n.locals);var o=r(9548).A;o("bdf71b6a",n,!0,{sourceMap:!1,shadowMode:!1})},6395:function(t){"use strict";t.exports=!1},6699:function(t,e,r){"use strict";var n=r(3724),o=r(4913),i=r(6980);t.exports=n?function(t,e,r){return o.f(t,e,i(1,r))}:function(t,e,r){return t[e]=r,t}},6823:function(t){"use strict";var e=String;t.exports=function(t){try{return e(t)}catch(r){return"Object"}}},6840:function(t,e,r){"use strict";var n=r(4901),o=r(4913),i=r(283),a=r(9433);t.exports=function(t,e,r,s){s||(s={});var c=s.enumerable,u=void 0!==s.name?s.name:e;if(n(r)&&i(r,u,s),s.global)c?t[e]=r:a(e,r);else{try{s.unsafe?t[e]&&(c=!0):delete t[e]}catch(l){}c?t[e]=r:o.f(t,e,{value:r,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return t}},6955:function(t,e,r){"use strict";var n=r(2140),o=r(4901),i=r(2195),a=r(8227),s=a("toStringTag"),c=Object,u="Arguments"===i(function(){return arguments}()),l=function(t,e){try{return t[e]}catch(r){}};t.exports=n?i:function(t){var e,r,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=l(e=c(t),s))?r:u?i(e):"Object"===(n=i(e))&&o(e.callee)?"Arguments":n}},6969:function(t,e,r){"use strict";var n=r(2777),o=r(757);t.exports=function(t){var e=n(t,"string");return o(e)?e:e+""}},6980:function(t){"use strict";t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},7040:function(t,e,r){"use strict";var n=r(4495);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},7566:function(t,e,r){"use strict";var n=r(6840),o=r(9504),i=r(655),a=r(2812),s=URLSearchParams,c=s.prototype,u=o(c.getAll),l=o(c.has),f=new s("a=1");!f.has("a",2)&&f.has("a",void 0)||n(c,"has",function(t){var e=arguments.length,r=e<2?void 0:arguments[1];if(e&&void 0===r)return l(this,t);var n=u(this,t);a(e,1);var o=i(r),s=0;while(s<n.length)if(n[s++]===o)return!0;return!1},{enumerable:!0,unsafe:!0})},7629:function(t,e,r){"use strict";var n=r(6395),o=r(4576),i=r(9433),a="__core-js_shared__",s=t.exports=o[a]||i(a,{});(s.versions||(s.versions=[])).push({version:"3.45.1",mode:n?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.45.1/LICENSE",source:"https://github.com/zloirock/core-js"})},7750:function(t,e,r){"use strict";var n=r(4117),o=TypeError;t.exports=function(t){if(n(t))throw new o("Can't call method on "+t);return t}},7751:function(t,e,r){"use strict";var n=r(4576),o=r(4901),i=function(t){return o(t)?t:void 0};t.exports=function(t,e){return arguments.length<2?i(n[t]):n[t]&&n[t][e]}},8227:function(t,e,r){"use strict";var n=r(4576),o=r(5745),i=r(9297),a=r(3392),s=r(4495),c=r(7040),u=n.Symbol,l=o("wks"),f=c?u["for"]||u:u&&u.withoutSetter||a;t.exports=function(t){return i(l,t)||(l[t]=s&&i(u,t)?u[t]:f("Symbol."+t)),l[t]}},8551:function(t,e,r){"use strict";var n=r(34),o=String,i=TypeError;t.exports=function(t){if(n(t))return t;throw new i(o(t)+" is not an object")}},8622:function(t,e,r){"use strict";var n=r(4576),o=r(4901),i=n.WeakMap;t.exports=o(i)&&/native code/.test(String(i))},8686:function(t,e,r){"use strict";var n=r(3724),o=r(9039);t.exports=n&&o(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},8721:function(t,e,r){"use strict";var n=r(3724),o=r(9504),i=r(2106),a=URLSearchParams.prototype,s=o(a.forEach);n&&!("size"in a)&&i(a,"size",{get:function(){var t=0;return s(this,function(){t++}),t},configurable:!0,enumerable:!0})},8981:function(t,e,r){"use strict";var n=r(7750),o=Object;t.exports=function(t){return o(n(t))}},9039:function(t){"use strict";t.exports=function(t){try{return!!t()}catch(e){return!0}}},9297:function(t,e,r){"use strict";var n=r(9504),o=r(8981),i=n({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return i(o(t),e)}},9306:function(t,e,r){"use strict";var n=r(4901),o=r(6823),i=TypeError;t.exports=function(t){if(n(t))return t;throw new i(o(t)+" is not a function")}},9433:function(t,e,r){"use strict";var n=r(4576),o=Object.defineProperty;t.exports=function(t,e){try{o(n,t,{value:e,configurable:!0,writable:!0})}catch(r){n[t]=e}return e}},9504:function(t,e,r){"use strict";var n=r(616),o=Function.prototype,i=o.call,a=n&&o.bind.bind(i,i);t.exports=n?a:function(t){return function(){return i.apply(t,arguments)}}},9519:function(t,e,r){"use strict";var n,o,i=r(4576),a=r(2839),s=i.process,c=i.Deno,u=s&&s.versions||c&&c.version,l=u&&u.v8;l&&(n=l.split("."),o=n[0]>0&&n[0]<4?1:+(n[0]+n[1])),!o&&a&&(n=a.match(/Edge\/(\d+)/),(!n||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/),n&&(o=+n[1]))),t.exports=o},9548:function(t,e,r){"use strict";function n(t,e){for(var r=[],n={},o=0;o<e.length;o++){var i=e[o],a=i[0],s=i[1],c=i[2],u=i[3],l={id:t+":"+o,css:s,media:c,sourceMap:u};n[a]?n[a].parts.push(l):r.push(n[a]={id:a,parts:[l]})}return r}r.d(e,{A:function(){return h}});var o="undefined"!==typeof document;if("undefined"!==typeof DEBUG&&DEBUG&&!o)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var i={},a=o&&(document.head||document.getElementsByTagName("head")[0]),s=null,c=0,u=!1,l=function(){},f=null,d="data-vue-ssr-id",p="undefined"!==typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function h(t,e,r,o){u=r,f=o||{};var a=n(t,e);return v(a),function(e){for(var r=[],o=0;o<a.length;o++){var s=a[o],c=i[s.id];c.refs--,r.push(c)}e?(a=n(t,e),v(a)):a=[];for(o=0;o<r.length;o++){c=r[o];if(0===c.refs){for(var u=0;u<c.parts.length;u++)c.parts[u]();delete i[c.id]}}}}function v(t){for(var e=0;e<t.length;e++){var r=t[e],n=i[r.id];if(n){n.refs++;for(var o=0;o<n.parts.length;o++)n.parts[o](r.parts[o]);for(;o<r.parts.length;o++)n.parts.push(g(r.parts[o]));n.parts.length>r.parts.length&&(n.parts.length=r.parts.length)}else{var a=[];for(o=0;o<r.parts.length;o++)a.push(g(r.parts[o]));i[r.id]={id:r.id,refs:1,parts:a}}}}function m(){var t=document.createElement("style");return t.type="text/css",a.appendChild(t),t}function g(t){var e,r,n=document.querySelector("style["+d+'~="'+t.id+'"]');if(n){if(u)return l;n.parentNode.removeChild(n)}if(p){var o=c++;n=s||(s=m()),e=y.bind(null,n,o,!1),r=y.bind(null,n,o,!0)}else n=m(),e=w.bind(null,n),r=function(){n.parentNode.removeChild(n)};return e(t),function(n){if(n){if(n.css===t.css&&n.media===t.media&&n.sourceMap===t.sourceMap)return;e(t=n)}else r()}}var b=function(){var t=[];return function(e,r){return t[e]=r,t.filter(Boolean).join("\n")}}();function y(t,e,r,n){var o=r?"":n.css;if(t.styleSheet)t.styleSheet.cssText=b(e,o);else{var i=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}function w(t,e){var r=e.css,n=e.media,o=e.sourceMap;if(n&&t.setAttribute("media",n),f.ssrId&&t.setAttribute(d,e.id),o&&(r+="\n/*# sourceURL="+o.sources[0]+" */",r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),t.styleSheet)t.styleSheet.cssText=r;else{while(t.firstChild)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(r))}}},9565:function(t,e,r){"use strict";var n=r(616),o=Function.prototype.call;t.exports=n?o.bind(o):function(){return o.apply(o,arguments)}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={id:n,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}r.m=t,function(){r.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return r.d(e,{a:e}),e}}(),function(){r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})}}(),function(){r.u=function(t){return"xjzh-component.umd.min."+t+".js"}}(),function(){r.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()}(),function(){r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}(),function(){r.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}}(),function(){r.p=""}(),function(){r.b=document.baseURI||self.location.href}();var n={};return function(){"use strict";if(r.r(n),r.d(n,{default:function(){return T}}),"undefined"!==typeof window){var t=window.document.currentScript,e=t&&t.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);e&&(r.p=e[1])}var o=function(){var t=this,e=t._self._c;return e("div",{staticClass:"video-canvas"},t._l(t.cameraObj,function(r,n){return e("div",{key:n,class:["itemBox",r.isFullScreen?"full-screen":""],style:{width:t.width,height:t.height},on:{click:function(e){return t.handleScreen(n)}}},[e("p",{directives:[{name:"show",rawName:"v-show",value:t.showTitle,expression:"showTitle"}],staticClass:"item-title"},[t._v(t._s(r.title))]),e("canvas",{ref:r.domeId,refInFor:!0})])}),0)},i=[],a=(r(4603),r(7566),r(8721),{name:"VideoCanvas",props:{videoUrl:{type:String,default:"localhost:56000"},width:{type:String,default:"640px"},height:{type:String,default:"360px"},showTitle:{type:Boolean,default:!0},isSwitchSide:{type:Boolean,default:!1}},watch:{videoUrl:{handler(t){console.log("object :>> ",t),this.initWorker()}},isSwitchSide:{handler(t){console.log("object :>> ",t),this.cameraType[2].label=this.isSwitchSide?"显":"侧"}}},data(){return{cameraNum:0,cameraType:[{label:"斜",value:"main"},{label:"俯",value:"sub"},{label:"侧",value:"side"}],currentFullScreen:"",answerPhoto:{canvas:null,context:null,isPhoto:!1},canvasSize:[1920,1080]}},mounted(){},methods:{initAnswerPhoto(){this.answerPhoto.canvas=document.createElement("canvas"),this.answerPhoto.context=this.answerPhoto.canvas.getContext("2d"),this.answerPhoto.canvas.width=this.canvasSize[0]*this.cameraNum,this.answerPhoto.canvas.height=this.canvasSize[1]},initCanvas(){for(let t=0;t<this.cameraNum;t++){let e=this.cameraType[t].value;this.cameraObj[e].canvas=document.getElementById(this.cameraObj[e].domeId),this.cameraObj[e].content=this.cameraObj[e].canvas.getContext("2d"),this.cameraObj[e].canvas.width=this.canvasSize[0],this.cameraObj[e].canvas.height=this.canvasSize[1],this.cameraObj[e].imgBox=new Image,this.cameraObj[e].videoUrl=""}},initWorker(){const t=`ws://${this.videoUrl}/socket`;let e=0;this.destroyWorker(),this.worker=new Worker(new URL(r.p+r.u(221),r.b)),this.worker.onmessage=async t=>{const{type:r,data:n,event:o,error:i}=t.data;if("message"===r){if("number"===typeof n){this.cameraNum=n,localStorage.setItem("cameraNum",this.cameraNum);for(let t=0;t<this.cameraNum;t++)this.cameraObj[this.cameraType[t].value]={domeId:`canvas_${this.cameraType[t].value}`,canvas:null,content:null,videoUrl:"",totalFPS:0,showTotalFPS:0,frameSkip:1,imgBox:null,isLoading:!1,isFullScreen:!1,title:this.cameraType[t].label};return void this.$nextTick(()=>{this.initAnswerPhoto(),this.initCanvas()})}e++,this.showCanvas(this.cameraType[e-1].value,n),e=e>=this.cameraNum?0:e}"message"===r&&console.log("WebSocket open:"),"close"===r&&console.log("WebSocket closed:",o),"error"===r&&console.log(`WebSocket error: ${i.message}`)},this.worker.onerror=t=>{console.log(`Worker error: ${t.message}`)},this.cameraObj={},this.worker.postMessage({url:t})},destroyWorker(){this.worker&&(this.worker.terminate(),this.worker=null)},showVideoCanvas(t,e){this.currentFullScreen&&this.currentFullScreen!==t?this.cameraObj[t].videoUrl&&(URL.revokeObjectURL(this.cameraObj[t].videoUrl),this.cameraObj[t].videoUrl=""):this.cameraObj[t].isLoading||(this.cameraObj[t].videoUrl=URL.createObjectURL(e),this.cameraObj[t].isLoading=!0,this.cameraObj[t].imgBox.src=this.cameraObj[t].videoUrl,this.cameraObj[t].imgBox.onload=()=>{this.cameraObj[t].isLoading=!1,this.cameraObj[t].content.drawImage(this.cameraObj[t].imgBox,0,0,this.canvasSize[0],this.canvasSize[1]),this.cameraObj[t].videoUrl&&(URL.revokeObjectURL(this.cameraObj[t].videoUrl),this.cameraObj[t].videoUrl="")},this.cameraObj[t].imgBox.onerror=()=>{this.cameraObj[t].isLoading=!1,this.cameraObj[t].videoUrl&&(URL.revokeObjectURL(this.cameraObj[t].videoUrl),this.cameraObj[t].videoUrl="")})},AllPhoto(){let t=this.cameraType[this.cameraNum-1].value;return this.videoObj.videoSrc=this.cameraObj[t].canvas.toDataURL("image/jpeg"),this.videoObj.videoSrc},selectPhoto(t){let e=this.cameraType[t-1].value;return this.videoObj.videoMergeSrc=this.cameraObj[e].canvas.toDataURL("image/jpeg"),this.videoObj.videoMergeSrc},handleScreen(t){this.$set(this.cameraObj[t],"isFullScreen",!this.cameraObj[t].isFullScreen),this.currentFullScreen=this.cameraObj[t].isFullScreen?t:""}},beforeDestroy(){this.answerPhoto.canvas=null,this.answerPhoto.context=null}}),s=a;r(6368);function c(t,e,r,n,o,i,a,s){var c,u="function"===typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=r,u._compiled=!0),n&&(u.functional=!0),i&&(u._scopeId="data-v-"+i),a?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},u._ssrRegister=c):o&&(c=s?function(){o.call(this,(u.functional?this.parent:this).$root.$options.shadowRoot)}:o),c)if(u.functional){u._injectStyles=c;var l=u.render;u.render=function(t,e){return c.call(e),l(t,e)}}else{var f=u.beforeCreate;u.beforeCreate=f?[].concat(f,c):[c]}return{exports:t,options:u}}var u=c(s,o,i,!1,null,"50940904",null),l=u.exports,f=function(){var t=this,e=t._self._c;return e("div")},d=[],p={name:"VideoRtsp",data(){return{}}},h=p,v=c(h,f,d,!1,null,null,null),m=v.exports,g=function(){var t=this,e=t._self._c;return e("div")},b=[],y={name:"VideoWebGl",data(){return{}}},w=y,x=c(w,g,b,!1,null,null,null),S=x.exports;const j=[l,m,S],O=function(t){O.installed||j.map(e=>t.component(e.name,e))};"undefined"!==typeof window&&window.Vue&&O(window.Vue);var U={install:O},T=U}(),n}()});
1
+ (function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["xjzh-component"]=e():t["xjzh-component"]=e()})("undefined"!==typeof self?self:this,function(){return function(){var t={34:function(t,e,r){"use strict";var n=r(4901);t.exports=function(t){return"object"==typeof t?null!==t:n(t)}},283:function(t,e,r){"use strict";var n=r(9504),i=r(9039),o=r(4901),a=r(9297),s=r(3724),c=r(350).CONFIGURABLE,u=r(3706),l=r(1181),f=l.enforce,h=l.get,d=String,p=Object.defineProperty,m=n("".slice),v=n("".replace),g=n([].join),b=s&&!i(function(){return 8!==p(function(){},"length",{value:8}).length}),y=String(String).split("String"),w=t.exports=function(t,e,r){"Symbol("===m(d(e),0,7)&&(e="["+v(d(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(e="get "+e),r&&r.setter&&(e="set "+e),(!a(t,"name")||c&&t.name!==e)&&(s?p(t,"name",{value:e,configurable:!0}):t.name=e),b&&r&&a(r,"arity")&&t.length!==r.arity&&p(t,"length",{value:r.arity});try{r&&a(r,"constructor")&&r.constructor?s&&p(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(i){}var n=f(t);return a(n,"source")||(n.source=g(y,"string"==typeof e?e:"")),t};Function.prototype.toString=w(function(){return o(this)&&h(this).source||u(this)},"toString")},350:function(t,e,r){"use strict";var n=r(3724),i=r(9297),o=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,s=i(o,"name"),c=s&&"something"===function(){}.name,u=s&&(!n||n&&a(o,"name").configurable);t.exports={EXISTS:s,PROPER:c,CONFIGURABLE:u}},421:function(t){"use strict";t.exports={}},616:function(t,e,r){"use strict";var n=r(9039);t.exports=!n(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})},655:function(t,e,r){"use strict";var n=r(6955),i=String;t.exports=function(t){if("Symbol"===n(t))throw new TypeError("Cannot convert a Symbol value to a string");return i(t)}},757:function(t,e,r){"use strict";var n=r(7751),i=r(4901),o=r(1625),a=r(7040),s=Object;t.exports=a?function(t){return"symbol"==typeof t}:function(t){var e=n("Symbol");return i(e)&&o(e.prototype,s(t))}},1181:function(t,e,r){"use strict";var n,i,o,a=r(8622),s=r(4576),c=r(34),u=r(6699),l=r(9297),f=r(7629),h=r(6119),d=r(421),p="Object already initialized",m=s.TypeError,v=s.WeakMap,g=function(t){return o(t)?i(t):n(t,{})},b=function(t){return function(e){var r;if(!c(e)||(r=i(e)).type!==t)throw new m("Incompatible receiver, "+t+" required");return r}};if(a||f.state){var y=f.state||(f.state=new v);y.get=y.get,y.has=y.has,y.set=y.set,n=function(t,e){if(y.has(t))throw new m(p);return e.facade=t,y.set(t,e),e},i=function(t){return y.get(t)||{}},o=function(t){return y.has(t)}}else{var w=h("state");d[w]=!0,n=function(t,e){if(l(t,w))throw new m(p);return e.facade=t,u(t,w,e),e},i=function(t){return l(t,w)?t[w]:{}},o=function(t){return l(t,w)}}t.exports={set:n,get:i,has:o,enforce:g,getterFor:b}},1601:function(t){"use strict";t.exports=function(t){return t[1]}},1625:function(t,e,r){"use strict";var n=r(9504);t.exports=n({}.isPrototypeOf)},2106:function(t,e,r){"use strict";var n=r(283),i=r(4913);t.exports=function(t,e,r){return r.get&&n(r.get,e,{getter:!0}),r.set&&n(r.set,e,{setter:!0}),i.f(t,e,r)}},2140:function(t,e,r){"use strict";var n=r(8227),i=n("toStringTag"),o={};o[i]="z",t.exports="[object z]"===String(o)},2195:function(t,e,r){"use strict";var n=r(9504),i=n({}.toString),o=n("".slice);t.exports=function(t){return o(i(t),8,-1)}},2777:function(t,e,r){"use strict";var n=r(9565),i=r(34),o=r(757),a=r(5966),s=r(4270),c=r(8227),u=TypeError,l=c("toPrimitive");t.exports=function(t,e){if(!i(t)||o(t))return t;var r,c=a(t,l);if(c){if(void 0===e&&(e="default"),r=n(c,t,e),!i(r)||o(r))return r;throw new u("Can't convert object to primitive value")}return void 0===e&&(e="number"),s(t,e)}},2812:function(t){"use strict";var e=TypeError;t.exports=function(t,r){if(t<r)throw new e("Not enough arguments");return t}},2839:function(t,e,r){"use strict";var n=r(4576),i=n.navigator,o=i&&i.userAgent;t.exports=o?String(o):""},3392:function(t,e,r){"use strict";var n=r(9504),i=0,o=Math.random(),a=n(1.1.toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++i+o,36)}},3706:function(t,e,r){"use strict";var n=r(9504),i=r(4901),o=r(7629),a=n(Function.toString);i(o.inspectSource)||(o.inspectSource=function(t){return a(t)}),t.exports=o.inspectSource},3724:function(t,e,r){"use strict";var n=r(9039);t.exports=!n(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},4055:function(t,e,r){"use strict";var n=r(4576),i=r(34),o=n.document,a=i(o)&&i(o.createElement);t.exports=function(t){return a?o.createElement(t):{}}},4117:function(t){"use strict";t.exports=function(t){return null===t||void 0===t}},4270:function(t,e,r){"use strict";var n=r(9565),i=r(4901),o=r(34),a=TypeError;t.exports=function(t,e){var r,s;if("string"===e&&i(r=t.toString)&&!o(s=n(r,t)))return s;if(i(r=t.valueOf)&&!o(s=n(r,t)))return s;if("string"!==e&&i(r=t.toString)&&!o(s=n(r,t)))return s;throw new a("Can't convert object to primitive value")}},4495:function(t,e,r){"use strict";var n=r(9519),i=r(9039),o=r(4576),a=o.String;t.exports=!!Object.getOwnPropertySymbols&&!i(function(){var t=Symbol("symbol detection");return!a(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&n&&n<41})},4574:function(t,e,r){"use strict";r.r(e);var n=r(1601),i=r.n(n),o=r(6314),a=r.n(o),s=a()(i());s.push([t.id,".xjzh-img-canvas[data-v-5aa81db6]{width:100%;height:100%;display:flex;justify-content:space-evenly;align-items:center;flex-wrap:wrap}.xjzh-img-canvas .itemBox[data-v-5aa81db6]{border-radius:4px;transform:translateZ(0);position:relative;overflow:hidden}.xjzh-img-canvas .itemBox .item-title[data-v-5aa81db6]{width:30px;height:30px;padding:0;margin:0;font-size:20px;border-radius:50%;text-align:center;line-height:30px;position:absolute;left:10px;top:10px;z-index:999;background-color:#fff;color:#0076f6}.xjzh-img-canvas .itemBox canvas[data-v-5aa81db6]{margin:0;padding:0;width:100%;height:100%;will-change:transform;image-rendering:optimizeSpeed;image-rendering:-moz-crisp-edges;image-rendering:-o-crisp-edges;image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges}.xjzh-img-canvas .itemBox[data-v-5aa81db6]:last-child{margin-bottom:0}.xjzh-img-canvas .full-screen[data-v-5aa81db6]{width:100%!important;height:100%!important;position:fixed;top:0;bottom:0;left:0;right:0;z-index:999}",""]),e["default"]=s},4576:function(t,e,r){"use strict";var n=function(t){return t&&t.Math===Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof r.g&&r.g)||n("object"==typeof this&&this)||function(){return this}()||Function("return this")()},4603:function(t,e,r){"use strict";var n=r(6840),i=r(9504),o=r(655),a=r(2812),s=URLSearchParams,c=s.prototype,u=i(c.append),l=i(c["delete"]),f=i(c.forEach),h=i([].push),d=new s("a=1&a=2&b=3");d["delete"]("a",1),d["delete"]("b",void 0),d+""!=="a=2"&&n(c,"delete",function(t){var e=arguments.length,r=e<2?void 0:arguments[1];if(e&&void 0===r)return l(this,t);var n=[];f(this,function(t,e){h(n,{key:e,value:t})}),a(e,1);var i,s=o(t),c=o(r),d=0,p=0,m=!1,v=n.length;while(d<v)i=n[d++],m||i.key===s?(m=!0,l(this,i.key)):p++;while(p<v)i=n[p++],i.key===s&&i.value===c||u(this,i.key,i.value)},{enumerable:!0,unsafe:!0})},4901:function(t){"use strict";var e="object"==typeof document&&document.all;t.exports="undefined"==typeof e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(t){return"function"==typeof t}},4913:function(t,e,r){"use strict";var n=r(3724),i=r(5917),o=r(8686),a=r(8551),s=r(6969),c=TypeError,u=Object.defineProperty,l=Object.getOwnPropertyDescriptor,f="enumerable",h="configurable",d="writable";e.f=n?o?function(t,e,r){if(a(t),e=s(e),a(r),"function"===typeof t&&"prototype"===e&&"value"in r&&d in r&&!r[d]){var n=l(t,e);n&&n[d]&&(t[e]=r.value,r={configurable:h in r?r[h]:n[h],enumerable:f in r?r[f]:n[f],writable:!1})}return u(t,e,r)}:u:function(t,e,r){if(a(t),e=s(e),a(r),i)try{return u(t,e,r)}catch(n){}if("get"in r||"set"in r)throw new c("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},5745:function(t,e,r){"use strict";var n=r(7629);t.exports=function(t,e){return n[t]||(n[t]=e||{})}},5917:function(t,e,r){"use strict";var n=r(3724),i=r(9039),o=r(4055);t.exports=!n&&!i(function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a})},5966:function(t,e,r){"use strict";var n=r(9306),i=r(4117);t.exports=function(t,e){var r=t[e];return i(r)?void 0:n(r)}},6119:function(t,e,r){"use strict";var n=r(5745),i=r(3392),o=n("keys");t.exports=function(t){return o[t]||(o[t]=i(t))}},6314:function(t){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var r="",n="undefined"!==typeof e[5];return e[4]&&(r+="@supports (".concat(e[4],") {")),e[2]&&(r+="@media ".concat(e[2]," {")),n&&(r+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),r+=t(e),n&&(r+="}"),e[2]&&(r+="}"),e[4]&&(r+="}"),r}).join("")},e.i=function(t,r,n,i,o){"string"===typeof t&&(t=[[null,t,void 0]]);var a={};if(n)for(var s=0;s<this.length;s++){var c=this[s][0];null!=c&&(a[c]=!0)}for(var u=0;u<t.length;u++){var l=[].concat(t[u]);n&&a[l[0]]||("undefined"!==typeof o&&("undefined"===typeof l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=o),r&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=r):l[2]=r),i&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=i):l[4]="".concat(i)),e.push(l))}},e}},6365:function(t,e,r){var n=r(4574);n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[t.id,n,""]]),n.locals&&(t.exports=n.locals);var i=r(9548).A;i("10ff17d4",n,!0,{sourceMap:!1,shadowMode:!1})},6395:function(t){"use strict";t.exports=!1},6699:function(t,e,r){"use strict";var n=r(3724),i=r(4913),o=r(6980);t.exports=n?function(t,e,r){return i.f(t,e,o(1,r))}:function(t,e,r){return t[e]=r,t}},6823:function(t){"use strict";var e=String;t.exports=function(t){try{return e(t)}catch(r){return"Object"}}},6840:function(t,e,r){"use strict";var n=r(4901),i=r(4913),o=r(283),a=r(9433);t.exports=function(t,e,r,s){s||(s={});var c=s.enumerable,u=void 0!==s.name?s.name:e;if(n(r)&&o(r,u,s),s.global)c?t[e]=r:a(e,r);else{try{s.unsafe?t[e]&&(c=!0):delete t[e]}catch(l){}c?t[e]=r:i.f(t,e,{value:r,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return t}},6955:function(t,e,r){"use strict";var n=r(2140),i=r(4901),o=r(2195),a=r(8227),s=a("toStringTag"),c=Object,u="Arguments"===o(function(){return arguments}()),l=function(t,e){try{return t[e]}catch(r){}};t.exports=n?o:function(t){var e,r,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=l(e=c(t),s))?r:u?o(e):"Object"===(n=o(e))&&i(e.callee)?"Arguments":n}},6969:function(t,e,r){"use strict";var n=r(2777),i=r(757);t.exports=function(t){var e=n(t,"string");return i(e)?e:e+""}},6980:function(t){"use strict";t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},7040:function(t,e,r){"use strict";var n=r(4495);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},7566:function(t,e,r){"use strict";var n=r(6840),i=r(9504),o=r(655),a=r(2812),s=URLSearchParams,c=s.prototype,u=i(c.getAll),l=i(c.has),f=new s("a=1");!f.has("a",2)&&f.has("a",void 0)||n(c,"has",function(t){var e=arguments.length,r=e<2?void 0:arguments[1];if(e&&void 0===r)return l(this,t);var n=u(this,t);a(e,1);var i=o(r),s=0;while(s<n.length)if(n[s++]===i)return!0;return!1},{enumerable:!0,unsafe:!0})},7629:function(t,e,r){"use strict";var n=r(6395),i=r(4576),o=r(9433),a="__core-js_shared__",s=t.exports=i[a]||o(a,{});(s.versions||(s.versions=[])).push({version:"3.45.1",mode:n?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.45.1/LICENSE",source:"https://github.com/zloirock/core-js"})},7750:function(t,e,r){"use strict";var n=r(4117),i=TypeError;t.exports=function(t){if(n(t))throw new i("Can't call method on "+t);return t}},7751:function(t,e,r){"use strict";var n=r(4576),i=r(4901),o=function(t){return i(t)?t:void 0};t.exports=function(t,e){return arguments.length<2?o(n[t]):n[t]&&n[t][e]}},8227:function(t,e,r){"use strict";var n=r(4576),i=r(5745),o=r(9297),a=r(3392),s=r(4495),c=r(7040),u=n.Symbol,l=i("wks"),f=c?u["for"]||u:u&&u.withoutSetter||a;t.exports=function(t){return o(l,t)||(l[t]=s&&o(u,t)?u[t]:f("Symbol."+t)),l[t]}},8551:function(t,e,r){"use strict";var n=r(34),i=String,o=TypeError;t.exports=function(t){if(n(t))return t;throw new o(i(t)+" is not an object")}},8622:function(t,e,r){"use strict";var n=r(4576),i=r(4901),o=n.WeakMap;t.exports=i(o)&&/native code/.test(String(o))},8686:function(t,e,r){"use strict";var n=r(3724),i=r(9039);t.exports=n&&i(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},8721:function(t,e,r){"use strict";var n=r(3724),i=r(9504),o=r(2106),a=URLSearchParams.prototype,s=i(a.forEach);n&&!("size"in a)&&o(a,"size",{get:function(){var t=0;return s(this,function(){t++}),t},configurable:!0,enumerable:!0})},8981:function(t,e,r){"use strict";var n=r(7750),i=Object;t.exports=function(t){return i(n(t))}},9039:function(t){"use strict";t.exports=function(t){try{return!!t()}catch(e){return!0}}},9297:function(t,e,r){"use strict";var n=r(9504),i=r(8981),o=n({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return o(i(t),e)}},9306:function(t,e,r){"use strict";var n=r(4901),i=r(6823),o=TypeError;t.exports=function(t){if(n(t))return t;throw new o(i(t)+" is not a function")}},9433:function(t,e,r){"use strict";var n=r(4576),i=Object.defineProperty;t.exports=function(t,e){try{i(n,t,{value:e,configurable:!0,writable:!0})}catch(r){n[t]=e}return e}},9504:function(t,e,r){"use strict";var n=r(616),i=Function.prototype,o=i.call,a=n&&i.bind.bind(o,o);t.exports=n?a:function(t){return function(){return o.apply(t,arguments)}}},9519:function(t,e,r){"use strict";var n,i,o=r(4576),a=r(2839),s=o.process,c=o.Deno,u=s&&s.versions||c&&c.version,l=u&&u.v8;l&&(n=l.split("."),i=n[0]>0&&n[0]<4?1:+(n[0]+n[1])),!i&&a&&(n=a.match(/Edge\/(\d+)/),(!n||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/),n&&(i=+n[1]))),t.exports=i},9548:function(t,e,r){"use strict";function n(t,e){for(var r=[],n={},i=0;i<e.length;i++){var o=e[i],a=o[0],s=o[1],c=o[2],u=o[3],l={id:t+":"+i,css:s,media:c,sourceMap:u};n[a]?n[a].parts.push(l):r.push(n[a]={id:a,parts:[l]})}return r}r.d(e,{A:function(){return p}});var i="undefined"!==typeof document;if("undefined"!==typeof DEBUG&&DEBUG&&!i)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var o={},a=i&&(document.head||document.getElementsByTagName("head")[0]),s=null,c=0,u=!1,l=function(){},f=null,h="data-vue-ssr-id",d="undefined"!==typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function p(t,e,r,i){u=r,f=i||{};var a=n(t,e);return m(a),function(e){for(var r=[],i=0;i<a.length;i++){var s=a[i],c=o[s.id];c.refs--,r.push(c)}e?(a=n(t,e),m(a)):a=[];for(i=0;i<r.length;i++){c=r[i];if(0===c.refs){for(var u=0;u<c.parts.length;u++)c.parts[u]();delete o[c.id]}}}}function m(t){for(var e=0;e<t.length;e++){var r=t[e],n=o[r.id];if(n){n.refs++;for(var i=0;i<n.parts.length;i++)n.parts[i](r.parts[i]);for(;i<r.parts.length;i++)n.parts.push(g(r.parts[i]));n.parts.length>r.parts.length&&(n.parts.length=r.parts.length)}else{var a=[];for(i=0;i<r.parts.length;i++)a.push(g(r.parts[i]));o[r.id]={id:r.id,refs:1,parts:a}}}}function v(){var t=document.createElement("style");return t.type="text/css",a.appendChild(t),t}function g(t){var e,r,n=document.querySelector("style["+h+'~="'+t.id+'"]');if(n){if(u)return l;n.parentNode.removeChild(n)}if(d){var i=c++;n=s||(s=v()),e=y.bind(null,n,i,!1),r=y.bind(null,n,i,!0)}else n=v(),e=w.bind(null,n),r=function(){n.parentNode.removeChild(n)};return e(t),function(n){if(n){if(n.css===t.css&&n.media===t.media&&n.sourceMap===t.sourceMap)return;e(t=n)}else r()}}var b=function(){var t=[];return function(e,r){return t[e]=r,t.filter(Boolean).join("\n")}}();function y(t,e,r,n){var i=r?"":n.css;if(t.styleSheet)t.styleSheet.cssText=b(e,i);else{var o=document.createTextNode(i),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(o,a[e]):t.appendChild(o)}}function w(t,e){var r=e.css,n=e.media,i=e.sourceMap;if(n&&t.setAttribute("media",n),f.ssrId&&t.setAttribute(h,e.id),i&&(r+="\n/*# sourceURL="+i.sources[0]+" */",r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */"),t.styleSheet)t.styleSheet.cssText=r;else{while(t.firstChild)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(r))}}},9565:function(t,e,r){"use strict";var n=r(616),i=Function.prototype.call;t.exports=n?i.bind(i):function(){return i.apply(i,arguments)}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={id:n,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}r.m=t,function(){r.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return r.d(e,{a:e}),e}}(),function(){r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})}}(),function(){r.u=function(t){return"xjzh-component.umd.min."+t+".js"}}(),function(){r.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()}(),function(){r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}(),function(){r.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}}(),function(){r.p=""}(),function(){r.b=document.baseURI||self.location.href}();var n={};return function(){"use strict";if(r.r(n),r.d(n,{default:function(){return T}}),"undefined"!==typeof window){var t=window.document.currentScript,e=t&&t.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);e&&(r.p=e[1])}var i=function(){var t=this,e=t._self._c;return e("div",{staticClass:"xjzh-img-canvas"},t._l(t.cameraObj,function(r,n){return e("div",{key:n,class:["itemBox",r.isFullScreen?"full-screen":""],style:{width:t.width,height:t.height},on:{click:function(e){return t.handleScreen(n)}}},[e("p",{directives:[{name:"show",rawName:"v-show",value:t.showTitle,expression:"showTitle"}],staticClass:"item-title"},[t._v(t._s(r.title))]),e("canvas",{ref:r.domeId,refInFor:!0})])}),0)},o=[],a=(r(4603),r(7566),r(8721),{name:"XjzhImgCanvas",props:{videoUrl:{type:String,default:"localhost:56000"},width:{type:String,default:"480px"},height:{type:String,default:"270px"},showTitle:{type:Boolean,default:!0},isSwitchSide:{type:Boolean,default:!1},canvasSize:{type:Array,default:()=>[1920,1080]}},watch:{isSwitchSide:{handler(t){console.log("object :>> ",t),this.cameraType[2].label=this.isSwitchSide?"显":"侧"}}},data(){return{cameraNum:0,cameraType:[{label:"斜",value:"main"},{label:"俯",value:"sub"},{label:"侧",value:"side"}],currentFullScreen:"",answerPhoto:{canvas:null,ctx:null,isPhoto:!1,canvasSize:[1920,1080]},cameraObj:null}},mounted(){this.initWorker()},methods:{initAnswerPhoto(){this.answerPhoto.canvas=document.createElement("canvas"),this.answerPhoto.ctx=this.answerPhoto.canvas.getContext("2d"),this.answerPhoto.canvas.width=this.canvasSize[0]*this.cameraNum,this.answerPhoto.canvas.height=this.canvasSize[1]},initCanvas(){for(let t=0;t<this.cameraNum;t++){let e=this.cameraType[t].value;this.cameraObj[e].canvas=this.$refs[this.cameraObj[e].domeId][0],this.cameraObj[e].ctx=this.cameraObj[e].canvas.getContext("2d"),this.cameraObj[e].canvas.width=this.canvasSize[0],this.cameraObj[e].canvas.height=this.canvasSize[1],this.cameraObj[e].imgBox=new Image}},initWorker(){const t=`ws://${this.videoUrl}/socket`;let e=0;this.destroyWorker(),this.destroyCanvasData(),this.worker=new Worker(new URL(r.p+r.u(221),r.b)),this.worker.onmessage=async t=>{const{type:r,data:n,event:i,error:o}=t.data;if("message"===r){if("number"===typeof n){this.cameraNum=n;for(let t=0;t<this.cameraNum;t++){let e=this.cameraType[t].value;this.cameraObj[e]={domeId:`canvas_${e}`,title:this.cameraType[t].label,canvas:null,ctx:null,totalFPS:0,showTotalFPS:0,frameSkip:0,imgBox:null,allUrl:[],isLoading:!1,isFullScreen:!1}}return this.$forceUpdate(),void this.$nextTick(()=>{this.initAnswerPhoto(),this.initCanvas()})}e++,this.showCanvas(this.cameraType[e-1].value,n),e=e>=this.cameraNum?0:e}"close"===r&&console.log("WebSocket closed:",i),"error"===r&&console.log(`WebSocket error: ${o.message}`)},this.worker.onerror=t=>{console.log(`Worker error: ${t.message}`)},this.cameraObj={},this.worker.postMessage({url:t})},destroyWorker(){this.worker&&(this.worker.terminate(),this.worker=null)},showCanvas(t,e){this.cameraObj[t].totalFPS++,this.cameraObj[t]&&this.cameraObj[t].imgBox&&this.cameraObj[t].ctx&&(this.currentFullScreen&&this.currentFullScreen!==t?this.destroyUrl(t):this.cameraObj[t].isLoading||(this.cameraObj[t].isLoading=!0,this.cameraObj[t].allUrl.unshift(URL.createObjectURL(e)),this.cameraObj[t].imgBox.src=this.cameraObj[t].allUrl[0],this.cameraObj[t].imgBox.onload=()=>{if(this.cameraObj[t].ctx){if(this.cameraObj[t].ctx.drawImage(this.cameraObj[t].imgBox,0,0,this.canvasSize[0],this.canvasSize[1]),this.cameraObj[t].isLoading=!1,this.answerPhoto.isPhoto)return this.cameraNum>0&&this.answerPhoto.ctx.drawImage(this.cameraObj.main.imgBox,0*this.answerPhoto.canvasSize[0],0,this.answerPhoto.canvasSize[0],this.answerPhoto.canvasSize[1]),this.cameraNum>1&&this.answerPhoto.ctx.drawImage(this.cameraObj.sub.imgBox,1*this.answerPhoto.canvasSize[0],0,this.answerPhoto.canvasSize[0],this.answerPhoto.canvasSize[1]),void(this.cameraNum>2&&this.answerPhoto.ctx.drawImage(this.cameraObj.side.imgBox,2*this.answerPhoto.canvasSize[0],0,this.answerPhoto.canvasSize[0],this.answerPhoto.canvasSize[1]));this.cameraObj[t].imgBox.src="",this.destroyUrl(t,this.cameraObj[t].maxUrlNum)}},this.cameraObj[t].imgBox.onerror=()=>{this.cameraObj[t].isLoading=!1,this.cameraObj[t]&&this.cameraObj[t].imgBox&&(this.cameraObj[t].imgBox.src="",this.destroyUrl(t,this.cameraObj[t].maxUrlNum))}))},handleScreen(t){this.$set(this.cameraObj[t],"isFullScreen",!this.cameraObj[t].isFullScreen),this.currentFullScreen=this.cameraObj[t].isFullScreen?t:"",this.$forceUpdate()},destroyCanvasData(){for(let t=0;t<this.cameraNum;t++){let e=this.cameraType[t].value;this.destroyUrl(e),this.destroyCanvas(e)}},destroyUrl(t){for(let e=0;e<this.cameraObj[t].allUrl.length;e++)URL.revokeObjectURL(this.cameraObj[t].allUrl[e]),delete this.cameraObj[t].allUrl[e];this.cameraObj[t].allUrl=[]},destroyCanvas(t){if(this.cameraObj[t])for(let e in this.cameraObj[t])"object"==typeof this.cameraObj[t][e]&&(this.cameraObj[t][e]=""),delete this.cameraObj[t][e]},allPhoto(){this.answerPhoto.isPhoto=!0;let t=(new Date).getTime();return new Promise(e=>{setTimeout(()=>{e(this.answerPhoto.canvas.toDataURL("image/jpeg"));let r=(new Date).getTime(),n=(r-t)/1e3;this.cameraObj.main.totalFPS=this.cameraObj.main.totalFPS+~~(30*n),this.cameraObj.sub.totalFPS=this.cameraObj.sub.totalFPS+~~(30*n),this.cameraObj.side.totalFPS=this.cameraObj.side.totalFPS+~~(30*n),this.answerPhoto.isPhoto=!1},200)})},selectPhoto(t){let e=this.cameraType[t-1].value;return this.videoObj.videoMergeSrc=this.cameraObj[e].canvas.toDataURL("image/jpeg"),this.videoObj.videoMergeSrc}},beforeDestroy(){this.answerPhoto.canvas=null,this.answerPhoto.ctx=null,this.destroyWorker(),this.destroyCanvasData()}}),s=a;r(6365);function c(t,e,r,n,i,o,a,s){var c,u="function"===typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=r,u._compiled=!0),n&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),a?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},u._ssrRegister=c):i&&(c=s?function(){i.call(this,(u.functional?this.parent:this).$root.$options.shadowRoot)}:i),c)if(u.functional){u._injectStyles=c;var l=u.render;u.render=function(t,e){return c.call(e),l(t,e)}}else{var f=u.beforeCreate;u.beforeCreate=f?[].concat(f,c):[c]}return{exports:t,options:u}}var u=c(s,i,o,!1,null,"5aa81db6",null),l=u.exports,f=function(){var t=this,e=t._self._c;return e("div")},h=[],d={name:"VideoRtsp",data(){return{}}},p=d,m=c(p,f,h,!1,null,null,null),v=m.exports,g=function(){var t=this,e=t._self._c;return e("div")},b=[],y={name:"VideoWebGl",data(){return{}}},w=y,x=c(w,g,b,!1,null,null,null),j=x.exports;const S=[l,v,j],O=function(t){O.installed||S.map(e=>t.component(e.name,e))};"undefined"!==typeof window&&window.Vue&&O(window.Vue);var P={install:O},T=P}(),n}()});
2
2
  //# sourceMappingURL=xjzh-component.umd.min.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xjzh-component",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "main": "dist/xjzh-component.umd.min.js",
6
6
  "scripts": {