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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ucservice",
3
3
  "private": false,
4
- "version": "1.3.7",
4
+ "version": "1.4.0",
5
5
  "description": "统一通信服务",
6
6
  "main": "dist/ucservice.common.js",
7
7
  "style": "ucservice.css",
@@ -151,15 +151,15 @@
151
151
  }
152
152
  .rotate-btn {
153
153
  position: absolute;
154
- bottom: -8px;
155
- right: 70px;
154
+ bottom: 1px;
155
+ right: 76px;
156
156
  border: 0;
157
- width: 48px;
158
- height: 48px;
159
- float: left;
160
- /* background-image: url("~@/img/yy_gb.png"); */
161
- background-size: 100% 100%;
162
- background-color: rgba(0,0,0,0);
157
+ width: 28px;
158
+ height: 28px;
159
+ float: left;
160
+ /* background-image: url("~@/img/yy_gb.png"); */
161
+ background-size: 100% 100%;
162
+ background-color: rgba(0,0,0,0);
163
163
  }
164
164
  .recv-audio-btn {
165
165
  position: absolute;
@@ -1598,7 +1598,7 @@
1598
1598
  for(let k = 0; k < _li.length; k++){
1599
1599
  let rotateIndex = _li.eq(k).find('button[name=rotateVideo]').attr('rotate-index');
1600
1600
  if(rotateIndex != 0 && rotateIndex != 2)
1601
- videoRotateSize(_li.eq(k), rotateIndex);
1601
+ me.videoRotateSize(_li.eq(k)[0], rotateIndex);
1602
1602
  }
1603
1603
  },
1604
1604
 
@@ -2013,6 +2013,11 @@
2013
2013
  */
2014
2014
  _init: function($dom,opts){
2015
2015
  let me = this;
2016
+ //保存dom元素的selector用作后续所有子集对象的定位(在多组件对讲模式下有用)
2017
+ if($dom.length == 0 || !me.getDomSelector($dom)) {
2018
+ console.error("父doom元素为空,无法进行视频初始化", $dom);
2019
+ return ;
2020
+ }
2016
2021
  //配置项
2017
2022
  me._opts = {
2018
2023
  windows: 4,
@@ -2105,16 +2110,44 @@
2105
2110
  if(videoWidth / videoHeight > liWidth / liHeight){ //视频横向留白
2106
2111
  $(video).css('width', liHeight);
2107
2112
  $(video).css('height', 'auto');
2108
- $(video).css('left', 'calc(' + liWidth + ' / 2' + ' - ' + liHeight + ' / 2)');
2109
- $(video).css('top', 'calc(-' + liHeight / 2 + ' / ' + vWidth + ' * ' + vHeight + ' + ' + liHeight + ' / 2)');
2113
+ $(video).css('left', 'calc(' + liWidth + 'px / 2' + ' - ' + liHeight + 'px / 2)');
2114
+ $(video).css('top', 'calc(-' + liHeight / 2 + ' / ' + vWidth + ' * ' + vHeight + 'px + ' + liHeight + 'px / 2)');
2110
2115
  }else { //视频纵向留白
2111
2116
  $(video).css('height', liWidth);
2112
2117
  $(video).css('width', 'auto');
2113
- $(video).css('left', 'calc(' + liHeight + ' / 2' + ' - ' + liWidth + ' / 2)');
2114
- $(video).css('top', 'calc(-' + liWidth / 2 + ' / ' + vHeight + ' * ' + vWidth + ' + ' + liWidth + ' / 2)');
2118
+ $(video).css('left', 'calc(' + liHeight + 'px / 2' + ' - ' + liWidth + 'px / 2)');
2119
+ $(video).css('top', 'calc(-' + liWidth / 2 + ' / ' + vHeight + ' * ' + vWidth + 'px + ' + liWidth + 'px / 2)');
2115
2120
  }
2116
2121
  }
2117
2122
  },
2123
+ /**
2124
+ * 获取父窗口传入dom的唯一selector(针对jquery高版本dom对象没有selector属性的问题)
2125
+ * @param $dom
2126
+ * @return {boolean}
2127
+ */
2128
+ getDomSelector: function($dom) {
2129
+ var me = this;
2130
+ if($dom.selector) {
2131
+ me.selector = $dom.selector;
2132
+ }
2133
+ else {
2134
+ if($dom.attr("id")) {
2135
+ me.selector = "#" + $dom.attr("id");
2136
+ }
2137
+ else {
2138
+ if(!$dom.attr("class")) return false;
2139
+ var classNames = $dom.attr("class").split(/\s+/);
2140
+ $.each(classNames, function (i, className) {
2141
+ if ($("." + className).length == 1) {
2142
+ me.selector = "." + className;
2143
+ return true;
2144
+ }
2145
+ });
2146
+ }
2147
+ }
2148
+ if(!me.selector) return false;
2149
+ else return true;
2150
+ },
2118
2151
 
2119
2152
  /**
2120
2153
  * 初始化按钮点击事件
@@ -2174,7 +2207,7 @@
2174
2207
  rotateIndex++
2175
2208
  $(this).attr("rotate-index", rotateIndex % 4);
2176
2209
  let li = $(this).parent().parent()[0];
2177
- videoRotateSize(li, rotateIndex)
2210
+ me.videoRotateSize(li, rotateIndex)
2178
2211
  })
2179
2212
 
2180
2213
  //接收音频事件
@@ -2401,7 +2434,7 @@
2401
2434
  let videoHtml = '<ul class="' + objClass +'" id="video-main-web-rtc" video-flag="'+me._opts.windowsBeginIndex+'">';
2402
2435
  let index = me._opts.windowsBeginIndex + 1;
2403
2436
  for (let i = index; i < index + me._opts.windowsNum; i++) {
2404
- videoHtml += '<li class="screen-' + i +'" index="' + (i - 1) +'"><video class="video-box" id="video-' + i +'" autoplay ></video>' +
2437
+ videoHtml += '<li class="screen-' + i +'" index="' + (i - 1) +'" draggable="true"><video class="video-box" id="video-' + i +'" autoplay ></video>' +
2405
2438
  '<div class="info hide" id="info-' + i +'"></div>' +
2406
2439
  '<div class="operate-btn">';
2407
2440
  //videoHtml +='<button type="button" class="unlock-video-btn hide" name="lockVideo"></button>';