ucservice 1.3.5 → 1.3.8

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.
@@ -12455,7 +12455,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
12455
12455
  windowNums: num
12456
12456
  });
12457
12457
  me._opts.windows = num;
12458
- me._opts.extra = extra;
12458
+ me._opts.extra = extra; //设置旋转了的视频样式
12459
12459
  },
12460
12460
 
12461
12461
  /**
@@ -13459,7 +13459,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
13459
13459
  this.dispatch('screenchange', {
13460
13460
  windowNums: num,
13461
13461
  flag: me._opts.flag
13462
- });
13462
+ }); //设置旋转视频的样式
13463
+
13464
+ for (let k = 0; k < _li.length; k++) {
13465
+ let rotateIndex = _li.eq(k).find('button[name=rotateVideo]').attr('rotate-index');
13466
+
13467
+ if (rotateIndex != 0 && rotateIndex != 2) videoRotateSize(_li.eq(k), rotateIndex);
13468
+ }
13463
13469
  },
13464
13470
 
13465
13471
  /**
@@ -13870,7 +13876,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
13870
13876
  };
13871
13877
  */
13872
13878
  _init: function ($dom, opts) {
13873
- let me = this; //配置项
13879
+ let me = this; //保存dom元素的selector用作后续所有子集对象的定位(在多组件对讲模式下有用)
13880
+
13881
+ if ($dom.length == 0 || !me.getDomSelector($dom)) {
13882
+ console.error("父doom元素为空,无法进行视频初始化", $dom);
13883
+ return;
13884
+ } //配置项
13885
+
13874
13886
 
13875
13887
  me._opts = {
13876
13888
  windows: 4,
@@ -13927,11 +13939,134 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
13927
13939
  me._dbClickFullScreen();
13928
13940
  },
13929
13941
 
13942
+ videoRotateSize(li, rotateIndex) {
13943
+ let video = li.querySelector('video');
13944
+ let videoWidth = video.videoWidth;
13945
+ let videoHeight = video.videoHeight;
13946
+ let vWidth = video.offsetWidth;
13947
+ let vHeight = video.offsetHeight;
13948
+ let liWidth = li.offsetWidth;
13949
+ let liHeight = li.offsetHeight;
13950
+
13951
+ if (rotateIndex == 0) {
13952
+ //0
13953
+ $(video).attr('class', 'video-box');
13954
+ $(video).css('height', '');
13955
+ $(video).css('width', 'auto');
13956
+ video.style.position = 'static';
13957
+ video.style.transform = 'none';
13958
+ $(video).css('left', '');
13959
+ $(video).css('top', '');
13960
+ } else if (rotateIndex == 3) {
13961
+ //3
13962
+ $(video).attr('class', 'video-box');
13963
+ video.style.position = 'absolute';
13964
+ video.style.transform = 'rotate(270deg)';
13965
+
13966
+ if (videoWidth / videoHeight > liWidth / liHeight) {
13967
+ //视频横向留白
13968
+ $(video).css('width', liHeight);
13969
+ $(video).css('height', 'auto');
13970
+ $(video).css('left', 'calc(' + liWidth + ' / 2' + ' - ' + liHeight + ' / 2)');
13971
+ $(video).css('top', 'calc(-' + liHeight / 2 + ' / ' + vWidth + ' * ' + vHeight + ' + ' + liHeight + ' / 2)');
13972
+ } else {
13973
+ //视频纵向留白
13974
+ $(video).css('height', liWidth);
13975
+ $(video).css('width', 'auto');
13976
+ $(video).css('left', 'calc(' + liHeight + ' / 2' + ' - ' + liWidth + ' / 2)');
13977
+ $(video).css('top', 'calc(-' + liWidth / 2 + ' / ' + vHeight + ' * ' + vWidth + ' + ' + liWidth + ' / 2)');
13978
+ }
13979
+ } else if (rotateIndex == 2) {
13980
+ //2
13981
+ $(video).attr('class', 'video-box');
13982
+ $(video).css('height', '');
13983
+ $(video).css('width', 'auto');
13984
+ video.style.position = 'static';
13985
+ video.style.transform = 'rotate(180deg)';
13986
+ $(video).css('left', '');
13987
+ $(video).css('top', '');
13988
+ } else if (rotateIndex == 1) {
13989
+ //1
13990
+ $(video).attr('class', 'video-box');
13991
+ video.style.position = 'absolute';
13992
+ video.style.transform = 'rotate(90deg)';
13993
+
13994
+ if (videoWidth / videoHeight > liWidth / liHeight) {
13995
+ //视频横向留白
13996
+ $(video).css('width', liHeight);
13997
+ $(video).css('height', 'auto');
13998
+ $(video).css('left', 'calc(' + liWidth + ' / 2' + ' - ' + liHeight + ' / 2)');
13999
+ $(video).css('top', 'calc(-' + liHeight / 2 + ' / ' + vWidth + ' * ' + vHeight + ' + ' + liHeight + ' / 2)');
14000
+ } else {
14001
+ //视频纵向留白
14002
+ $(video).css('height', liWidth);
14003
+ $(video).css('width', 'auto');
14004
+ $(video).css('left', 'calc(' + liHeight + ' / 2' + ' - ' + liWidth + ' / 2)');
14005
+ $(video).css('top', 'calc(-' + liWidth / 2 + ' / ' + vHeight + ' * ' + vWidth + ' + ' + liWidth + ' / 2)');
14006
+ }
14007
+ }
14008
+ },
14009
+
14010
+ /**
14011
+ * 获取父窗口传入dom的唯一selector(针对jquery高版本dom对象没有selector属性的问题)
14012
+ * @param $dom
14013
+ * @return {boolean}
14014
+ */
14015
+ getDomSelector: function ($dom) {
14016
+ var me = this;
14017
+
14018
+ if ($dom.selector) {
14019
+ me.selector = $dom.selector;
14020
+ } else {
14021
+ if ($dom.attr("id")) {
14022
+ me.selector = "#" + $dom.attr("id");
14023
+ } else {
14024
+ if (!$dom.attr("class")) return false;
14025
+ var classNames = $dom.attr("class").split(/\s+/);
14026
+ $.each(classNames, function (i, className) {
14027
+ if ($("." + className).length == 1) {
14028
+ me.selector = "." + className;
14029
+ return true;
14030
+ }
14031
+ });
14032
+ }
14033
+ }
14034
+
14035
+ if (!me.selector) return false;else return true;
14036
+ },
14037
+
13930
14038
  /**
13931
14039
  * 初始化按钮点击事件
13932
14040
  */
13933
14041
  _initBtnEvent: function () {
13934
- let me = this;
14042
+ let me = this; // 设置视频窗可拖拽
14043
+
14044
+ var src = null;
14045
+ $(me.selector + ' li').bind("dragstart", function (ev) {
14046
+ src = $(this);
14047
+ });
14048
+ $(me.selector + ' li').bind("dragover", function (ev) {
14049
+ ev.preventDefault();
14050
+ });
14051
+ $(me.selector + ' li').bind("drop", function (ev) {
14052
+ ev.preventDefault();
14053
+
14054
+ if (src.prop("outerHTML") === $(this).prop("outerHTML")) {
14055
+ return;
14056
+ }
14057
+
14058
+ var target = $(this);
14059
+ var srcIndex = src.index();
14060
+ var targetIndex = target.index();
14061
+
14062
+ if (srcIndex > targetIndex) {
14063
+ src.insertBefore(target);
14064
+ target.insertAfter($(me.selector + ' .video-main li.screen').eq(srcIndex));
14065
+ } else {
14066
+ src.insertAfter(target);
14067
+ target.insertBefore($(me.selector + ' .video-main li.screen').eq(srcIndex));
14068
+ }
14069
+ });
13935
14070
  let videoFlagObj = $('[video-flag="' + me._opts.windowsBeginIndex + '"]'); //锁定视频事件
13936
14071
 
13937
14072
  videoFlagObj.find("button[name='lockVideo']").click(function () {
@@ -13949,6 +14084,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
13949
14084
  me.VIDEO_DATA[index].isLockVideo = true;
13950
14085
  $(this).attr('class', 'lock-video-btn');
13951
14086
  }
14087
+ });
14088
+ videoFlagObj.find('button[name=rotateVideo]').click(function () {
14089
+ let rotateIndex = Number($(this).attr("rotate-index"));
14090
+ rotateIndex++;
14091
+ $(this).attr("rotate-index", rotateIndex % 4);
14092
+ let li = $(this).parent().parent()[0];
14093
+ videoRotateSize(li, rotateIndex);
13952
14094
  }); //接收音频事件
13953
14095
 
13954
14096
  videoFlagObj.find("button[name='recvAudio']").click(function () {
@@ -14185,7 +14327,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
14185
14327
  for (let i = index; i < index + me._opts.windowsNum; i++) {
14186
14328
  videoHtml += '<li class="screen-' + i + '" index="' + (i - 1) + '"><video class="video-box" id="video-' + i + '" autoplay ></video>' + '<div class="info hide" id="info-' + i + '"></div>' + '<div class="operate-btn">'; //videoHtml +='<button type="button" class="unlock-video-btn hide" name="lockVideo"></button>';
14187
14329
 
14188
- checkUserMediaAvailable() && (videoHtml += '<button type="button" class="unsend-audio-btn hide" name="sendAudio"></button>');
14330
+ checkUserMediaAvailable() && (videoHtml += '<button type="button" class="rotate-btn hide" name="rotateVideo" rotate-index="0"></button><button type="button" class="unsend-audio-btn hide" name="sendAudio"></button>');
14189
14331
  videoHtml += '<button type="button" class="unrecv-audio-btn hide" name="recvAudio"></button>' + '<button type="button" class="close-btn hide" name="closeVideo"></button>' + '</div>' + '</li>';
14190
14332
  }
14191
14333
 
@@ -28439,7 +28581,9 @@ let location_url_location = {
28439
28581
  requestParam: {
28440
28582
  mapId: '',
28441
28583
  //地图类型
28442
- layers: '' //设备类型
28584
+ kw: '',
28585
+ //关键字
28586
+ layers: '' //设备类型 可选
28443
28587
 
28444
28588
  },
28445
28589
  responseParam: {
Binary file