react_hsbc_teller 0.2.5 → 0.2.9

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.5",
3
+ "version": "0.2.9",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -52,7 +52,7 @@ class Video extends Component {
52
52
  voiceStatue: false,
53
53
  voiceImg: voiceImgOpen,
54
54
  isBigVideo: 'video1',
55
- isCustomer: true,
55
+ isCustomer: false,
56
56
  publishDevic: 1,
57
57
  isSharedScreen: false,
58
58
  isSuspend: false,
@@ -77,8 +77,8 @@ class Video extends Component {
77
77
  createRoom = async () => {
78
78
  try {
79
79
  let result = await API.createRoom({
80
- tellerAccount: this.props.tellerAccount,
81
- businessNumber: this.props.businessNumber,
80
+ staffId: this.props.tellerAccount,
81
+ activityId: this.props.businessNumber,
82
82
  callbackUrl: this.props.callbackUrl,
83
83
  roomId: this.state.channelId,
84
84
  mtoken: this.state.rtoken
@@ -90,8 +90,23 @@ class Video extends Component {
90
90
  });
91
91
  // eslint-disable-next-line no-undef
92
92
  joinRoom((this.props.tellerAccount + '@' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname), this.state.imRoomId)
93
+ this.props.createRoomCallback({
94
+ type: 1,
95
+ errorManage: '',
96
+ data: {
97
+ mtoken: this.state.rtoken,
98
+ imRoomId: result.imRoomId,
99
+ sessionId: result.sessionId,
100
+ roomId: this.state.channelId
101
+ }
102
+ })
93
103
  } catch (err) {
94
104
  console.error(err);
105
+ this.props.createRoomCallback({
106
+ type: 2,
107
+ errorManage: '保存房间信息失败',
108
+ data: {}
109
+ })
95
110
  }
96
111
  };
97
112
  /**
@@ -115,6 +130,7 @@ class Video extends Component {
115
130
  }
116
131
  } catch (err) {
117
132
  console.error(err);
133
+ this.roomCallBack(2,'签名失败')
118
134
  }
119
135
  };
120
136
  handleEdit = () => {
@@ -438,7 +454,33 @@ class Video extends Component {
438
454
  // })
439
455
  // });
440
456
  if (this.isFileSuccuse()) {
441
- const width = 640;
457
+ const list = []
458
+ if(document.getElementById('video1').name) {
459
+ list.push('video1')
460
+ }
461
+ if(document.getElementById('publish_video1').name) {
462
+ list.push('publish_video1')
463
+ }
464
+ if(document.getElementById('video2').name) {
465
+ list.push('video2')
466
+ }
467
+ if(document.getElementById('video3').name) {
468
+ list.push('video3')
469
+ }
470
+ if(document.getElementById('video4').name) {
471
+ list.push('video4')
472
+ }
473
+ if(document.getElementById('video5').name) {
474
+ list.push('video5')
475
+ }
476
+ if(document.getElementById('video6').name) {
477
+ list.push('video6')
478
+ }
479
+ if(document.getElementById('video10').name) {
480
+ list.push('video10')
481
+ }
482
+ console.log(list)
483
+ const width = 320 * list.length;
442
484
  const height = 480;
443
485
  const canvas = document.createElement('canvas');
444
486
  const cobj = canvas.getContext('2d'); // 获取绘图环境
@@ -446,7 +488,9 @@ class Video extends Component {
446
488
  canvas.height = height;
447
489
  let interval = setInterval(() => {
448
490
  cobj.clearRect(0, 0, width, height);
449
- let videoId = 'publish_video1';
491
+ for(let i=0;i<list.length;i++){
492
+
493
+ let videoId = list[i];
450
494
  let videoDiv = document.getElementById(videoId);
451
495
  let videoWidth = videoDiv.videoWidth;
452
496
  let videoHeight = videoDiv.videoHeight;
@@ -457,20 +501,34 @@ class Video extends Component {
457
501
  } else {
458
502
  newVideoHeight = videoHeight * 320 / videoWidth;
459
503
  }
460
- cobj.drawImage(videoDiv, 0, 480 - newVideoHeight, newVideoWidth, newVideoHeight);
461
-
462
- let subscribeVideo = 'video1';
463
- let subscribeVideoDiv = document.getElementById(subscribeVideo);
464
- let subscribeVideoDivWidth = subscribeVideoDiv.videoWidth;
465
- let subscribeVideoDivHeight = subscribeVideoDiv.videoHeight;
466
- let newVideoWidth1 = 320;
467
- let newVideoHeight1 = 480;
468
- if (subscribeVideoDivHeight * 320 / subscribeVideoDivWidth > 480) {
469
- newVideoWidth1 = subscribeVideoDivWidth * 480 / subscribeVideoDivHeight;
470
- } else {
471
- newVideoHeight1 = subscribeVideoDivHeight * 320 / subscribeVideoDivWidth;
504
+ cobj.drawImage(videoDiv, 320 * i, 480 - newVideoHeight, 320, newVideoHeight);
472
505
  }
473
- cobj.drawImage(subscribeVideoDiv, 320, 480 - newVideoHeight1, newVideoWidth1, 80);
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);
474
532
 
475
533
  }, 100);
476
534
  const captureStream = canvas.captureStream();
@@ -494,6 +552,21 @@ class Video extends Component {
494
552
  });
495
553
  }
496
554
  };
555
+ roomCallBack=(type,manege) =>{
556
+ if (this.state.sessionId) {
557
+ this.props.joinRoomCallback({
558
+ type: type,
559
+ errorManage: manege,
560
+ data: {}
561
+ })
562
+ }else {
563
+ this.props.createRoomCallback({
564
+ type: type,
565
+ errorManage: manege,
566
+ data: {}
567
+ })
568
+ }
569
+ }
497
570
  mountClick = () => {
498
571
  window.IMEvt = msg => {
499
572
  console.log(JSON.parse(msg));
@@ -619,6 +692,7 @@ class Video extends Component {
619
692
  };
620
693
  this.test_controller.OnConnectFailed = (code, msg) => {
621
694
  console.log('建立连接失败', code, msg)
695
+ this.roomCallBack(2,'连接失败')
622
696
  };
623
697
  // 断开连接回调
624
698
  this.test_controller.OnConnectClose = (code, msg) => {
@@ -632,6 +706,7 @@ class Video extends Component {
632
706
  // 初始化房间失败
633
707
  this.test_controller.OnInitRoomConfigFail = (err_code, err_msg) => {
634
708
  console.log('初始化房间失败', err_code, err_msg)
709
+ this.roomCallBack(2,'初始化失败')
635
710
  };
636
711
  // 初始化成功回调
637
712
  this.test_controller.OnInitRoomConfigOK = () => {
@@ -657,6 +732,7 @@ class Video extends Component {
657
732
  // 创建房间失败
658
733
  this.test_controller.OnCreateRoomFailed = (err_code, err_msg) => {
659
734
  console.log('创建房间失败', err_code, err_msg)
735
+ this.roomCallBack(2,'创建失败')
660
736
  };
661
737
  // 初始化⾳视频成功
662
738
  this.test_controller.OnMediaCallSucc = (sid) => {
@@ -673,10 +749,12 @@ class Video extends Component {
673
749
  // 加入房间成功
674
750
  this.test_controller.OnJoinRoomSucc = () => {
675
751
  console.log('加入房间成功')
752
+ this.roomCallBack(1,'')
676
753
  };
677
754
  // 加入房间失败
678
755
  this.test_controller.OnJoinRoomFailed = (err_code, err_msg) => {
679
756
  console.log('加入房间失败', err_code, err_msg)
757
+ this.roomCallBack(2,'加入失败')
680
758
  };
681
759
  // 发布媒体流成功
682
760
  this.test_controller.OnPublishSucc = (sid) => {
@@ -1667,7 +1745,7 @@ class Video extends Component {
1667
1745
  <div style={{ display: (this.state.isPDF) ? '' : 'none', }} id="touBoxItem">
1668
1746
  {pdfChildren}
1669
1747
  </div>
1670
- <div style={this.state.isPDF ? { display: 'none' } : {}}>
1748
+ <div className="videoDiv" style={this.state.isPDF ? { display: 'none' } : {}}>
1671
1749
  <video
1672
1750
  id="video10"
1673
1751
  autoPlay
@@ -1889,7 +1967,7 @@ class Video extends Component {
1889
1967
  ></CanvasDraw>
1890
1968
  </div>
1891
1969
  </Modal>
1892
- <video className="mixedvideo" id="mixedvideo" autoPlay muted={true} width="0" height="0"
1970
+ <video className="mixedvideo" id="mixedvideo" autoPlay muted={true} width="400" height="400"
1893
1971
  webkit-playsinline="true" playsInline={true} x5-playsinline="x5-playsinline"
1894
1972
  x-webkit-airplay="true"></video>
1895
1973
  </Spin>
@@ -5,6 +5,7 @@
5
5
  .mixedvideo{
6
6
  display: none;
7
7
  position:absolute;
8
+ object-fit: cover
8
9
  }
9
10
  .imgClass{
10
11
  width: 100%;