react_hsbc_teller 2.0.39 → 2.0.41

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.39",
3
+ "version": "2.0.41",
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.39'
63
+ const SDK_VERISON = '2.0.41'
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: '文字转语音',
@@ -248,6 +249,7 @@ class Video extends Component {
248
249
  isModalVisibleEnd: false,
249
250
  isModalVisible: false,
250
251
  isPictureConfirmModalVisible:false,
252
+ isDisconnectModalVisible: false,
251
253
  screenName: '共享模式',
252
254
  suspendName: '暂停',
253
255
  cameraImg: cameraImgOpen,
@@ -530,7 +532,7 @@ class Video extends Component {
530
532
  config_param.sign = window.sessionStorage.getItem('alimpassSig')
531
533
  config_param.room_server_url = this.props.roomServerUrl;
532
534
  // 允许最大断网时间 (超过未重连, 直接关闭)
533
- config_param.network_check_timeout = 10000;
535
+ config_param.network_check_timeout = 1200000; // sdk默认120秒。wpb要求一直重连,设定20分钟
534
536
  this.test_controller.Connect(config_param)
535
537
  this.saveLog('mrtc connect start')
536
538
  };
@@ -1138,15 +1140,16 @@ class Video extends Component {
1138
1140
  };
1139
1141
  return mediaInfo;
1140
1142
  }
1141
- detectNetworkWeak = () => {
1143
+ detectNetworkWeak = (streamInfo) => {
1142
1144
  return new Promise((resolve, reject) => {
1143
- let detectionsNumber = 3
1145
+ const Total_Detect_Number = 3; // 触发弱网回调后,再连续检测3次
1146
+ let detectionsNumber = Total_Detect_Number;
1144
1147
  let finalResult = true
1145
1148
  let setTimer = () => {
1146
1149
  setTimeout(() => {
1147
- this.test_controller.GetStats(this.mediaInfo).then(media_stat => {
1148
- if (detectionsNumber>2) {
1149
- // 不考虑第一次的评估结果,重新计算码率
1150
+ this.test_controller.GetStats(streamInfo || this.mediaInfo).then(media_stat => {
1151
+ if (detectionsNumber> Total_Detect_Number-1) {
1152
+ // 不考虑第一次的评估结果,重新计算码率(因为刚触发弱网时的获取的码率总是非常大,原因不明)
1150
1153
  detectionsNumber--;
1151
1154
  setTimer()
1152
1155
  return
@@ -1159,27 +1162,38 @@ class Video extends Component {
1159
1162
  let ssrcVideoSendLostRate = media_stat["ssrcVideoSend"]["lostRate"];
1160
1163
  let ssrcAudioSendLostRate = media_stat["ssrcAudioSend"]["lostRate"];
1161
1164
  let weak_googAvailableSendBandwidth = 200;
1162
- let weak_ssrcVideoSendLostRate = 20;
1163
- let weak_ssrcAudioSendLostRate = 20;
1165
+ // let weak_ssrcVideoSendLostRate = 0.20;
1166
+ // let weak_ssrcAudioSendLostRate = 0.20;
1164
1167
  let weak_str = "网络正常";
1165
1168
  if (googAvailableSendBandwidth < weak_googAvailableSendBandwidth) {
1166
1169
  weak_str = "当前网络不佳";
1167
1170
  }
1168
1171
  let bpsSend = (media_stat.ssrcVideoSend["bpsSend"] / 1000).toFixed(2)
1172
+ let bpsAudioSend = (media_stat.ssrcAudioSend["bpsSend"] / 1000).toFixed(2)
1169
1173
  let fps = media_stat["ssrcVideoSend"].googFrameRateSent
1170
1174
  let str =
1171
1175
  "带宽评估:" + (googAvailableSendBandwidth == undefined ? "none" : googAvailableSendBandwidth + "kbps") + "; "
1172
1176
  + "视频码率:" + bpsSend + "kb" + "; "
1173
- + "音频码率:" + (media_stat.ssrcAudioSend["bpsSend"] / 1000).toFixed(2) + "kb" + "; "
1177
+ + "音频码率:" + bpsAudioSend + "kb" + "; "
1174
1178
  + "视频丢包率:" + (ssrcVideoSendLostRate == undefined ? "none" : ssrcVideoSendLostRate + "%") + "; "
1175
1179
  + "音频丢包率:" + (ssrcAudioSendLostRate == undefined ? "none" : ssrcAudioSendLostRate + "%") + "; "
1176
1180
  + weak_str + "; "
1177
1181
  + "当前编码格式:" + media_stat["ssrcVideoSend"].googCodecName + "; "
1178
1182
  + "分辨率:" + media_stat["ssrcVideoSend"].resolution + "; "
1179
- + "帧率:" + media_stat["ssrcVideoSend"].googFrameRateSent;
1183
+ + "帧率:" + fps + '; '
1184
+ + "源帧率:" + media_stat["ssrcVideoSend"].googFrameRateInput;
1180
1185
  console.log('弱网', str)
1181
- // document.getElementById("publish_media_stat1").innerText = str;
1182
- 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
+ }
1183
1197
  if (result) {
1184
1198
  console.log('[!]弱网单次评估' + result);
1185
1199
  } else {
@@ -2317,13 +2331,14 @@ class Video extends Component {
2317
2331
  };
2318
2332
  // 音视频关闭通知
2319
2333
  this.test_controller.OnMediaClose = (code, sid) => {
2320
- console.log(code, sid)
2334
+ console.log('OnMediaClose',code, sid)
2321
2335
  if (code == 5003 || code == 5004 || code == 5005 || code == 5007 || code == 5009 || code == 5010 || code == 5011 || code == 5012) {
2322
- if (sid == document.getElementById('publish_streamId1').name) {
2336
+ if (sid == this.state.publishSid) {
2323
2337
  this.saveLog('Audio and video close notification,' + code)
2324
2338
  this.roomCallBack(2, '音视频异常关闭', 8)
2325
2339
  } else {
2326
2340
  this.state.isScreenSwitching = false
2341
+ this.setSharedScreenState(false)
2327
2342
  }
2328
2343
  }
2329
2344
  };
@@ -2515,6 +2530,7 @@ class Video extends Component {
2515
2530
  console.log('发布媒体流成功', sid)
2516
2531
  this.state.sessionType = true
2517
2532
  if (sid == document.getElementById('video20').name) {
2533
+ this.setSharedScreenState(true)
2518
2534
  this.sendMessage({
2519
2535
  'typeId': 2030,
2520
2536
  'sessionId': this.state.sessionId,
@@ -2524,11 +2540,11 @@ class Video extends Component {
2524
2540
  if (this.state.screenName == '切换共享') {
2525
2541
  this.state.isSharedScreen = true
2526
2542
  this.state.isScreenSwitching = false
2527
- this.setSharedScreenState(true)
2528
2543
  }
2544
+ this.videoInfo = this.generateMediaInfo(document.getElementById("video20").name);
2529
2545
  }
2530
2546
  if (sid == document.getElementById('publish_streamId1').name) {
2531
-
2547
+ this.state.publishSid = document.getElementById('publish_streamId1').name
2532
2548
  this.setState({
2533
2549
 
2534
2550
  loading: false,
@@ -2582,8 +2598,9 @@ class Video extends Component {
2582
2598
  if (sid == document.getElementById('publish_streamId1').name) {
2583
2599
  this.state.sessionType = false
2584
2600
  this.roomCallBack(2, '发布失败', 4)
2585
- } else {
2601
+ } else if (sid == document.getElementById('video20').name) {
2586
2602
  this.messageClick('投屏失败请重新投屏', 'error')
2603
+ this.setSharedScreenState(false)
2587
2604
  }
2588
2605
 
2589
2606
  };
@@ -2921,6 +2938,15 @@ class Video extends Component {
2921
2938
  }
2922
2939
 
2923
2940
  console.log('退出房间回调', leaveType);
2941
+ // if (leaveType != 1) {
2942
+ // this.props.onLeaveRoom({
2943
+ // code: LEAVE_TYPE.TELLER_DISCONNECT,
2944
+ // errMsg: '坐席断开连接'
2945
+ // })
2946
+ // this.setState({
2947
+ // isDisconnectModalVisible: true
2948
+ // })
2949
+ // }
2924
2950
  };
2925
2951
  // 推送“退出房间者”给与会者
2926
2952
  this.test_controller.OnParticipantLeaveRoom = (
@@ -3006,9 +3032,10 @@ class Video extends Component {
3006
3032
  // 弱网回调
3007
3033
  this.test_controller.OnNetworkWeak = (bpsSend, bpsRecv, sid) => {
3008
3034
  console.log('弱网回调', bpsSend, bpsRecv, sid)
3009
- if (sid == document.getElementById('publish_streamId1').name) {
3035
+ if (sid == document.getElementById('publish_streamId1').name || sid == document.getElementById('video20').name) {
3036
+ const stream = sid == document.getElementById('publish_streamId1').name ? this.mediaInfo : this.videoInfo
3010
3037
 
3011
- this.detectNetworkWeak().then((isWeak) => {
3038
+ this.detectNetworkWeak(stream).then((isWeak) => {
3012
3039
  console.log('弱网结果:' + isWeak)
3013
3040
  if (isWeak) {
3014
3041
  this.messageClick('当前网络环境较差', 'error')
@@ -4001,10 +4028,8 @@ class Video extends Component {
4001
4028
  let matchArr = re.data.matchRawTextItems.map(el => el.matchedText);
4002
4029
  this.saveVideoPoint('pwd', `${resultValue}`, matchArr.toString())
4003
4030
  if (matchArr.length>0) {
4004
- matchArr.forEach(el => {
4005
- this.messageClick('检测到敏感词:' + matchArr, 'error')
4006
- })
4007
- }
4031
+ this.messageClick('检测到敏感词:' + matchArr, 'error')
4032
+ }
4008
4033
  }
4009
4034
  });
4010
4035
  }
@@ -4379,6 +4404,9 @@ class Video extends Component {
4379
4404
  this.pictureInPictureClick('add')
4380
4405
  this.setState({isPictureConfirmModalVisible: false})
4381
4406
  }
4407
+ isDisconnectModalVisible = () => {
4408
+ this.setState({isDisconnectModalVisible: false})
4409
+ }
4382
4410
  handleOkRecordConfirm = () => {
4383
4411
  if (!this.state.isPictureInPicture) {
4384
4412
  this.pictureInPicture()
@@ -5454,7 +5482,7 @@ class Video extends Component {
5454
5482
  document.getElementById('video20') && document.getElementById('video20').name ? this.test_controller.UnPublish(document.getElementById('video20').name) : ''
5455
5483
  that.state.isSharedScreen = false
5456
5484
  that.state.isScreenSwitching = false
5457
- that.setSharedScreenState(false)
5485
+ // that.setSharedScreenState(false)
5458
5486
  that.setState({
5459
5487
  screenName: '共享模式'
5460
5488
  });
@@ -5462,6 +5490,7 @@ class Video extends Component {
5462
5490
 
5463
5491
  }, error => {
5464
5492
  console.log("Unable to acquire screen capture", error);
5493
+ console.log('取消签署')
5465
5494
  });
5466
5495
  }
5467
5496
  publishRecorderDevice = () => {
@@ -5565,7 +5594,6 @@ class Video extends Component {
5565
5594
  }, 'add')
5566
5595
  if (this.state.isSharedScreen) {
5567
5596
  this.state.isSharedScreen = false
5568
- this.setSharedScreenState(false)
5569
5597
  this.setState({
5570
5598
 
5571
5599
  screenName: '共享模式'
@@ -6794,6 +6822,14 @@ class Video extends Component {
6794
6822
  ]}>
6795
6823
  <div className='endModal'>视频浮窗已关闭,请重新开启</div>
6796
6824
  </Modal>
6825
+ {/* 连接断开 */}
6826
+ {/* <Modal closable={false} centered={true} visible={this.state.isDisconnectModalVisible} maskClosable={false} footer={[
6827
+ <div key='end'>
6828
+ <Button className="modelButtonOk" type="primary" danger onClick={this.isDisconnectModalVisible}>确定</Button>
6829
+ </div>
6830
+ ]}>
6831
+ <div className='endModal'>您的连接已断开,请稍后重试</div>
6832
+ </Modal> */}
6797
6833
  {/* 双录中断重新开启确认 */}
6798
6834
  <Modal closable={false} centered={true} visible={this.state.isRecordingeErrorModalVisible} maskClosable={false} footer={[
6799
6835
  <div key='end'>