ucservice 1.3.7 → 1.4.0

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.
@@ -13464,7 +13464,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
13464
13464
  for (let k = 0; k < _li.length; k++) {
13465
13465
  let rotateIndex = _li.eq(k).find('button[name=rotateVideo]').attr('rotate-index');
13466
13466
 
13467
- if (rotateIndex != 0 && rotateIndex != 2) videoRotateSize(_li.eq(k), rotateIndex);
13467
+ if (rotateIndex != 0 && rotateIndex != 2) me.videoRotateSize(_li.eq(k)[0], rotateIndex);
13468
13468
  }
13469
13469
  },
13470
13470
 
@@ -13876,7 +13876,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
13876
13876
  };
13877
13877
  */
13878
13878
  _init: function ($dom, opts) {
13879
- 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
+
13880
13886
 
13881
13887
  me._opts = {
13882
13888
  windows: 4,
@@ -13989,18 +13995,46 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
13989
13995
  //视频横向留白
13990
13996
  $(video).css('width', liHeight);
13991
13997
  $(video).css('height', 'auto');
13992
- $(video).css('left', 'calc(' + liWidth + ' / 2' + ' - ' + liHeight + ' / 2)');
13993
- $(video).css('top', 'calc(-' + liHeight / 2 + ' / ' + vWidth + ' * ' + vHeight + ' + ' + liHeight + ' / 2)');
13998
+ $(video).css('left', 'calc(' + liWidth + 'px / 2' + ' - ' + liHeight + 'px / 2)');
13999
+ $(video).css('top', 'calc(-' + liHeight / 2 + ' / ' + vWidth + ' * ' + vHeight + 'px + ' + liHeight + 'px / 2)');
13994
14000
  } else {
13995
14001
  //视频纵向留白
13996
14002
  $(video).css('height', liWidth);
13997
14003
  $(video).css('width', 'auto');
13998
- $(video).css('left', 'calc(' + liHeight + ' / 2' + ' - ' + liWidth + ' / 2)');
13999
- $(video).css('top', 'calc(-' + liWidth / 2 + ' / ' + vHeight + ' * ' + vWidth + ' + ' + liWidth + ' / 2)');
14004
+ $(video).css('left', 'calc(' + liHeight + 'px / 2' + ' - ' + liWidth + 'px / 2)');
14005
+ $(video).css('top', 'calc(-' + liWidth / 2 + ' / ' + vHeight + ' * ' + vWidth + 'px + ' + liWidth + 'px / 2)');
14000
14006
  }
14001
14007
  }
14002
14008
  },
14003
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
+
14004
14038
  /**
14005
14039
  * 初始化按钮点击事件
14006
14040
  */
@@ -14056,7 +14090,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
14056
14090
  rotateIndex++;
14057
14091
  $(this).attr("rotate-index", rotateIndex % 4);
14058
14092
  let li = $(this).parent().parent()[0];
14059
- videoRotateSize(li, rotateIndex);
14093
+ me.videoRotateSize(li, rotateIndex);
14060
14094
  }); //接收音频事件
14061
14095
 
14062
14096
  videoFlagObj.find("button[name='recvAudio']").click(function () {
@@ -14291,7 +14325,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
14291
14325
  let index = me._opts.windowsBeginIndex + 1;
14292
14326
 
14293
14327
  for (let i = index; i < index + me._opts.windowsNum; i++) {
14294
- 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>';
14328
+ videoHtml += '<li class="screen-' + i + '" index="' + (i - 1) + '" draggable="true"><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>';
14295
14329
 
14296
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>');
14297
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>';
Binary file