react_hsbc_teller 0.3.0 → 0.3.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "react_hsbc_teller",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -105,12 +105,12 @@ export default class foot extends Component {
105
105
  {screenName}
106
106
  </div>
107
107
  </div>
108
- <div className="one" onClick={this.suspend.bind(this)}>
108
+ {/* <div className="one" onClick={this.suspend.bind(this)}>
109
109
  <img className="imgClass" src={require("../../assets/img/icon_suspend.png").default} alt="" />
110
110
  <div className="text">
111
111
  {suspendName}
112
112
  </div>
113
- </div>
113
+ </div> */}
114
114
  <Popover content={content} trigger="click" visible={this.state.clicked}>
115
115
  <div className="one" onClick={this.facialRecognition.bind(this)}>
116
116
  <img className="imgClass" src={require("../../assets/img/Face_recognition.png").default} alt="" />
@@ -25,6 +25,7 @@ const LEAVE_TYPE = {
25
25
  TELLER_EXIT: '1', // 坐席退出
26
26
  ROOM_DESTROYED: '-1', // 房间异常
27
27
  }
28
+ let pictureInPictureVideo = ''
28
29
  @injectIntl
29
30
  class Video extends Component {
30
31
  signCanvas = React.createRef();
@@ -67,6 +68,7 @@ class Video extends Component {
67
68
  rtoken: this.props.mtoken,
68
69
  sessionId: this.props.sessionId,
69
70
  imRoomId: this.props.imRoomId,
71
+ isPictureInPicture: false,
70
72
  };
71
73
  // eslint-disable-next-line no-undef
72
74
  test_controller = '';
@@ -434,27 +436,12 @@ class Video extends Component {
434
436
  };
435
437
  // 画中画
436
438
  pictureInPicture = () => {
437
- // const publish_config = {};
438
- // publish_config.media_type = 1;
439
- // publish_config.publish_device = 4;
440
- // publish_config.need_volume_analyser = true;
441
- // publish_config.video_profile_type = 3;
442
- // publish_config.part_of_screen_id = 'touBoxItem';
443
- // publish_config.publish_video_id = 'video3';
444
- // publish_config.publish_streamId_id = 'subscribe_streamId3';
445
- // // publish_config.publish_tag = 'sharedScreen'
446
- // this.test_controller.Publish(publish_config);
447
- // callNimIM('sendCustomCmdMsg', {
448
- // customId: this.state.imRoomId,
449
- // content: JSON.stringify({
450
- // 'typeId': 2030,
451
- // 'sessionId': this.state.sessionId,
452
- // 'sharedScreen': 1,
453
- // 'tellerId': this.props.tellerAccount
454
- // })
455
- // });
439
+ let interval
456
440
  if (this.isFileSuccuse()) {
457
- const list = []
441
+ if(this.state.isPictureInPicture){
442
+ document.exitPictureInPicture()
443
+ } else {
444
+ const list = []
458
445
  if(document.getElementById('video1').name) {
459
446
  list.push('video1')
460
447
  }
@@ -486,7 +473,7 @@ class Video extends Component {
486
473
  const cobj = canvas.getContext('2d'); // 获取绘图环境
487
474
  canvas.width = width;
488
475
  canvas.height = height;
489
- let interval = setInterval(() => {
476
+ interval = setInterval(() => {
490
477
  cobj.clearRect(0, 0, width, height);
491
478
  for(let i=0;i<list.length;i++){
492
479
 
@@ -501,54 +488,35 @@ class Video extends Component {
501
488
  } else {
502
489
  newVideoHeight = videoHeight * 320 / videoWidth;
503
490
  }
504
- cobj.drawImage(videoDiv, 320 * i, 480 - newVideoHeight, 320, newVideoHeight);
491
+ cobj.drawImage(videoDiv, 320 * i, (480 - newVideoHeight)/2, 320, newVideoHeight);
505
492
  }
506
- // cobj.clearRect(0, 0, width, height);
507
- // let videoId = 'publish_video1';
508
- // let videoDiv = document.getElementById(videoId);
509
- // let videoWidth = videoDiv.videoWidth;
510
- // let videoHeight = videoDiv.videoHeight;
511
- // let newVideoWidth = 320;
512
- // let newVideoHeight = 480;
513
- // if (videoHeight * 320 / videoWidth > 480) {
514
- // newVideoWidth = videoWidth * 480 / videoHeight;
515
- // } else {
516
- // newVideoHeight = videoHeight * 320 / videoWidth;
517
- // }
518
- // cobj.drawImage(videoDiv, 0, 480 - newVideoHeight, newVideoWidth, newVideoHeight);
519
-
520
- // let subscribeVideo = 'video1';
521
- // let subscribeVideoDiv = document.getElementById(subscribeVideo);
522
- // let subscribeVideoDivWidth = subscribeVideoDiv.videoWidth;
523
- // let subscribeVideoDivHeight = subscribeVideoDiv.videoHeight;
524
- // let newVideoWidth1 = 320;
525
- // let newVideoHeight1 = 480;
526
- // if (subscribeVideoDivHeight * 320 / subscribeVideoDivWidth > 480) {
527
- // newVideoWidth1 = subscribeVideoDivWidth * 480 / subscribeVideoDivHeight;
528
- // } else {
529
- // newVideoHeight1 = subscribeVideoDivHeight * 320 / subscribeVideoDivWidth;
530
- // }
531
- // cobj.drawImage(subscribeVideoDiv, 320, 480 - newVideoHeight1, newVideoWidth1, newVideoHeight1);
532
-
533
493
  }, 100);
534
494
  const captureStream = canvas.captureStream();
535
495
  const mix_stream = new MediaStream(captureStream);
536
- let video = document.getElementById('mixedvideo');
537
- video.srcObject = mix_stream;
538
- video.onloadedmetadata = () => {
539
- video.requestPictureInPicture();
496
+ pictureInPictureVideo = document.getElementById('mixedvideo');
497
+ pictureInPictureVideo.srcObject = mix_stream;
498
+ pictureInPictureVideo.onloadedmetadata = () => {
499
+ pictureInPictureVideo.requestPictureInPicture();
540
500
  };
501
+ }
502
+
541
503
 
542
- video.addEventListener('enterpictureinpicture', (event) => {
504
+ pictureInPictureVideo.addEventListener('enterpictureinpicture', (event) => {
543
505
  //可获取画中画窗口的一些数据,如宽高等
544
- video.style.display = 'block';
545
- video.play();
506
+ pictureInPictureVideo.style.display = 'block';
507
+ pictureInPictureVideo.play();
508
+ this.setState({
509
+ isPictureInPicture: true
510
+ })
546
511
  });
547
512
 
548
- video.addEventListener('leavepictureinpicture', (event) => {
549
- video.srcObject = null;
550
- video.style.display = "none";
513
+ pictureInPictureVideo.addEventListener('leavepictureinpicture', (event) => {
514
+ pictureInPictureVideo.srcObject = null;
515
+ pictureInPictureVideo.style.display = "none";
551
516
  clearInterval(interval);
517
+ this.setState({
518
+ isPictureInPicture: false
519
+ })
552
520
  });
553
521
  }
554
522
  };
@@ -1085,14 +1053,14 @@ class Video extends Component {
1085
1053
  let outcanvas = document.createElement("canvas");
1086
1054
  outcanvas.width = canvas.width;
1087
1055
  outcanvas.height = canvas.height;
1088
- ctx.strokeStyle = "#00847F";
1056
+ ctx.strokeStyle = "#db0011";
1089
1057
  ctx.lineWidth = 2;
1090
1058
  ctx.clearRect(0, 0, canvas.width, canvas.height); //清理画布
1091
1059
  let dataArray = new Uint8Array(analyser.frequencyBinCount);
1092
1060
  analyser.getByteFrequencyData(dataArray);
1093
1061
  let step = Math.round(dataArray.length / 60); //采样步长
1094
1062
  for (var i = 0; i < 40; i++) {
1095
- let energy = (dataArray[step * i] / 256.0) * 50;
1063
+ let energy = (dataArray[step * i] / 256.0) * 80;
1096
1064
  for (var j = 0; j < energy; j++) {
1097
1065
  ctx.beginPath();
1098
1066
  ctx.moveTo(20 * i + 2, 200 + 4 * j);
@@ -1113,7 +1081,7 @@ class Video extends Component {
1113
1081
  function draw() {
1114
1082
  ctx.drawImage(outcanvas, 0, 0);
1115
1083
  ctx.save();
1116
- ctx.translate(canvas.width / 2, canvas.height / 2);
1084
+ ctx.translate(canvas.width / 4, canvas.height / 2);
1117
1085
  ctx.rotate(Math.PI);
1118
1086
  ctx.scale(-1, 1);
1119
1087
  ctx.drawImage(outcanvas, -canvas.width / 2, -canvas.height / 2);
@@ -1159,6 +1127,7 @@ class Video extends Component {
1159
1127
  this.setState({
1160
1128
  isCustomer: false,
1161
1129
  isWhiteboard: false,
1130
+ isPictureInPicture: false,
1162
1131
  });
1163
1132
  this.props.onLeaveRoom({
1164
1133
  code: LEAVE_TYPE.TELLER_EXIT,
@@ -1262,7 +1231,7 @@ class Video extends Component {
1262
1231
  }
1263
1232
  componentWillMount() {
1264
1233
  if (this.props.sessionId) {
1265
- thid.getRoomStatus({
1234
+ this.getRoomStatus({
1266
1235
  sessionId: this.props.sessionId
1267
1236
  })
1268
1237
  } else {
@@ -1411,6 +1380,10 @@ class Video extends Component {
1411
1380
 
1412
1381
  screenName: '投屏'
1413
1382
  });
1383
+ console.log(pictureInPictureVideo)
1384
+ if(this.state.isPictureInPicture) {
1385
+ document.exitPictureInPicture()
1386
+ }
1414
1387
  } else {
1415
1388
  if (document.getElementById('video10').name) {
1416
1389
  publish_config.media_type = 1;
@@ -1442,6 +1415,10 @@ class Video extends Component {
1442
1415
  screenName: '取消共享',
1443
1416
  isPDF: false
1444
1417
  })
1418
+ if(!this.state.isPictureInPicture) {
1419
+ this.pictureInPicture()
1420
+ }
1421
+
1445
1422
  }
1446
1423
  }
1447
1424
  };
@@ -1736,7 +1713,7 @@ class Video extends Component {
1736
1713
  <Spin spinning={this.state.loading} tip="视频初始化中...">
1737
1714
  <Header></Header>
1738
1715
  <div className="health">
1739
- <div className="projection">
1716
+ <div className="projection" style={{ display: (this.state.isCustomer == 'noVideo') ? '' : 'none', }}>
1740
1717
  <div className="button">
1741
1718
  <div className={`${this.state.isSelect == 'video' ? 'selectSee' : "noSelest"}`} onClick={this.switchSelect.bind(this)}>视频画面</div>
1742
1719
  <div className={`${this.state.isSelect == 'noVideo' ? 'selectSee' : "noSelest"}`} onClick={this.switchSelect.bind(this)}>投屏白板</div>
@@ -1783,7 +1760,8 @@ class Video extends Component {
1783
1760
  />
1784
1761
  <audio id="audio1" autoPlay />
1785
1762
  <label style={{ display: 'none' }} id="feedId1" type="text" />
1786
- <canvas style={{ display: (this.state.isCustomer) ? '' : 'none', }} className="canvasClass" id="subscribe_volumeView1" width="20" height="50"></canvas>
1763
+ <div style={{ display: (this.state.isCustomer) ? '' : 'none', }} className='customerTitle'>客户</div>
1764
+ <canvas style={{ display: (this.state.isCustomer) ? '' : 'none', }} className="canvasClassOne" id="subscribe_volumeView1" width="40" height="70"></canvas>
1787
1765
  </div>
1788
1766
  </div>
1789
1767
  <div
@@ -1822,7 +1800,8 @@ class Video extends Component {
1822
1800
  />
1823
1801
  <audio id="audio1" autoPlay />
1824
1802
  <label style={{ display: 'none' }} id="publish_streamId1" type="text" />
1825
- <canvas style={{ display: (this.state.isCustomer) ? '' : 'none', }} className="canvasClass" id="publish_volumeView" width="20" height="50"></canvas>
1803
+ <div style={{ display: (this.state.isCustomer) ? '' : 'none', }} className='tellerTitle'>坐席</div>
1804
+ <canvas style={{ display: (this.state.isCustomer) ? '' : 'none', }} className="canvasClass" id="publish_volumeView" width="40" height="70"></canvas>
1826
1805
  </div>
1827
1806
 
1828
1807
  </div>
@@ -1837,7 +1816,8 @@ class Video extends Component {
1837
1816
  />
1838
1817
  <audio id="audio2" autoPlay />
1839
1818
  <label style={{ display: 'none' }} id="feedId2" type="text" />
1840
- <canvas style={{ display: (this.state.isCustomer) ? '' : 'none', }} className="canvasClass" id="subscribe_volumeView2" width="20" height="50"></canvas>
1819
+ {/* <div className='customerTitle'>客户</div> */}
1820
+ <canvas style={{ display: (this.state.isCustomer) ? '' : 'none', }} className="canvasClassOne" id="subscribe_volumeView2" width="40" height="70"></canvas>
1841
1821
  </div>
1842
1822
  </div>
1843
1823
  <div className={`itemed ${this.state.isBigVideo == 'video3' ? 'item1' : ""}`}
@@ -1850,7 +1830,8 @@ class Video extends Component {
1850
1830
  />
1851
1831
  <audio id="audio3" autoPlay />
1852
1832
  <label style={{ display: 'none' }} id="feedId3" type="text" />
1853
- <canvas style={{ display: (this.state.isCustomer) ? '' : 'none', }} className="canvasClass" id="subscribe_volumeView3" width="20" height="50"></canvas>
1833
+ {/* <div style={{ display: (this.state.isCustomer) ? '' : 'none', }} className='customerTitle'>客户</div> */}
1834
+ <canvas style={{ display: (this.state.isCustomer) ? '' : 'none', }} className="canvasClassOne" id="subscribe_volumeView3" width="40" height="70"></canvas>
1854
1835
  </div>
1855
1836
  <div className={`itemed ${this.state.isBigVideo == 'video4' ? 'item1' : ""}`}
1856
1837
  onClick={this.enlargeClick.bind(this, 'isLangVideo4')}>
@@ -1862,7 +1843,8 @@ class Video extends Component {
1862
1843
  />
1863
1844
  <audio id="audio4" autoPlay />
1864
1845
  <label style={{ display: 'none' }} id="feedId4" type="text" />
1865
- <canvas style={{ display: (this.state.isCustomer) ? '' : 'none', }} className="canvasClass" id="subscribe_volumeView4" width="20" height="50"></canvas>
1846
+ {/* <div style={{ display: (this.state.isCustomer) ? '' : 'none', }} className='customerTitle'>客户</div> */}
1847
+ <canvas style={{ display: (this.state.isCustomer) ? '' : 'none', }} className="canvasClassOne" id="subscribe_volumeView4" width="40" height="70"></canvas>
1866
1848
  </div>
1867
1849
  <div className={`itemed ${this.state.isBigVideo == 'video5' ? 'item1' : ""}`}
1868
1850
  onClick={this.enlargeClick.bind(this, 'isLangVideo5')}>
@@ -1874,13 +1856,10 @@ class Video extends Component {
1874
1856
  />
1875
1857
  <audio id="audio5" autoPlay />
1876
1858
  <label style={{ display: 'none' }} id="feedId5" type="text" />
1877
- <canvas style={{ display: (this.state.isCustomer) ? '' : 'none', }} className="canvasClass" id="subscribe_volumeView5" width="20" height="50"></canvas>
1859
+ {/* <div style={{ display: (this.state.isCustomer) ? '' : 'none', }} className='customerTitle'>客户</div> */}
1860
+ <canvas style={{ display: (this.state.isCustomer) ? '' : 'none', }} className="canvasClassOne" id="subscribe_volumeView5" width="40" height="70"></canvas>
1878
1861
  </div>
1879
1862
  <div onClick={this.enlargeClick.bind(this, 'isLangVideo6')} className={`${this.state.isBigVideo == 'video6' ? 'item1' : "itemed"}`}>
1880
- {/* <div style={{ display: (this.state.isPDF) ? '' : 'none', }} id="touBoxItem">
1881
- {pdfChildren}
1882
- </div> */}
1883
- {/* <div style={this.state.isPDF ? {display: 'none'}: {}}> */}
1884
1863
  <video
1885
1864
  id="video6"
1886
1865
  autoPlay
@@ -1889,8 +1868,8 @@ class Video extends Component {
1889
1868
  />
1890
1869
  <audio id="audio6" autoPlay />
1891
1870
  <label style={{ display: 'none' }} id="feedId6" type="text" />
1892
- <canvas style={{ display: (this.state.isCustomer) ? '' : 'none', }} className="canvasClass" id="subscribe_volumeView6" width="20" height="50"></canvas>
1893
- {/* </div> */}
1871
+ {/* <div style={{ display: (this.state.isCustomer) ? '' : 'none', }} className='customerTitle'>客户</div> */}
1872
+ <canvas style={{ display: (this.state.isCustomer) ? '' : 'none', }} className="canvasClassOne" id="subscribe_volumeView6" width="40" height="70"></canvas>
1894
1873
 
1895
1874
  </div>
1896
1875
  </div>
@@ -1967,7 +1946,7 @@ class Video extends Component {
1967
1946
  ></CanvasDraw>
1968
1947
  </div>
1969
1948
  </Modal>
1970
- <video className="mixedvideo" id="mixedvideo" autoPlay muted={true} width="400" height="400"
1949
+ <video className="mixedvideo" id="mixedvideo" autoPlay muted={true} width="0" height="0"
1971
1950
  webkit-playsinline="true" playsInline={true} x5-playsinline="x5-playsinline"
1972
1951
  x-webkit-airplay="true"></video>
1973
1952
  </Spin>
@@ -35,6 +35,7 @@
35
35
  color: #fff;
36
36
  font-weight: bold;
37
37
  line-height: 150px;
38
+ position: relative;
38
39
  }
39
40
  .item1 {
40
41
  grid-column-start: 1;
@@ -126,6 +127,11 @@
126
127
  bottom: 0;
127
128
  left: 0;
128
129
  }
130
+ .canvasClassOne{
131
+ position: absolute;
132
+ bottom: 0;
133
+ right: 0;
134
+ }
129
135
  .content{
130
136
  height: 654px;
131
137
  border-radius: 4px;
@@ -147,6 +153,8 @@
147
153
  width: 100%;
148
154
  position: absolute;
149
155
  z-index: 1;
156
+ top: 0;
157
+ left: 80px;
150
158
  .selectSee{
151
159
  background: #00847F;
152
160
  border-radius: 0px 0px 2px 2px;
@@ -158,7 +166,7 @@ border-radius: 0px 0px 2px 2px;
158
166
  }
159
167
  div{
160
168
  font-size: 16px;
161
- margin: 15px;
169
+ margin: 0 15px;
162
170
  color: #FFFFFF;
163
171
  padding: 6px 13px;
164
172
  }
@@ -172,4 +180,30 @@ border-radius: 0px 0px 2px 2px;
172
180
  background: #333;
173
181
  }
174
182
  }
183
+ }
184
+ .customerTitle{
185
+ position: absolute;
186
+ top: 0;
187
+ left: 0px;
188
+ width: 80px;
189
+ line-height: 30px;
190
+ height: 30px;
191
+ background: rgba(219, 0, 17, 0.1);
192
+ border-radius: 4px 0px 2px 0px;
193
+ color: #DB0011;
194
+ font-size: 14px;
195
+ }
196
+ .tellerTitle{
197
+ position: absolute;
198
+ top: 0;
199
+ right: 0px;
200
+ width: 80px;
201
+ line-height: 30px;
202
+ height: 30px;
203
+ background: rgba(219, 0, 17, 0.1);
204
+ border-radius: 4px 0px 2px 0px;
205
+ transform: rotateY(
206
+ 180deg);
207
+ color: #DB0011;
208
+ font-size: 14px;
175
209
  }