react_hsbc_teller 0.7.3 → 0.7.7

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.
@@ -37,6 +37,7 @@ class Video extends Component {
37
37
  cancel = axios.CancelToken.source()
38
38
  signCanvas = React.createRef();
39
39
  state = {
40
+ sessionType: true,
40
41
  isWhiteboard: false,
41
42
  isSelect: '',
42
43
  loading: false,
@@ -48,6 +49,7 @@ class Video extends Component {
48
49
  employeeNumber: '',
49
50
  employeeName: '',
50
51
  isModalVisibleInvitation: false,
52
+ linkData: '',
51
53
  roomCustomerList: [],
52
54
  facialImg: '',
53
55
  isModalVisibleFacial: false,
@@ -113,6 +115,7 @@ class Video extends Component {
113
115
  imStatus: false,
114
116
  imJoinRoom: false,
115
117
  analyserData: new Map(),
118
+ analyserHeight: new Map()
116
119
  };
117
120
  // eslint-disable-next-line no-undef
118
121
  test_controller = '';
@@ -162,6 +165,9 @@ class Video extends Component {
162
165
  })
163
166
  } catch (err) {
164
167
  console.error(err);
168
+ this.setState({
169
+ sessionType: false
170
+ })
165
171
  this.props.createRoomCallback({
166
172
  type: 2,
167
173
  errorManage: '保存房间信息失败',
@@ -539,277 +545,293 @@ class Video extends Component {
539
545
  }
540
546
  };
541
547
  endSessionValue = () => {
542
- this.test_controller.LeaveRoom()
548
+ if(this.state.sessionType) {
549
+ this.test_controller.LeaveRoom()
550
+ } else {
551
+ this.finishSession()
552
+ }
553
+
543
554
  };
544
555
  // 画中画
545
- pictureInPicture = () => {
546
- let interval
556
+ pictureInPicture = (val) => {
547
557
  if (this.isFileSuccuse()) {
548
558
  if (this.state.isPictureInPicture) {
549
- document.exitPictureInPicture()
550
- } else {
551
- const list = []
552
- if (document.getElementById('video1').name) {
553
- list.push({
554
- name: 'video1',
555
- title: this.state.videoOneName,
556
- voice: 'voiceVideoOne'
557
- })
558
- }
559
- if (document.getElementById('publish_video1').name) {
560
- list.push({
561
- name: 'publish_video1',
562
- title: this.props.meetingInfo.host ? this.props.meetingInfo.host : '坐席',
563
- voice: 'voiceStatue'
564
- })
565
- }
566
- if (document.getElementById('video2').name) {
567
- list.push({
568
- name: 'video2',
569
- title: this.state.videoTwoName,
570
- voice: 'voiceVideoTwo'
571
- })
572
- }
573
- if (document.getElementById('video3').name) {
574
- list.push({
575
- name: 'video3',
576
- title: this.state.videoThreeName,
577
- voice: 'voiceVideoThree'
578
- })
579
- }
580
- if (document.getElementById('video4').name) {
581
- list.push({
582
- name: 'video4',
583
- title: this.state.videoFourName,
584
- voice: 'voiceVideoFour'
585
- })
586
- }
587
- if (document.getElementById('video5').name) {
588
- list.push({
589
- name: 'video5',
590
- title: this.state.videoFiveName,
591
- voice: 'voiceVideoFive'
592
- })
559
+ if(!val) {
560
+ document.exitPictureInPicture()
561
+ } else {
562
+ this.pictureInPictureClick()
593
563
  }
594
- if (document.getElementById('video6').name) {
595
- list.push({
596
- name: 'video6',
597
- title: this.state.videoSixName,
598
- voice: 'voiceVideoSix'
599
- })
564
+ } else {
565
+ if(!val) {
566
+ this.pictureInPictureClick()
600
567
  }
568
+ }
569
+ }
570
+ };
571
+ pictureInPictureClick=()=>{
572
+ let interval
573
+ const list = []
574
+ if (document.getElementById('video1').name) {
575
+ list.push({
576
+ name: 'video1',
577
+ title: this.state.videoOneName,
578
+ voice: 'voiceVideoOne'
579
+ })
580
+ }
581
+ if (document.getElementById('publish_video1').name) {
582
+ list.push({
583
+ name: 'publish_video1',
584
+ title: this.props.meetingInfo.host ? this.props.meetingInfo.host : '坐席',
585
+ voice: 'voiceStatue'
586
+ })
587
+ }
588
+ if (document.getElementById('video2').name) {
589
+ list.push({
590
+ name: 'video2',
591
+ title: this.state.videoTwoName,
592
+ voice: 'voiceVideoTwo'
593
+ })
594
+ }
595
+ if (document.getElementById('video3').name) {
596
+ list.push({
597
+ name: 'video3',
598
+ title: this.state.videoThreeName,
599
+ voice: 'voiceVideoThree'
600
+ })
601
+ }
602
+ if (document.getElementById('video4').name) {
603
+ list.push({
604
+ name: 'video4',
605
+ title: this.state.videoFourName,
606
+ voice: 'voiceVideoFour'
607
+ })
608
+ }
609
+ if (document.getElementById('video5').name) {
610
+ list.push({
611
+ name: 'video5',
612
+ title: this.state.videoFiveName,
613
+ voice: 'voiceVideoFive'
614
+ })
615
+ }
616
+ if (document.getElementById('video6').name) {
617
+ list.push({
618
+ name: 'video6',
619
+ title: this.state.videoSixName,
620
+ voice: 'voiceVideoSix'
621
+ })
622
+ }
601
623
 
602
- if (document.getElementById('video7').name) {
603
- list.push({
604
- name: 'video7',
605
- title: this.state.videoSevenName,
606
- voice: 'voiceVideoSeven'
607
- })
608
- }
609
- if (document.getElementById('video8').name) {
610
- list.push({
611
- name: 'video8',
612
- title: this.state.videoEightName,
613
- voice: 'voiceVideoEight'
614
- })
615
- }
616
- if (document.getElementById('video9').name) {
617
- list.push({
618
- name: 'video9',
619
- title: this.state.videoNineName,
620
- voice: 'voiceVideoNine'
621
- })
622
- }
623
- if (document.getElementById('video10').name) {
624
- list.push({
625
- name: 'video10',
626
- title: this.state.videoTenName,
627
- voice: 'voiceVideoTen'
628
- })
629
- }
630
- if (document.getElementById('video11').name) {
631
- list.push({
632
- name: 'video11',
633
- title: this.state.videoElevenName,
634
- voice: 'voiceVideoEleven'
635
- })
636
- }
637
- if (document.getElementById('video12').name) {
638
- list.push({
639
- name: 'video12',
640
- title: this.state.videoTwelveName,
641
- voice: 'voiceVideoTwelve'
642
- })
624
+ if (document.getElementById('video7').name) {
625
+ list.push({
626
+ name: 'video7',
627
+ title: this.state.videoSevenName,
628
+ voice: 'voiceVideoSeven'
629
+ })
630
+ }
631
+ if (document.getElementById('video8').name) {
632
+ list.push({
633
+ name: 'video8',
634
+ title: this.state.videoEightName,
635
+ voice: 'voiceVideoEight'
636
+ })
637
+ }
638
+ if (document.getElementById('video9').name) {
639
+ list.push({
640
+ name: 'video9',
641
+ title: this.state.videoNineName,
642
+ voice: 'voiceVideoNine'
643
+ })
644
+ }
645
+ if (document.getElementById('video10').name) {
646
+ list.push({
647
+ name: 'video10',
648
+ title: this.state.videoTenName,
649
+ voice: 'voiceVideoTen'
650
+ })
651
+ }
652
+ if (document.getElementById('video11').name) {
653
+ list.push({
654
+ name: 'video11',
655
+ title: this.state.videoElevenName,
656
+ voice: 'voiceVideoEleven'
657
+ })
658
+ }
659
+ if (document.getElementById('video12').name) {
660
+ list.push({
661
+ name: 'video12',
662
+ title: this.state.videoTwelveName,
663
+ voice: 'voiceVideoTwelve'
664
+ })
665
+ }
666
+ console.log(list)
667
+ const width = 640;
668
+ const height = 360 * list.length;
669
+ const canvas = document.createElement('canvas');
670
+ const cobj = canvas.getContext('2d'); // 获取绘图环境
671
+ canvas.width = width;
672
+ canvas.height = height;
673
+
674
+ interval = setInterval(() => {
675
+ // cobj.clearRect(0, 0, width, height);
676
+ for (let i = 0; i < list.length; i++) {
677
+
678
+ let videoId = list[i].name;
679
+ let videoDiv = document.getElementById(videoId);
680
+ let videoWidth = videoDiv.videoWidth;
681
+ let videoHeight = videoDiv.videoHeight;
682
+ let newVideoWidth = 640;
683
+ let newVideoHeight = 360;
684
+ if (videoHeight * 640 / videoWidth > 360) {
685
+ newVideoWidth = videoWidth * 360 / videoHeight;
686
+ } else {
687
+ newVideoHeight = videoHeight * 640 / videoWidth;
643
688
  }
644
- console.log(list)
645
- const width = 640;
646
- const height = 360 * list.length;
647
- const canvas = document.createElement('canvas');
648
- const cobj = canvas.getContext('2d'); // 获取绘图环境
649
- canvas.width = width;
650
- canvas.height = height;
651
-
652
- interval = setInterval(() => {
653
- // cobj.clearRect(0, 0, width, height);
654
- for (let i = 0; i < list.length; i++) {
655
-
656
- let videoId = list[i].name;
657
- let videoDiv = document.getElementById(videoId);
658
- let videoWidth = videoDiv.videoWidth;
659
- let videoHeight = videoDiv.videoHeight;
660
- let newVideoWidth = 640;
661
- let newVideoHeight = 360;
662
- if (videoHeight * 640 / videoWidth > 360) {
663
- newVideoWidth = videoWidth * 360 / videoHeight;
664
- } else {
665
- newVideoHeight = videoHeight * 640 / videoWidth;
666
- }
667
689
 
668
- cobj.drawImage(videoDiv, (640 - newVideoWidth) / 2, 360 * i, newVideoWidth, newVideoHeight);
669
- cobj.beginPath();
670
- cobj.strokeStyle = this.props.titleColor;
671
- cobj.fillStyle = this.props.titleBackground;
672
- cobj.fillRect(0, 360 * (i + 1) - 60, 300, 60)
673
- cobj.fill();
674
- cobj.stroke();
675
- cobj.beginPath();
676
- cobj.font = "28px auto";
677
- cobj.textAlign = 'left';
678
- cobj.lineWidth = 1;
679
- // 文字
680
- let str = list[i].title
681
- for (let k = 0; k < str.length; k++){
682
- // console.log(str.substring(0,k+1))
683
- // console.log(cobj.measureText(str.substring(0,k+1)).width)
684
- if (cobj.measureText(str.substring(0,k+1)).width>240){
685
- str = str.substring(0,k-2)
686
- str += '...'
687
- break;
688
- }
689
- }
690
- cobj.strokeText(str, 70, 360 * (i + 1) - 20);
691
- cobj.stroke();
692
- //左边框
693
- cobj.beginPath();
694
- cobj.moveTo(0, 0);
695
- cobj.lineTo(0, 360 * list.length);
696
- cobj.closePath(); //闭合路径
697
- cobj.lineWidth = 5; //线的边框为10像素
698
- cobj.strokeStyle = '#d9363e';
699
- cobj.stroke(); //绘制定义的图形
700
-
701
- //下边框
702
- cobj.beginPath();
703
- cobj.moveTo(0, 0);
704
- cobj.lineTo(640, 0);
705
- cobj.closePath(); //闭合路径
706
- cobj.lineWidth = 5; //线的边框为10像素
707
- cobj.strokeStyle = '#d9363e';
708
- cobj.stroke(); //绘制定义的图形
709
-
710
- //右边框
711
- cobj.beginPath();
712
- cobj.moveTo(640, 360 * list.length);
713
- cobj.lineTo(640, 0);
714
- cobj.closePath(); //闭合路径
715
- cobj.lineWidth = 5; //线的边框为10像素
716
- cobj.strokeStyle = '#d9363e';
717
- cobj.stroke(); //绘制定义的图形
718
-
719
-
720
- //上边框
721
- cobj.beginPath();
722
- cobj.moveTo(0, 360 * list.length);
723
- cobj.lineTo(640, 360 * list.length);
724
- cobj.closePath(); //闭合路径
725
- cobj.lineWidth = 5; //线的边框为10像素
726
- cobj.strokeStyle = '#d9363e';
727
- cobj.stroke(); //绘制定义的图形
728
-
729
- // 绘制话筒图标
730
- let microphoneSize = 50
731
- var img = document.getElementById("icon_huatong");
732
- var img1 = document.getElementById("icon_huatong_close");
733
- if(this.state[list[i].voice]) {
734
- cobj.drawImage(img1, 10, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
735
- } else {
736
- cobj.drawImage(img, 10, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
737
-
738
- // 绘制实时音量
739
- let sid = document.getElementById(list[i].name).name
740
- let analyser = this.state.analyserData.get(sid)
741
- aou(analyser)
742
- // let sid = document.getElementById(list[i].name).name
743
- // let stream = this.test_controller.GetMediaInfo(sid).audio_
744
- // let acc = new AudioContext()
745
- // let mic = acc.createMediaStreamSource(stream)
746
- // let analyser = acc.createAnalyser()
747
- // analyser.fftSize = 256
748
- // mic.connect(analyser)
749
- // aou(analyser)
750
- // let microphoneSize = 50
751
- // var img = document.getElementById("icon_huatong");
752
- // cobj.drawImage(img, 600, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
753
- function aou(analyser){
754
- let dataArray = new Uint8Array(analyser.frequencyBinCount);
755
- analyser.getByteFrequencyData(dataArray);
756
- let step = Math.round(dataArray.length / 60); //采样步长
757
- // 以画布左上角为坐标原点
758
- let drawArea = {
759
- x1: 28/50 * microphoneSize + 10, // 波动范围右下角的点坐标
760
- y1: 25/50 * microphoneSize + 360 * (i + 1) - 60,
761
- x2: 22/50 * microphoneSize + 10, // 波动范围左上角的点坐标
762
- y2: 10/50 * microphoneSize + 360 * (i + 1) - 60,
763
- }
764
-
765
-
766
- for (var j = 0; j < 40; j++) {
767
- let energy = (dataArray[step * j] / 256.0) * 80;
768
- cobj.beginPath();
769
- cobj.fillStyle = "#0AE544";
770
- const { x1,y1,x2,y2} = drawArea
771
- let width = x1-x2;
772
- let height = (energy>20?(energy-20):0) * (y1 - y2 ) / 70
773
- let startX = x2 // 绘制起始点x
774
- let startY = y1 - height // 绘制起始点y
775
- cobj.fillRect(startX, startY, width, height )
690
+ cobj.drawImage(videoDiv, (640 - newVideoWidth) / 2, 360 * i, newVideoWidth, newVideoHeight);
691
+ cobj.beginPath();
692
+ cobj.strokeStyle = this.props.titleColor;
693
+ cobj.fillStyle = this.props.titleBackground;
694
+ cobj.fillRect(0, 360 * (i + 1) - 60, 300, 60)
695
+ cobj.fill();
696
+ cobj.stroke();
697
+ cobj.beginPath();
698
+ cobj.font = "28px auto";
699
+ cobj.textAlign = 'left';
700
+ cobj.lineWidth = 1;
701
+ // 文字
702
+ let str = list[i].title
703
+ for (let k = 0; k < str.length; k++){
704
+ // console.log(str.substring(0,k+1))
705
+ // console.log(cobj.measureText(str.substring(0,k+1)).width)
706
+ if (cobj.measureText(str.substring(0,k+1)).width>210){
707
+ str = str.substring(0,k-2)
708
+ str += '...'
709
+ break;
776
710
  }
777
- requestAnimationFrame(aou.bind(this, analyser));
778
-
779
- }
711
+ }
712
+ cobj.strokeText(str, 70, 360 * (i + 1) - 20);
713
+ cobj.stroke();
714
+ //左边框
715
+ cobj.beginPath();
716
+ cobj.moveTo(0, 0);
717
+ cobj.lineTo(0, 360 * list.length);
718
+ cobj.closePath(); //闭合路径
719
+ cobj.lineWidth = 5; //线的边框为10像素
720
+ cobj.strokeStyle = '#d9363e';
721
+ cobj.stroke(); //绘制定义的图形
722
+
723
+ //下边框
724
+ cobj.beginPath();
725
+ cobj.moveTo(0, 0);
726
+ cobj.lineTo(640, 0);
727
+ cobj.closePath(); //闭合路径
728
+ cobj.lineWidth = 5; //线的边框为10像素
729
+ cobj.strokeStyle = '#d9363e';
730
+ cobj.stroke(); //绘制定义的图形
731
+
732
+ //右边框
733
+ cobj.beginPath();
734
+ cobj.moveTo(640, 360 * list.length);
735
+ cobj.lineTo(640, 0);
736
+ cobj.closePath(); //闭合路径
737
+ cobj.lineWidth = 5; //线的边框为10像素
738
+ cobj.strokeStyle = '#d9363e';
739
+ cobj.stroke(); //绘制定义的图形
740
+
741
+
742
+ //上边框
743
+ cobj.beginPath();
744
+ cobj.moveTo(0, 360 * list.length);
745
+ cobj.lineTo(640, 360 * list.length);
746
+ cobj.closePath(); //闭合路径
747
+ cobj.lineWidth = 5; //线的边框为10像素
748
+ cobj.strokeStyle = '#d9363e';
749
+ cobj.stroke(); //绘制定义的图形
750
+
751
+ // 绘制话筒图标
752
+ let microphoneSize = 50
753
+ var img = document.getElementById("icon_huatong");
754
+ var img1 = document.getElementById("icon_huatong_close");
755
+ if(this.state[list[i].voice]) {
756
+ cobj.drawImage(img1, 10, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
757
+ } else {
758
+ cobj.drawImage(img, 10, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
759
+
760
+ // 绘制实时音量
761
+ let sid = document.getElementById(list[i].name).name
762
+ let analyser = this.state.analyserData.get(sid)
763
+ aou(analyser)
764
+ // let sid = document.getElementById(list[i].name).name
765
+ // let stream = this.test_controller.GetMediaInfo(sid).audio_
766
+ // let acc = new AudioContext()
767
+ // let mic = acc.createMediaStreamSource(stream)
768
+ // let analyser = acc.createAnalyser()
769
+ // analyser.fftSize = 256
770
+ // mic.connect(analyser)
771
+ // aou(analyser)
772
+ // let microphoneSize = 50
773
+ // var img = document.getElementById("icon_huatong");
774
+ // cobj.drawImage(img, 600, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
775
+ function aou(analyser){
776
+ if(analyser) {
777
+ let dataArray = new Uint8Array(analyser.frequencyBinCount);
778
+ analyser.getByteFrequencyData(dataArray);
779
+ let step = Math.round(dataArray.length / 60); //采样步长
780
+ // 以画布左上角为坐标原点
781
+ let drawArea = {
782
+ x1: 28/50 * microphoneSize + 10, // 波动范围右下角的点坐标
783
+ y1: 25/50 * microphoneSize + 360 * (i + 1) - 60,
784
+ x2: 22/50 * microphoneSize + 10, // 波动范围左上角的点坐标
785
+ y2: 10/50 * microphoneSize + 360 * (i + 1) - 60,
780
786
  }
781
787
 
788
+
789
+ for (var j = 0; j < 40; j++) {
790
+ let energy = (dataArray[step * j] / 256.0) * 80;
791
+ cobj.beginPath();
792
+ cobj.fillStyle = "#0AE544";
793
+ const { x1,y1,x2,y2} = drawArea
794
+ let width = x1-x2;
795
+ let height = (energy>20?(energy-20):0) * (y1 - y2 ) / 70
796
+ let startX = x2 // 绘制起始点x
797
+ let startY = y1 - height // 绘制起始点y
798
+ cobj.fillRect(startX, startY, width, height )
799
+ }
800
+ requestAnimationFrame(aou.bind(this, analyser));
782
801
  }
783
- }, 100);
784
- const captureStream = canvas.captureStream();
785
- const mix_stream = new MediaStream(captureStream);
786
- pictureInPictureVideo = document.getElementById('mixedvideo');
787
- pictureInPictureVideo.srcObject = mix_stream;
788
- pictureInPictureVideo.onloadedmetadata = () => {
789
- pictureInPictureVideo.requestPictureInPicture();
790
- };
791
- }
792
802
 
793
803
 
794
- pictureInPictureVideo.addEventListener('enterpictureinpicture', (event) => {
795
- //可获取画中画窗口的一些数据,如宽高等
796
- pictureInPictureVideo.style.display = 'block';
797
- pictureInPictureVideo.play();
798
- this.setState({
799
- isPictureInPicture: true
800
- })
801
- });
804
+ }
805
+ }
806
+
807
+ }
808
+ }, 100);
809
+ const captureStream = canvas.captureStream();
810
+ const mix_stream = new MediaStream(captureStream);
811
+ pictureInPictureVideo = document.getElementById('mixedvideo');
812
+ pictureInPictureVideo.srcObject = mix_stream;
813
+ pictureInPictureVideo.onloadedmetadata = () => {
814
+ pictureInPictureVideo.requestPictureInPicture();
815
+ };
802
816
 
803
- pictureInPictureVideo.addEventListener('leavepictureinpicture', (event) => {
804
- pictureInPictureVideo.srcObject = null;
805
- pictureInPictureVideo.style.display = "none";
806
- clearInterval(interval);
807
- this.setState({
808
- isPictureInPicture: false
809
- })
810
- });
811
- }
812
- };
817
+ pictureInPictureVideo.addEventListener('enterpictureinpicture', (event) => {
818
+ //可获取画中画窗口的一些数据,如宽高等
819
+ pictureInPictureVideo.style.display = 'block';
820
+ pictureInPictureVideo.play();
821
+ this.setState({
822
+ isPictureInPicture: true
823
+ })
824
+ });
825
+
826
+ pictureInPictureVideo.addEventListener('leavepictureinpicture', (event) => {
827
+ pictureInPictureVideo.srcObject = null;
828
+ pictureInPictureVideo.style.display = "none";
829
+ clearInterval(interval);
830
+ this.setState({
831
+ isPictureInPicture: false
832
+ })
833
+ });
834
+ }
813
835
  roomCallBack = (type, manege,code) => {
814
836
  if (this.state.sessionId) {
815
837
  this.props.joinRoomCallback({
@@ -1080,6 +1102,9 @@ class Video extends Component {
1080
1102
  window.IMOpenfire = msg =>{
1081
1103
  console.log('im登录', msg)
1082
1104
  if(!msg) {
1105
+ this.setState({
1106
+ sessionType: false
1107
+ })
1083
1108
  this.roomCallBack(2, 'im建立连接失败',-7)
1084
1109
  } else {
1085
1110
  this.setState({
@@ -1185,7 +1210,7 @@ class Video extends Component {
1185
1210
  microphoneList: objList1,
1186
1211
  speakerList: [objList2[0]]
1187
1212
  })
1188
- if (!this.state.appId) {
1213
+ if (!this.state.appId && this.state.sessionType) {
1189
1214
  this.mpaasSig(data);
1190
1215
  this.setState({
1191
1216
  cameraValue: obj[0].actionid,
@@ -1201,6 +1226,9 @@ class Video extends Component {
1201
1226
  // 获取设备失败
1202
1227
  this.test_controller.OnGetDevicesFailed = (code, msg) => {
1203
1228
  console.log('获取设备失败', code, msg)
1229
+ this.setState({
1230
+ sessionType: false
1231
+ })
1204
1232
  this.messageClick('获取设备失败,请检查摄像头设备是否可用或是否禁用摄像头','error')
1205
1233
  this.roomCallBack(2, '获取设备失败',-1)
1206
1234
  };
@@ -1211,6 +1239,9 @@ class Video extends Component {
1211
1239
  };
1212
1240
  this.test_controller.OnConnectFailed = (code, msg) => {
1213
1241
  console.log('建立连接失败', code, msg)
1242
+ this.setState({
1243
+ sessionType: false
1244
+ })
1214
1245
  this.roomCallBack(2, '连接失败',-2)
1215
1246
  };
1216
1247
  // 断开连接回调
@@ -1225,6 +1256,9 @@ class Video extends Component {
1225
1256
  // 初始化房间失败
1226
1257
  this.test_controller.OnInitRoomConfigFail = (err_code, err_msg) => {
1227
1258
  console.log('初始化房间失败', err_code, err_msg)
1259
+ this.setState({
1260
+ sessionType: false
1261
+ })
1228
1262
  this.roomCallBack(2, '初始化失败',-3)
1229
1263
  };
1230
1264
  // 初始化成功回调
@@ -1251,6 +1285,9 @@ class Video extends Component {
1251
1285
  // 创建房间失败
1252
1286
  this.test_controller.OnCreateRoomFailed = (err_code, err_msg) => {
1253
1287
  console.log('创建房间失败', err_code, err_msg)
1288
+ this.setState({
1289
+ sessionType: false
1290
+ })
1254
1291
  this.roomCallBack(2, '创建房间失败',-4)
1255
1292
  };
1256
1293
  // 初始化⾳视频成功
@@ -1273,6 +1310,9 @@ class Video extends Component {
1273
1310
  // 加入房间失败
1274
1311
  this.test_controller.OnJoinRoomFailed = (err_code, err_msg) => {
1275
1312
  console.log('加入房间失败', err_code, err_msg)
1313
+ this.setState({
1314
+ sessionType: false
1315
+ })
1276
1316
  this.roomCallBack(2, '加入失败',-5)
1277
1317
  };
1278
1318
  // 发布媒体流成功
@@ -1288,11 +1328,36 @@ class Video extends Component {
1288
1328
  'tellerId': this.props.tellerAccount
1289
1329
  })
1290
1330
  });
1331
+ }
1332
+ if(sid == document.getElementById('publish_video1').name) {
1333
+ this.timer = setInterval(
1334
+ () => {
1335
+ console.log('hhhhhh',this.state.analyserHeight.get(sid),this.state.analyserHeight.get(sid).toFixed(2))
1336
+ if(!this.state.voiceStatue) {
1337
+ callNimIM('sendCustomCmdMsg', {
1338
+ customId: this.state.imRoomId,
1339
+ content: JSON.stringify({
1340
+ 'typeId': 3200,
1341
+ 'decibelValue': this.state.analyserHeight.get(sid).toFixed(2),
1342
+ "data": {
1343
+ 'sessionId': this.state.sessionId,
1344
+ 'userId': this.props.tellerAccount
1345
+ }
1346
+
1347
+ })
1348
+ });
1349
+ }
1350
+ },
1351
+ 1000
1352
+ );
1291
1353
  }
1292
1354
  };
1293
1355
  // 发布媒体流失败
1294
1356
  this.test_controller.OnPublishFailed = (sid, err_code, err_msg) => {
1295
1357
  console.log('发布媒体流失败', sid, err_code, err_msg)
1358
+ this.setState({
1359
+ sessionType: false
1360
+ })
1296
1361
  this.roomCallBack(2, '发布失败',-6)
1297
1362
  };
1298
1363
  // 订阅媒体流成功
@@ -1808,6 +1873,8 @@ class Video extends Component {
1808
1873
  voiceVideoTwelve: false
1809
1874
  })
1810
1875
  }
1876
+ this.state.analyserData.delete(sid)
1877
+ this.pictureInPicture('Refresh')
1811
1878
  };
1812
1879
  // 推送“取消发布”给与会者
1813
1880
  this.test_controller.OnUnPublish = (feed) => {
@@ -1844,6 +1911,7 @@ class Video extends Component {
1844
1911
  exitType
1845
1912
  ) => {
1846
1913
  console.log('退出房间者', participant, exitType)
1914
+ this.messageClick(this.props.customLeaveRoom,'error')
1847
1915
  };
1848
1916
  // 弱网回调
1849
1917
  this.test_controller.OnNetworkWeak = (bpsSend, bpsRecv, sid) => {
@@ -2113,6 +2181,13 @@ class Video extends Component {
2113
2181
  let startX = x2 // 绘制起始点x
2114
2182
  let startY = y1 - height // 绘制起始点y
2115
2183
  ctx.fillRect(startX, startY, width, height)
2184
+ if(document.getElementById('publish_video1').name == sid) {
2185
+ this.state.analyserHeight.set(sid,energy/80)
2186
+ this.setState({
2187
+ analyserHeight: this.state.analyserHeight
2188
+ })
2189
+ }
2190
+
2116
2191
  }
2117
2192
  requestAnimationFrame(this.test_controller.OnVolumeAnalyser.bind(this, sid, analyser));
2118
2193
 
@@ -2154,7 +2229,7 @@ class Video extends Component {
2154
2229
  finishSession = async () => {
2155
2230
 
2156
2231
 
2157
- if (this.state.roomCustomerList.length == 0) {
2232
+ if (this.state.roomCustomerList.length == 0 && this.state.sessionType) {
2158
2233
  try {
2159
2234
  let result = await API.finishSession({
2160
2235
  sessionId: this.state.sessionId,
@@ -2168,7 +2243,8 @@ class Video extends Component {
2168
2243
  isWhiteboard: false,
2169
2244
  isPictureInPicture: false,
2170
2245
  imStatus: false,
2171
- imJoinRoom: false
2246
+ imJoinRoom: false,
2247
+ sessionType: true
2172
2248
  });
2173
2249
  this.props.onLeaveRoom({
2174
2250
  code: LEAVE_TYPE.TELLER_EXIT,
@@ -2184,6 +2260,9 @@ class Video extends Component {
2184
2260
  if (result.code == 200 && result.data.roomStatus == 1) {
2185
2261
  this.addToScript()
2186
2262
  } else {
2263
+ this.setState({
2264
+ sessionType: false
2265
+ })
2187
2266
  this.messageClick('当前房间状态异常','error')
2188
2267
  this.props.onLeaveRoom({
2189
2268
  code: LEAVE_TYPE.ROOM_DESTROYED,
@@ -2191,6 +2270,9 @@ class Video extends Component {
2191
2270
  })
2192
2271
  }
2193
2272
  } catch (err) {
2273
+ this.setState({
2274
+ sessionType: false
2275
+ })
2194
2276
  this.messageClick('当前房间状态异常','error')
2195
2277
  this.props.onLeaveRoom({
2196
2278
  code: LEAVE_TYPE.ROOM_DESTROYED,
@@ -2205,8 +2287,12 @@ class Video extends Component {
2205
2287
  axios.get(this.props.resourcePath + "/beauty/beauty.js")
2206
2288
  .then(response => this.addToScriptClick()).catch(function (error) {
2207
2289
  console.log(error);
2290
+ this.setState({
2291
+ sessionType: false
2292
+ })
2208
2293
  this.roomCallBack(2, '创建房间失败',-4)
2209
2294
 
2295
+
2210
2296
  })
2211
2297
 
2212
2298
  }
@@ -2282,6 +2368,7 @@ class Video extends Component {
2282
2368
  return
2283
2369
  }
2284
2370
  this.cancel = ''
2371
+ this.timer && clearInterval(this.timer);
2285
2372
  }
2286
2373
  componentWillMount() {
2287
2374
  if (this.props.sessionId) {
@@ -2601,7 +2688,8 @@ class Video extends Component {
2601
2688
  isModalVisibleInvitation: true,
2602
2689
  employeeNumber: '',
2603
2690
  employeeName: '',
2604
- employeeError: ''
2691
+ employeeError: '',
2692
+ linkData: ''
2605
2693
  })
2606
2694
 
2607
2695
  }
@@ -2782,10 +2870,20 @@ class Video extends Component {
2782
2870
  videoTwelveName: this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById("feedId12").innerText).tag == 'VIDEO_SOURCE_SCREEN' ? '共享屏幕' : data ? data : '客户12'
2783
2871
  })
2784
2872
  }
2873
+ this.pictureInPicture('Refresh')
2785
2874
  } catch (err) {
2786
2875
 
2787
2876
  }
2788
2877
  }
2878
+ linkClick=()=>{
2879
+ let inp = document.createElement('input')
2880
+ inp.value = this.state.linkData
2881
+ document.body.appendChild(inp)
2882
+ inp.select() // 选择对象;
2883
+ console.log(inp.value, '复制到的内容')
2884
+ document.execCommand('Copy') // 执行浏览器复制命令
2885
+ inp.remove()
2886
+ }
2789
2887
  queryStaff = async () => {
2790
2888
  if(!this.state.employeeNumber) return
2791
2889
  try {
@@ -2798,6 +2896,11 @@ class Video extends Component {
2798
2896
  employeeName: result.data.staffName,
2799
2897
  employeeError: result.data.staffName ? '' : '查无此人',
2800
2898
  })
2899
+ if(result.data.staffName){
2900
+ this.setState({
2901
+ linkData:'https://wp-staff-gateway.wealth-platform.uat.ali.cloud.cn.hsbc/meeting-ui/OHB/CN/HSBC?chnlID=OHB&locale=zh_CN&chnlCC=CN&chnlGMC=HSBC&targetFunc=supervisorMeeting&sourceFunc=rmMeeting&appointmentID='+ this.props.businessNumber + '&staffID='+this.state.employeeNumber+'&staffName='+ encodeURIComponent(result.data.staffName)
2902
+ })
2903
+ }
2801
2904
  } else {
2802
2905
  this.messageClick('查询失败','error')
2803
2906
  }
@@ -3511,7 +3614,12 @@ class Video extends Component {
3511
3614
  <Modal className="modelClass" title="新增预约" closable={false} centered={true} visible={this.state.isModalVisibleInvitation} footer={[
3512
3615
  <div key='invitation'>
3513
3616
  <Button className="modelButtonCancel" onClick={this.handleCancelInvitation}>取消</Button>
3514
- <Button className="modelButtonOk" type="primary" danger onClick={this.handleOkInvitation}>确定</Button>
3617
+ {
3618
+ this.state.employeeName &&<Button className='modelButtonOk'type="primary" danger onClick={this.handleOkInvitation}>发送邮件</Button>
3619
+ }
3620
+ {
3621
+ !this.state.employeeName &&<Button className='modelButtonCancelOne' type="primary" danger >发送邮件</Button>
3622
+ }
3515
3623
  </div>
3516
3624
  ]}>
3517
3625
  <div>
@@ -3523,6 +3631,12 @@ class Video extends Component {
3523
3631
  <div className="invitationDiv">
3524
3632
  <span className="modalSpan">&nbsp;&nbsp;&nbsp;姓名:</span><span>{this.state.employeeName}</span>
3525
3633
  </div>
3634
+ {
3635
+ this.state.employeeName &&<div className='invitationDiv'>
3636
+ <span className="modalSpan">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><Button className="invitationButton" onClick={this.linkClick}> <img className='invitationImg' src={require("../../assets/img/link.png").default} alt="" />复制链接</Button>
3637
+ </div>
3638
+ }
3639
+
3526
3640
  </div>
3527
3641
  {
3528
3642
  this.state.employeeError && <div className='errorClassInvitation'>
@@ -3588,10 +3702,11 @@ Video.defaultProps = {
3588
3702
  fontSize: '14',
3589
3703
  fontFamily: 'auto',
3590
3704
  menus: ['SHARE', 'FRIES', 'OCR', 'INVITE', 'PIP'],
3705
+ customLeaveRoom: '客户离开房间',
3591
3706
  meetingInfo: {
3592
- title: '测试',
3593
- host: 'wmz',
3594
- customers: ['王三', '张思']
3707
+ title: '--',
3708
+ host: '--',
3709
+ customers: ['--']
3595
3710
  }
3596
3711
  }
3597
3712
  export default Video