ucservice 1.3.5 → 1.3.6

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.5",
4
+ "version": "1.3.6",
5
5
  "description": "统一通信服务",
6
6
  "main": "dist/ucservice.common.js",
7
7
  "style": "ucservice.css",
@@ -149,6 +149,18 @@
149
149
  background-size: 100% 100%;
150
150
  background-color: rgba(0,0,0,0);
151
151
  }
152
+ .rotate-btn {
153
+ position: absolute;
154
+ bottom: -8px;
155
+ right: 70px;
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);
163
+ }
152
164
  .recv-audio-btn {
153
165
  position: absolute;
154
166
  bottom: -8px;
@@ -189,7 +189,8 @@ let location = {
189
189
  method: 'POST',
190
190
  requestParam: {
191
191
  mapId: '', //地图类型
192
- layers: '' //设备类型
192
+ kw: '', //关键字
193
+ layers: '' //设备类型 可选
193
194
  },
194
195
  responseParam: {
195
196
  code: '', //返回结果状态码
@@ -612,7 +612,9 @@
612
612
  me.dispatch('screenchange',{windowNums: num});
613
613
  me._opts.windows = num;
614
614
  me._opts.extra = extra;
615
-
615
+
616
+ //设置旋转了的视频样式
617
+
616
618
  },
617
619
 
618
620
  /**
@@ -1583,14 +1585,21 @@
1583
1585
  me.setChoiceWindow(me._getMinIndexFreeWindow());
1584
1586
  }
1585
1587
 
1586
- $('[video-flag="'+me._opts.windowsBeginIndex+'"]').removeClass("mode-" + me._opts.windows).addClass("mode-" + num);
1587
- let _li = $('[video-flag="'+me._opts.windowsBeginIndex+'"]>li').hide();
1588
- me._opts.windows = num;
1589
- for(let i = 0; i < num; i++){
1590
- _li.eq(i).show();
1591
- }
1592
- //分屏切换事件
1593
- this.dispatch('screenchange', {windowNums:num, flag:me._opts.flag});
1588
+ $('[video-flag="'+me._opts.windowsBeginIndex+'"]').removeClass("mode-" + me._opts.windows).addClass("mode-" + num);
1589
+ let _li = $('[video-flag="'+me._opts.windowsBeginIndex+'"]>li').hide();
1590
+ me._opts.windows = num;
1591
+ for(let i = 0; i < num; i++){
1592
+ _li.eq(i).show();
1593
+ }
1594
+ //分屏切换事件
1595
+ this.dispatch('screenchange', {windowNums:num, flag:me._opts.flag});
1596
+
1597
+ //设置旋转视频的样式
1598
+ for(let k = 0; k < _li.length(); k++){
1599
+ let rotateIndex = _li.eq(k).find('button[name=rotateVideo]').attr('rotate-index');
1600
+ if(rotateIndex != 0 && rotateIndex != 2)
1601
+ videoRotateSize(_li.eq(k), rotateIndex);
1602
+ }
1594
1603
  },
1595
1604
 
1596
1605
  /**
@@ -2049,12 +2058,98 @@
2049
2058
  //双击某个视频全屏
2050
2059
  me._dbClickFullScreen();
2051
2060
  },
2061
+
2062
+ videoRotateSize(li, rotateIndex){
2063
+ let video = li.querySelector('video');
2064
+ let videoWidth = video.videoWidth;
2065
+ let videoHeight = video.videoHeight;
2066
+ let vWidth = video.offsetWidth
2067
+ let vHeight = video.offsetHeight
2068
+ let liWidth = li.offsetWidth;
2069
+ let liHeight = li.offsetHeight;
2070
+ if(rotateIndex == 0){ //0
2071
+ $(video).attr('class', 'video-box');
2072
+ $(video).css('height', '');
2073
+ $(video).css('width', 'auto');
2074
+ video.style.position = 'static';
2075
+ video.style.transform = 'none';
2076
+ $(video).css('left', '');
2077
+ $(video).css('top', '');
2078
+ }else if(rotateIndex == 3){ //3
2079
+ $(video).attr('class', 'video-box');
2080
+ video.style.position = 'absolute';
2081
+ video.style.transform = 'rotate(270deg)';
2082
+ if(videoWidth / videoHeight > liWidth / liHeight){ //视频横向留白
2083
+ $(video).css('width', liHeight);
2084
+ $(video).css('height', 'auto');
2085
+ $(video).css('left', 'calc(' + liWidth + ' / 2' + ' - ' + liHeight + ' / 2)');
2086
+ $(video).css('top', 'calc(-' + liHeight / 2 + ' / ' + vWidth + ' * ' + vHeight + ' + ' + liHeight + ' / 2)');
2087
+ }else { //视频纵向留白
2088
+ $(video).css('height', liWidth);
2089
+ $(video).css('width', 'auto');
2090
+ $(video).css('left', 'calc(' + liHeight + ' / 2' + ' - ' + liWidth + ' / 2)');
2091
+ $(video).css('top', 'calc(-' + liWidth / 2 + ' / ' + vHeight + ' * ' + vWidth + ' + ' + liWidth + ' / 2)');
2092
+ }
2093
+ }else if(rotateIndex == 2){ //2
2094
+ $(video).attr('class', 'video-box');
2095
+ $(video).css('height', '');
2096
+ $(video).css('width', 'auto');
2097
+ video.style.position = 'static';
2098
+ video.style.transform = 'rotate(180deg)';
2099
+ $(video).css('left', '');
2100
+ $(video).css('top', '');
2101
+ }else if(rotateIndex == 1){ //1
2102
+ $(video).attr('class', 'video-box');
2103
+ video.style.position = 'absolute';
2104
+ video.style.transform = 'rotate(90deg)';
2105
+ if(videoWidth / videoHeight > liWidth / liHeight){ //视频横向留白
2106
+ $(video).css('width', liHeight);
2107
+ $(video).css('height', 'auto');
2108
+ $(video).css('left', 'calc(' + liWidth + ' / 2' + ' - ' + liHeight + ' / 2)');
2109
+ $(video).css('top', 'calc(-' + liHeight / 2 + ' / ' + vWidth + ' * ' + vHeight + ' + ' + liHeight + ' / 2)');
2110
+ }else { //视频纵向留白
2111
+ $(video).css('height', liWidth);
2112
+ $(video).css('width', 'auto');
2113
+ $(video).css('left', 'calc(' + liHeight + ' / 2' + ' - ' + liWidth + ' / 2)');
2114
+ $(video).css('top', 'calc(-' + liWidth / 2 + ' / ' + vHeight + ' * ' + vWidth + ' + ' + liWidth + ' / 2)');
2115
+ }
2116
+ }
2117
+ },
2052
2118
 
2053
2119
  /**
2054
2120
  * 初始化按钮点击事件
2055
2121
  */
2056
2122
  _initBtnEvent: function() {
2057
2123
  let me = this;
2124
+
2125
+ // 设置视频窗可拖拽
2126
+ var src = null;
2127
+ $(me.selector + ' li').bind("dragstart", function (ev) {
2128
+ src = $(this);
2129
+ })
2130
+
2131
+ $(me.selector + ' li').bind("dragover", function (ev) {
2132
+ ev.preventDefault();
2133
+ })
2134
+
2135
+ $(me.selector + ' li').bind("drop", function (ev) {
2136
+ ev.preventDefault();
2137
+ if(src.prop("outerHTML") === $(this).prop("outerHTML")){
2138
+ return;
2139
+ }
2140
+ var target = $(this);
2141
+ var srcIndex = src.index();
2142
+ var targetIndex = target.index();
2143
+
2144
+ if (srcIndex > targetIndex) {
2145
+ src.insertBefore(target);
2146
+ target.insertAfter($(me.selector +' .video-main li.screen').eq(srcIndex));
2147
+ } else {
2148
+ src.insertAfter(target);
2149
+ target.insertBefore($(me.selector +' .video-main li.screen').eq(srcIndex));
2150
+ }
2151
+ })
2152
+
2058
2153
  let videoFlagObj = $('[video-flag="'+me._opts.windowsBeginIndex+'"]');
2059
2154
 
2060
2155
  //锁定视频事件
@@ -2074,6 +2169,13 @@
2074
2169
  $(this).attr('class', 'lock-video-btn');
2075
2170
  }
2076
2171
  });
2172
+ videoFlagObj.find('button[name=rotateVideo]').click(function(){
2173
+ let rotateIndex = Number($(this).attr("rotate-index"));
2174
+ rotateIndex++
2175
+ $(this).attr("rotate-index", rotateIndex % 4);
2176
+ let li = $(this).parent().parent()[0];
2177
+ videoRotateSize(li, rotateIndex)
2178
+ })
2077
2179
 
2078
2180
  //接收音频事件
2079
2181
  videoFlagObj.find("button[name='recvAudio']").click(function(){
@@ -2303,7 +2405,7 @@
2303
2405
  '<div class="info hide" id="info-' + i +'"></div>' +
2304
2406
  '<div class="operate-btn">';
2305
2407
  //videoHtml +='<button type="button" class="unlock-video-btn hide" name="lockVideo"></button>';
2306
- checkUserMediaAvailable() && (videoHtml += '<button type="button" class="unsend-audio-btn hide" name="sendAudio"></button>');
2408
+ 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>');
2307
2409
  videoHtml += '<button type="button" class="unrecv-audio-btn hide" name="recvAudio"></button>' +
2308
2410
  '<button type="button" class="close-btn hide" name="closeVideo"></button>' +
2309
2411
  '</div>' +