react_hsbc_teller 2.0.38 → 2.0.40

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": "2.0.38",
3
+ "version": "2.0.40",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -75,9 +75,11 @@ startVideo = () => {
75
75
  }
76
76
  onLeaveRoom = (val) => {
77
77
  console.log(val)
78
- this.setState({
79
- isVideo: false
80
- })
78
+ if (val.code == 1) {
79
+ this.setState({
80
+ isVideo: false
81
+ })
82
+ }
81
83
  }
82
84
  handleChangeTeller = (event) => {
83
85
  this.setState({
@@ -339,6 +339,7 @@ class Copy extends Component {
339
339
  </div>
340
340
  ]}>
341
341
  <div className='endModal'>
342
+ <div className='modalEndTitle'>提示</div>
342
343
  <div className='modalEnd'>
343
344
  <FormattedMessage id="noCopy" />
344
345
  </div>
@@ -60,13 +60,14 @@ import MultiModule from '../multiModule/multiModule'//签字、抄录
60
60
  import axios from 'axios';
61
61
  import CryptoJS from "crypto-js";
62
62
 
63
- const SDK_VERISON = '2.0.38'
63
+ const SDK_VERISON = '2.0.40'
64
64
  const IDtypeFront = '请客户在其设备后置摄像头下展示证件正面(如:身份证照片页面)'
65
65
  const IDtypeBack = '请在后置摄像头下展示证件反面(如:身份证国徽页)'
66
66
  const { Option } = Select;
67
67
  const LEAVE_TYPE = {
68
68
  TELLER_EXIT: 1, // 坐席退出
69
69
  ROOM_DESTROYED: -1, // 房间异常
70
+ TELLER_DISCONNECT: -2, // 坐席连接断开
70
71
  }
71
72
  const POINT_TYPE = {
72
73
  tts: '文字转语音',
@@ -78,7 +79,8 @@ const POINT_TYPE = {
78
79
  wnd: "弱网",
79
80
  mute: "静音",
80
81
  expDark: '曝光、背光',
81
- fcd: '人脸变化检测'
82
+ fcd: '人脸变化检测',
83
+ padConnected: 'ipad已连接'
82
84
  }
83
85
  const RECORD_DEVICE_NAME = 'screen-capture-recorder'
84
86
  // const RECORD_DEVICE_NAME = 'Full HD webcam'
@@ -247,6 +249,7 @@ class Video extends Component {
247
249
  isModalVisibleEnd: false,
248
250
  isModalVisible: false,
249
251
  isPictureConfirmModalVisible:false,
252
+ isDisconnectModalVisible: false,
250
253
  screenName: '共享模式',
251
254
  suspendName: '暂停',
252
255
  cameraImg: cameraImgOpen,
@@ -529,7 +532,7 @@ class Video extends Component {
529
532
  config_param.sign = window.sessionStorage.getItem('alimpassSig')
530
533
  config_param.room_server_url = this.props.roomServerUrl;
531
534
  // 允许最大断网时间 (超过未重连, 直接关闭)
532
- config_param.network_check_timeout = 10000;
535
+ config_param.network_check_timeout = 1200000; // sdk默认120秒。wpb要求一直重连,设定20分钟
533
536
  this.test_controller.Connect(config_param)
534
537
  this.saveLog('mrtc connect start')
535
538
  };
@@ -1137,15 +1140,16 @@ class Video extends Component {
1137
1140
  };
1138
1141
  return mediaInfo;
1139
1142
  }
1140
- detectNetworkWeak = () => {
1143
+ detectNetworkWeak = (streamInfo) => {
1141
1144
  return new Promise((resolve, reject) => {
1142
- let detectionsNumber = 3
1145
+ const Total_Detect_Number = 3; // 触发弱网回调后,再连续检测3次
1146
+ let detectionsNumber = Total_Detect_Number;
1143
1147
  let finalResult = true
1144
1148
  let setTimer = () => {
1145
1149
  setTimeout(() => {
1146
- this.test_controller.GetStats(this.mediaInfo).then(media_stat => {
1147
- if (detectionsNumber>2) {
1148
- // 不考虑第一次的评估结果,重新计算码率
1150
+ this.test_controller.GetStats(streamInfo || this.mediaInfo).then(media_stat => {
1151
+ if (detectionsNumber> Total_Detect_Number-1) {
1152
+ // 不考虑第一次的评估结果,重新计算码率(因为刚触发弱网时的获取的码率总是非常大,原因不明)
1149
1153
  detectionsNumber--;
1150
1154
  setTimer()
1151
1155
  return
@@ -1158,27 +1162,38 @@ class Video extends Component {
1158
1162
  let ssrcVideoSendLostRate = media_stat["ssrcVideoSend"]["lostRate"];
1159
1163
  let ssrcAudioSendLostRate = media_stat["ssrcAudioSend"]["lostRate"];
1160
1164
  let weak_googAvailableSendBandwidth = 200;
1161
- let weak_ssrcVideoSendLostRate = 20;
1162
- let weak_ssrcAudioSendLostRate = 20;
1165
+ // let weak_ssrcVideoSendLostRate = 0.20;
1166
+ // let weak_ssrcAudioSendLostRate = 0.20;
1163
1167
  let weak_str = "网络正常";
1164
1168
  if (googAvailableSendBandwidth < weak_googAvailableSendBandwidth) {
1165
1169
  weak_str = "当前网络不佳";
1166
1170
  }
1167
1171
  let bpsSend = (media_stat.ssrcVideoSend["bpsSend"] / 1000).toFixed(2)
1172
+ let bpsAudioSend = (media_stat.ssrcAudioSend["bpsSend"] / 1000).toFixed(2)
1168
1173
  let fps = media_stat["ssrcVideoSend"].googFrameRateSent
1169
1174
  let str =
1170
1175
  "带宽评估:" + (googAvailableSendBandwidth == undefined ? "none" : googAvailableSendBandwidth + "kbps") + "; "
1171
1176
  + "视频码率:" + bpsSend + "kb" + "; "
1172
- + "音频码率:" + (media_stat.ssrcAudioSend["bpsSend"] / 1000).toFixed(2) + "kb" + "; "
1177
+ + "音频码率:" + bpsAudioSend + "kb" + "; "
1173
1178
  + "视频丢包率:" + (ssrcVideoSendLostRate == undefined ? "none" : ssrcVideoSendLostRate + "%") + "; "
1174
1179
  + "音频丢包率:" + (ssrcAudioSendLostRate == undefined ? "none" : ssrcAudioSendLostRate + "%") + "; "
1175
1180
  + weak_str + "; "
1176
1181
  + "当前编码格式:" + media_stat["ssrcVideoSend"].googCodecName + "; "
1177
1182
  + "分辨率:" + media_stat["ssrcVideoSend"].resolution + "; "
1178
- + "帧率:" + media_stat["ssrcVideoSend"].googFrameRateSent;
1183
+ + "帧率:" + fps + '; '
1184
+ + "源帧率:" + media_stat["ssrcVideoSend"].googFrameRateInput;
1179
1185
  console.log('弱网', str)
1180
- // document.getElementById("publish_media_stat1").innerText = str;
1181
- let result = (bpsSend < 200 ) && googAvailableSendBandwidth < weak_googAvailableSendBandwidth
1186
+
1187
+ let bpsResult = (bpsSend && bpsSend < 200 ) || (bpsAudioSend && bpsAudioSend < 200 )
1188
+ // 码率和带宽评估均低于200
1189
+ let result = bpsResult && (!googAvailableSendBandwidth || googAvailableSendBandwidth < weak_googAvailableSendBandwidth)
1190
+
1191
+ if (fps !== undefined) {
1192
+ // 丢包率>=10 或者帧率 <= 5
1193
+ let videoResult = (Number(ssrcVideoSendLostRate) >= 0.1 ) || fps <= 5
1194
+ console.log('丢包及帧率不满足', ssrcVideoSendLostRate, fps, videoResult)
1195
+ result = videoResult || result
1196
+ }
1182
1197
  if (result) {
1183
1198
  console.log('[!]弱网单次评估' + result);
1184
1199
  } else {
@@ -1522,7 +1537,7 @@ class Video extends Component {
1522
1537
  pictureInPictureVideo.style.display = 'block';
1523
1538
  pictureInPictureVideo.play();
1524
1539
  this.state.isPictureInPicture = true
1525
- clearTimeout(this.loopPlay)
1540
+ clearTimeout(this.loopPlayTimer)
1526
1541
  });
1527
1542
 
1528
1543
  pictureInPictureVideo.addEventListener('leavepictureinpicture', (event) => {
@@ -1533,7 +1548,7 @@ class Video extends Component {
1533
1548
  worker.postMessage(false);
1534
1549
  this.state.isPictureInPicture = false
1535
1550
 
1536
- clearTimeout(this.loopPlay)
1551
+ clearTimeout(this.loopPlayTimer)
1537
1552
  // 画中画循环播放逻辑
1538
1553
  if (document.hidden && this.state.businessRecordId) {
1539
1554
  this.setState({
@@ -1544,7 +1559,7 @@ class Video extends Component {
1544
1559
  if(!this.state.isPictureInPicture && document.getElementById("publish_streamId1")){
1545
1560
  let audio = new Audio(PIPictureClosedAudio)
1546
1561
  audio.play()
1547
- setTimeout(this.loopPlay, 3000);
1562
+ this.loopPlayTimer = setTimeout(this.loopPlay, 3000);
1548
1563
  }
1549
1564
  }
1550
1565
  setTimeout(this.loopPlay, 0);
@@ -1710,12 +1725,13 @@ class Video extends Component {
1710
1725
  ipadLowPowerErrorModalVisible: true,
1711
1726
  })
1712
1727
  // 循环播放ipad低电量
1713
- clearTimeout(this.ipadLowPowerPlay)
1728
+ clearTimeout(this.ipadLowPowerPlayTimer)
1714
1729
  this.ipadLowPowerPlay = () => {
1715
1730
  if(this.state.ipadLowPowerErrorModalVisible){
1716
- let audio = new Audio(IpadLowPowerAudio)
1717
- audio.play()
1718
- setTimeout(this.ipadLowPowerPlay, 3000);
1731
+ if (this.lowPowerAudio) this.lowPowerAudio.pause()
1732
+ this.lowPowerAudio = new Audio(IpadLowPowerAudio)
1733
+ this.lowPowerAudio.play()
1734
+ this.ipadLowPowerPlayTimer = setTimeout(this.ipadLowPowerPlay, 3000);
1719
1735
  }
1720
1736
  }
1721
1737
  setTimeout(this.ipadLowPowerPlay, 0);
@@ -1737,7 +1753,7 @@ class Video extends Component {
1737
1753
  else if (Mival.typeId == 5007) { // ipad充电状态
1738
1754
  if (Mival.type == '1') { // 1充电 2不在充电
1739
1755
  this.setState({ ipadLowPowerErrorModalVisible: false})
1740
- clearTimeout(this.ipadLowPowerPlay)
1756
+ clearTimeout(this.ipadLowPowerPlayTimer)
1741
1757
  }
1742
1758
  }
1743
1759
  else if (Mival.typeId == 1220) {
@@ -1924,13 +1940,13 @@ class Video extends Component {
1924
1940
  // businessRecordId: '',
1925
1941
  // })
1926
1942
  // // 循环播放录制中断语音
1927
- // clearTimeout(this.recordLoopPlay)
1943
+ // clearTimeout(this.recordLoopPlayTimer)
1928
1944
  // this.recordLoopPlay = () => {
1929
1945
  // console.log('loop recordId', this.state.recordId, 'businessRecordId ', this.state.businessRecordId)
1930
1946
  // if(!this.state.businessRecordId && document.getElementById("publish_video1")){
1931
1947
  // let audio = new Audio(recordErrorAudio)
1932
1948
  // audio.play()
1933
- // setTimeout(this.recordLoopPlay, 3000);
1949
+ // this.recordLoopPlayTimer = setTimeout(this.recordLoopPlay, 3000);
1934
1950
  // }
1935
1951
  // }
1936
1952
  // setTimeout(this.recordLoopPlay, 0);
@@ -2315,9 +2331,9 @@ class Video extends Component {
2315
2331
  };
2316
2332
  // 音视频关闭通知
2317
2333
  this.test_controller.OnMediaClose = (code, sid) => {
2318
- console.log(code, sid)
2334
+ console.log('OnMediaClose',code, sid)
2319
2335
  if (code == 5003 || code == 5004 || code == 5005 || code == 5007 || code == 5009 || code == 5010 || code == 5011 || code == 5012) {
2320
- if (sid == document.getElementById('publish_streamId1').name) {
2336
+ if (sid == this.state.publishSid) {
2321
2337
  this.saveLog('Audio and video close notification,' + code)
2322
2338
  this.roomCallBack(2, '音视频异常关闭', 8)
2323
2339
  } else {
@@ -2524,9 +2540,10 @@ class Video extends Component {
2524
2540
  this.state.isScreenSwitching = false
2525
2541
  this.setSharedScreenState(true)
2526
2542
  }
2543
+ this.videoInfo = this.generateMediaInfo(document.getElementById("video20").name);
2527
2544
  }
2528
2545
  if (sid == document.getElementById('publish_streamId1').name) {
2529
-
2546
+ this.state.publishSid = document.getElementById('publish_streamId1').name
2530
2547
  this.setState({
2531
2548
 
2532
2549
  loading: false,
@@ -2706,6 +2723,10 @@ class Video extends Component {
2706
2723
  console.log('新加⼊房间者', participant);
2707
2724
  this.saveLog('mrtc someone joined room, userId=' + participant)
2708
2725
  this.state.isCustomer = true
2726
+
2727
+ if (participant.includes(IPAD_SUFFIX) && this.state.businessId){
2728
+ this.saveVideoPoint('padConnected', 'ipad已连接');
2729
+ }
2709
2730
  };
2710
2731
  // 推送“有新发布”给与会者
2711
2732
  this.test_controller.OnNewPublish = (feed) => {
@@ -2915,6 +2936,15 @@ class Video extends Component {
2915
2936
  }
2916
2937
 
2917
2938
  console.log('退出房间回调', leaveType);
2939
+ // if (leaveType != 1) {
2940
+ // this.props.onLeaveRoom({
2941
+ // code: LEAVE_TYPE.TELLER_DISCONNECT,
2942
+ // errMsg: '坐席断开连接'
2943
+ // })
2944
+ // this.setState({
2945
+ // isDisconnectModalVisible: true
2946
+ // })
2947
+ // }
2918
2948
  };
2919
2949
  // 推送“退出房间者”给与会者
2920
2950
  this.test_controller.OnParticipantLeaveRoom = (
@@ -2938,13 +2968,13 @@ class Video extends Component {
2938
2968
  IpadLeaveErrorModalVisible: true,
2939
2969
  ipadTag: '',
2940
2970
  })
2941
- // 循环播放录制中断语音
2942
- clearTimeout(this.ipadLeavePlay)
2971
+ // 循环播放ipad退出语音
2972
+ clearTimeout(this.ipadLeavePlayTimer)
2943
2973
  this.ipadLeavePlay = () => {
2944
2974
  if(!this.state.ipadTag && document.getElementById("publish_streamId1")){
2945
2975
  let audio = new Audio(IpadLeaveAudio)
2946
2976
  audio.play()
2947
- setTimeout(this.ipadLeavePlay, 3000);
2977
+ this.ipadLeavePlayTimer = setTimeout(this.ipadLeavePlay, 3000);
2948
2978
  }
2949
2979
  }
2950
2980
  setTimeout(this.ipadLeavePlay, 0);
@@ -3000,9 +3030,10 @@ class Video extends Component {
3000
3030
  // 弱网回调
3001
3031
  this.test_controller.OnNetworkWeak = (bpsSend, bpsRecv, sid) => {
3002
3032
  console.log('弱网回调', bpsSend, bpsRecv, sid)
3003
- if (sid == document.getElementById('publish_streamId1').name) {
3033
+ if (sid == document.getElementById('publish_streamId1').name || sid == document.getElementById('video20').name) {
3034
+ const stream = sid == document.getElementById('publish_streamId1').name ? this.mediaInfo : this.videoInfo
3004
3035
 
3005
- this.detectNetworkWeak().then((isWeak) => {
3036
+ this.detectNetworkWeak(stream).then((isWeak) => {
3006
3037
  console.log('弱网结果:' + isWeak)
3007
3038
  if (isWeak) {
3008
3039
  this.messageClick('当前网络环境较差', 'error')
@@ -3194,13 +3225,13 @@ class Video extends Component {
3194
3225
  })
3195
3226
  this.saveLog(`dual recording crash, recordId=${recordId}`);
3196
3227
  // 循环播放录制中断语音
3197
- clearTimeout(this.recordLoopPlay)
3228
+ clearTimeout(this.recordLoopPlayTimer)
3198
3229
  this.recordLoopPlay = () => {
3199
3230
  console.log('loop recordId', this.state.recordId, 'businessRecordId ', this.state.businessRecordId)
3200
3231
  if(!this.state.businessRecordId && document.getElementById("publish_streamId1")){
3201
3232
  let audio = new Audio(recordErrorAudio)
3202
3233
  audio.play()
3203
- setTimeout(this.recordLoopPlay, 3000);
3234
+ this.recordLoopPlayTimer = setTimeout(this.recordLoopPlay, 3000);
3204
3235
  }
3205
3236
  }
3206
3237
  setTimeout(this.recordLoopPlay, 0);
@@ -3674,10 +3705,10 @@ class Video extends Component {
3674
3705
  worker.postMessage(false);
3675
3706
  worker.terminate();
3676
3707
  message.destroy()
3677
- clearTimeout(this.loopPlay)
3678
- clearTimeout(this.recordLoopPlay)
3679
- clearTimeout(this.ipadLeavePlay)
3680
- clearTimeout(this.ipadLowPowerPlay)
3708
+ clearTimeout(this.loopPlayTimer)
3709
+ clearTimeout(this.recordLoopPlayTimer)
3710
+ clearTimeout(this.ipadLeavePlayTimer)
3711
+ clearTimeout(this.ipadLowPowerPlayTimer)
3681
3712
  clearInterval(this.state.drawCanvasInterval)
3682
3713
  clearInterval(this.state.faceDetectionTimer);
3683
3714
  clearInterval(this.state.imageDetectionTimer);
@@ -3995,10 +4026,8 @@ class Video extends Component {
3995
4026
  let matchArr = re.data.matchRawTextItems.map(el => el.matchedText);
3996
4027
  this.saveVideoPoint('pwd', `${resultValue}`, matchArr.toString())
3997
4028
  if (matchArr.length>0) {
3998
- matchArr.forEach(el => {
3999
- this.messageClick('检测到敏感词:' + matchArr, 'error')
4000
- })
4001
- }
4029
+ this.messageClick('检测到敏感词:' + matchArr, 'error')
4030
+ }
4002
4031
  }
4003
4032
  });
4004
4033
  }
@@ -4373,12 +4402,16 @@ class Video extends Component {
4373
4402
  this.pictureInPictureClick('add')
4374
4403
  this.setState({isPictureConfirmModalVisible: false})
4375
4404
  }
4405
+ isDisconnectModalVisible = () => {
4406
+ this.setState({isDisconnectModalVisible: false})
4407
+ }
4376
4408
  handleOkRecordConfirm = () => {
4377
4409
  if (!this.state.isPictureInPicture) {
4378
4410
  this.pictureInPicture()
4379
4411
  }
4380
4412
  this.saveLog('Start business recording')
4381
4413
  this.enableServerRecording(this.state.businessId)
4414
+ clearTimeout(this.recordLoopPlayTimer)
4382
4415
  }
4383
4416
  handleOkLowPowerConfirm = () => {
4384
4417
  // 通知ipad,获取是否在充电的状态
@@ -4393,7 +4426,7 @@ class Video extends Component {
4393
4426
  if (!this.state.ipadTag) {
4394
4427
  this.messageClick('未检测到iPad,请重新加入后再试', 'error')
4395
4428
  } else {
4396
- clearTimeout(this.ipadLeavePlay)
4429
+ clearTimeout(this.ipadLeavePlayTimer)
4397
4430
  this.setState({IpadLeaveErrorModalVisible: false})
4398
4431
  }
4399
4432
  }
@@ -5455,6 +5488,7 @@ class Video extends Component {
5455
5488
 
5456
5489
  }, error => {
5457
5490
  console.log("Unable to acquire screen capture", error);
5491
+ console.log('取消签署')
5458
5492
  });
5459
5493
  }
5460
5494
  publishRecorderDevice = () => {
@@ -6787,6 +6821,14 @@ class Video extends Component {
6787
6821
  ]}>
6788
6822
  <div className='endModal'>视频浮窗已关闭,请重新开启</div>
6789
6823
  </Modal>
6824
+ {/* 连接断开 */}
6825
+ {/* <Modal closable={false} centered={true} visible={this.state.isDisconnectModalVisible} maskClosable={false} footer={[
6826
+ <div key='end'>
6827
+ <Button className="modelButtonOk" type="primary" danger onClick={this.isDisconnectModalVisible}>确定</Button>
6828
+ </div>
6829
+ ]}>
6830
+ <div className='endModal'>您的连接已断开,请稍后重试</div>
6831
+ </Modal> */}
6790
6832
  {/* 双录中断重新开启确认 */}
6791
6833
  <Modal closable={false} centered={true} visible={this.state.isRecordingeErrorModalVisible} maskClosable={false} footer={[
6792
6834
  <div key='end'>