react_hsbc_teller 0.2.7 → 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.2.7",
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="" />
@@ -5,6 +5,7 @@ display: inline-flex;
5
5
  width: 100%;
6
6
  position: absolute;
7
7
  bottom: 0;
8
+ left: 0;
8
9
  }
9
10
  .total{
10
11
  display: inline-flex;
@@ -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();
@@ -52,7 +53,7 @@ class Video extends Component {
52
53
  voiceStatue: false,
53
54
  voiceImg: voiceImgOpen,
54
55
  isBigVideo: 'video1',
55
- isCustomer: true,
56
+ isCustomer: false,
56
57
  publishDevic: 1,
57
58
  isSharedScreen: false,
58
59
  isSuspend: false,
@@ -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 = '';
@@ -92,13 +94,20 @@ class Video extends Component {
92
94
  joinRoom((this.props.tellerAccount + '@' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname), this.state.imRoomId)
93
95
  this.props.createRoomCallback({
94
96
  type: 1,
95
- errorManage: ''
97
+ errorManage: '',
98
+ data: {
99
+ mtoken: this.state.rtoken,
100
+ imRoomId: result.imRoomId,
101
+ sessionId: result.sessionId,
102
+ roomId: this.state.channelId
103
+ }
96
104
  })
97
105
  } catch (err) {
98
106
  console.error(err);
99
107
  this.props.createRoomCallback({
100
108
  type: 2,
101
- errorManage: '保存房间信息失败'
109
+ errorManage: '保存房间信息失败',
110
+ data: {}
102
111
  })
103
112
  }
104
113
  };
@@ -427,27 +436,12 @@ class Video extends Component {
427
436
  };
428
437
  // 画中画
429
438
  pictureInPicture = () => {
430
- // const publish_config = {};
431
- // publish_config.media_type = 1;
432
- // publish_config.publish_device = 4;
433
- // publish_config.need_volume_analyser = true;
434
- // publish_config.video_profile_type = 3;
435
- // publish_config.part_of_screen_id = 'touBoxItem';
436
- // publish_config.publish_video_id = 'video3';
437
- // publish_config.publish_streamId_id = 'subscribe_streamId3';
438
- // // publish_config.publish_tag = 'sharedScreen'
439
- // this.test_controller.Publish(publish_config);
440
- // callNimIM('sendCustomCmdMsg', {
441
- // customId: this.state.imRoomId,
442
- // content: JSON.stringify({
443
- // 'typeId': 2030,
444
- // 'sessionId': this.state.sessionId,
445
- // 'sharedScreen': 1,
446
- // 'tellerId': this.props.tellerAccount
447
- // })
448
- // });
439
+ let interval
449
440
  if (this.isFileSuccuse()) {
450
- const list = []
441
+ if(this.state.isPictureInPicture){
442
+ document.exitPictureInPicture()
443
+ } else {
444
+ const list = []
451
445
  if(document.getElementById('video1').name) {
452
446
  list.push('video1')
453
447
  }
@@ -479,7 +473,7 @@ class Video extends Component {
479
473
  const cobj = canvas.getContext('2d'); // 获取绘图环境
480
474
  canvas.width = width;
481
475
  canvas.height = height;
482
- let interval = setInterval(() => {
476
+ interval = setInterval(() => {
483
477
  cobj.clearRect(0, 0, width, height);
484
478
  for(let i=0;i<list.length;i++){
485
479
 
@@ -494,54 +488,35 @@ class Video extends Component {
494
488
  } else {
495
489
  newVideoHeight = videoHeight * 320 / videoWidth;
496
490
  }
497
- cobj.drawImage(videoDiv, 320 * i, 480 - newVideoHeight, 320, newVideoHeight);
491
+ cobj.drawImage(videoDiv, 320 * i, (480 - newVideoHeight)/2, 320, newVideoHeight);
498
492
  }
499
- // cobj.clearRect(0, 0, width, height);
500
- // let videoId = 'publish_video1';
501
- // let videoDiv = document.getElementById(videoId);
502
- // let videoWidth = videoDiv.videoWidth;
503
- // let videoHeight = videoDiv.videoHeight;
504
- // let newVideoWidth = 320;
505
- // let newVideoHeight = 480;
506
- // if (videoHeight * 320 / videoWidth > 480) {
507
- // newVideoWidth = videoWidth * 480 / videoHeight;
508
- // } else {
509
- // newVideoHeight = videoHeight * 320 / videoWidth;
510
- // }
511
- // cobj.drawImage(videoDiv, 0, 480 - newVideoHeight, newVideoWidth, newVideoHeight);
512
-
513
- // let subscribeVideo = 'video1';
514
- // let subscribeVideoDiv = document.getElementById(subscribeVideo);
515
- // let subscribeVideoDivWidth = subscribeVideoDiv.videoWidth;
516
- // let subscribeVideoDivHeight = subscribeVideoDiv.videoHeight;
517
- // let newVideoWidth1 = 320;
518
- // let newVideoHeight1 = 480;
519
- // if (subscribeVideoDivHeight * 320 / subscribeVideoDivWidth > 480) {
520
- // newVideoWidth1 = subscribeVideoDivWidth * 480 / subscribeVideoDivHeight;
521
- // } else {
522
- // newVideoHeight1 = subscribeVideoDivHeight * 320 / subscribeVideoDivWidth;
523
- // }
524
- // cobj.drawImage(subscribeVideoDiv, 320, 480 - newVideoHeight1, newVideoWidth1, newVideoHeight1);
525
-
526
493
  }, 100);
527
494
  const captureStream = canvas.captureStream();
528
495
  const mix_stream = new MediaStream(captureStream);
529
- let video = document.getElementById('mixedvideo');
530
- video.srcObject = mix_stream;
531
- video.onloadedmetadata = () => {
532
- video.requestPictureInPicture();
496
+ pictureInPictureVideo = document.getElementById('mixedvideo');
497
+ pictureInPictureVideo.srcObject = mix_stream;
498
+ pictureInPictureVideo.onloadedmetadata = () => {
499
+ pictureInPictureVideo.requestPictureInPicture();
533
500
  };
501
+ }
502
+
534
503
 
535
- video.addEventListener('enterpictureinpicture', (event) => {
504
+ pictureInPictureVideo.addEventListener('enterpictureinpicture', (event) => {
536
505
  //可获取画中画窗口的一些数据,如宽高等
537
- video.style.display = 'block';
538
- video.play();
506
+ pictureInPictureVideo.style.display = 'block';
507
+ pictureInPictureVideo.play();
508
+ this.setState({
509
+ isPictureInPicture: true
510
+ })
539
511
  });
540
512
 
541
- video.addEventListener('leavepictureinpicture', (event) => {
542
- video.srcObject = null;
543
- video.style.display = "none";
513
+ pictureInPictureVideo.addEventListener('leavepictureinpicture', (event) => {
514
+ pictureInPictureVideo.srcObject = null;
515
+ pictureInPictureVideo.style.display = "none";
544
516
  clearInterval(interval);
517
+ this.setState({
518
+ isPictureInPicture: false
519
+ })
545
520
  });
546
521
  }
547
522
  };
@@ -549,12 +524,14 @@ class Video extends Component {
549
524
  if (this.state.sessionId) {
550
525
  this.props.joinRoomCallback({
551
526
  type: type,
552
- errorManage: manege
527
+ errorManage: manege,
528
+ data: {}
553
529
  })
554
530
  }else {
555
531
  this.props.createRoomCallback({
556
532
  type: type,
557
- errorManage: manege
533
+ errorManage: manege,
534
+ data: {}
558
535
  })
559
536
  }
560
537
  }
@@ -1076,14 +1053,14 @@ class Video extends Component {
1076
1053
  let outcanvas = document.createElement("canvas");
1077
1054
  outcanvas.width = canvas.width;
1078
1055
  outcanvas.height = canvas.height;
1079
- ctx.strokeStyle = "#00847F";
1056
+ ctx.strokeStyle = "#db0011";
1080
1057
  ctx.lineWidth = 2;
1081
1058
  ctx.clearRect(0, 0, canvas.width, canvas.height); //清理画布
1082
1059
  let dataArray = new Uint8Array(analyser.frequencyBinCount);
1083
1060
  analyser.getByteFrequencyData(dataArray);
1084
1061
  let step = Math.round(dataArray.length / 60); //采样步长
1085
1062
  for (var i = 0; i < 40; i++) {
1086
- let energy = (dataArray[step * i] / 256.0) * 50;
1063
+ let energy = (dataArray[step * i] / 256.0) * 80;
1087
1064
  for (var j = 0; j < energy; j++) {
1088
1065
  ctx.beginPath();
1089
1066
  ctx.moveTo(20 * i + 2, 200 + 4 * j);
@@ -1104,7 +1081,7 @@ class Video extends Component {
1104
1081
  function draw() {
1105
1082
  ctx.drawImage(outcanvas, 0, 0);
1106
1083
  ctx.save();
1107
- ctx.translate(canvas.width / 2, canvas.height / 2);
1084
+ ctx.translate(canvas.width / 4, canvas.height / 2);
1108
1085
  ctx.rotate(Math.PI);
1109
1086
  ctx.scale(-1, 1);
1110
1087
  ctx.drawImage(outcanvas, -canvas.width / 2, -canvas.height / 2);
@@ -1150,6 +1127,7 @@ class Video extends Component {
1150
1127
  this.setState({
1151
1128
  isCustomer: false,
1152
1129
  isWhiteboard: false,
1130
+ isPictureInPicture: false,
1153
1131
  });
1154
1132
  this.props.onLeaveRoom({
1155
1133
  code: LEAVE_TYPE.TELLER_EXIT,
@@ -1253,7 +1231,7 @@ class Video extends Component {
1253
1231
  }
1254
1232
  componentWillMount() {
1255
1233
  if (this.props.sessionId) {
1256
- thid.getRoomStatus({
1234
+ this.getRoomStatus({
1257
1235
  sessionId: this.props.sessionId
1258
1236
  })
1259
1237
  } else {
@@ -1402,6 +1380,10 @@ class Video extends Component {
1402
1380
 
1403
1381
  screenName: '投屏'
1404
1382
  });
1383
+ console.log(pictureInPictureVideo)
1384
+ if(this.state.isPictureInPicture) {
1385
+ document.exitPictureInPicture()
1386
+ }
1405
1387
  } else {
1406
1388
  if (document.getElementById('video10').name) {
1407
1389
  publish_config.media_type = 1;
@@ -1433,6 +1415,10 @@ class Video extends Component {
1433
1415
  screenName: '取消共享',
1434
1416
  isPDF: false
1435
1417
  })
1418
+ if(!this.state.isPictureInPicture) {
1419
+ this.pictureInPicture()
1420
+ }
1421
+
1436
1422
  }
1437
1423
  }
1438
1424
  };
@@ -1727,7 +1713,7 @@ class Video extends Component {
1727
1713
  <Spin spinning={this.state.loading} tip="视频初始化中...">
1728
1714
  <Header></Header>
1729
1715
  <div className="health">
1730
- <div className="projection">
1716
+ <div className="projection" style={{ display: (this.state.isCustomer == 'noVideo') ? '' : 'none', }}>
1731
1717
  <div className="button">
1732
1718
  <div className={`${this.state.isSelect == 'video' ? 'selectSee' : "noSelest"}`} onClick={this.switchSelect.bind(this)}>视频画面</div>
1733
1719
  <div className={`${this.state.isSelect == 'noVideo' ? 'selectSee' : "noSelest"}`} onClick={this.switchSelect.bind(this)}>投屏白板</div>
@@ -1774,7 +1760,8 @@ class Video extends Component {
1774
1760
  />
1775
1761
  <audio id="audio1" autoPlay />
1776
1762
  <label style={{ display: 'none' }} id="feedId1" type="text" />
1777
- <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>
1778
1765
  </div>
1779
1766
  </div>
1780
1767
  <div
@@ -1813,7 +1800,8 @@ class Video extends Component {
1813
1800
  />
1814
1801
  <audio id="audio1" autoPlay />
1815
1802
  <label style={{ display: 'none' }} id="publish_streamId1" type="text" />
1816
- <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>
1817
1805
  </div>
1818
1806
 
1819
1807
  </div>
@@ -1828,7 +1816,8 @@ class Video extends Component {
1828
1816
  />
1829
1817
  <audio id="audio2" autoPlay />
1830
1818
  <label style={{ display: 'none' }} id="feedId2" type="text" />
1831
- <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>
1832
1821
  </div>
1833
1822
  </div>
1834
1823
  <div className={`itemed ${this.state.isBigVideo == 'video3' ? 'item1' : ""}`}
@@ -1841,7 +1830,8 @@ class Video extends Component {
1841
1830
  />
1842
1831
  <audio id="audio3" autoPlay />
1843
1832
  <label style={{ display: 'none' }} id="feedId3" type="text" />
1844
- <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>
1845
1835
  </div>
1846
1836
  <div className={`itemed ${this.state.isBigVideo == 'video4' ? 'item1' : ""}`}
1847
1837
  onClick={this.enlargeClick.bind(this, 'isLangVideo4')}>
@@ -1853,7 +1843,8 @@ class Video extends Component {
1853
1843
  />
1854
1844
  <audio id="audio4" autoPlay />
1855
1845
  <label style={{ display: 'none' }} id="feedId4" type="text" />
1856
- <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>
1857
1848
  </div>
1858
1849
  <div className={`itemed ${this.state.isBigVideo == 'video5' ? 'item1' : ""}`}
1859
1850
  onClick={this.enlargeClick.bind(this, 'isLangVideo5')}>
@@ -1865,13 +1856,10 @@ class Video extends Component {
1865
1856
  />
1866
1857
  <audio id="audio5" autoPlay />
1867
1858
  <label style={{ display: 'none' }} id="feedId5" type="text" />
1868
- <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>
1869
1861
  </div>
1870
1862
  <div onClick={this.enlargeClick.bind(this, 'isLangVideo6')} className={`${this.state.isBigVideo == 'video6' ? 'item1' : "itemed"}`}>
1871
- {/* <div style={{ display: (this.state.isPDF) ? '' : 'none', }} id="touBoxItem">
1872
- {pdfChildren}
1873
- </div> */}
1874
- {/* <div style={this.state.isPDF ? {display: 'none'}: {}}> */}
1875
1863
  <video
1876
1864
  id="video6"
1877
1865
  autoPlay
@@ -1880,8 +1868,8 @@ class Video extends Component {
1880
1868
  />
1881
1869
  <audio id="audio6" autoPlay />
1882
1870
  <label style={{ display: 'none' }} id="feedId6" type="text" />
1883
- <canvas style={{ display: (this.state.isCustomer) ? '' : 'none', }} className="canvasClass" id="subscribe_volumeView6" width="20" height="50"></canvas>
1884
- {/* </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>
1885
1873
 
1886
1874
  </div>
1887
1875
  </div>
@@ -1958,7 +1946,7 @@ class Video extends Component {
1958
1946
  ></CanvasDraw>
1959
1947
  </div>
1960
1948
  </Modal>
1961
- <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"
1962
1950
  webkit-playsinline="true" playsInline={true} x5-playsinline="x5-playsinline"
1963
1951
  x-webkit-airplay="true"></video>
1964
1952
  </Spin>
@@ -3,7 +3,7 @@
3
3
  height: 100px
4
4
  }
5
5
  .mixedvideo{
6
- // display: none;
6
+ display: none;
7
7
  position:absolute;
8
8
  object-fit: cover
9
9
  }
@@ -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
  }