react_hsbc_teller 2.0.22 → 2.0.24

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.22",
3
+ "version": "2.0.24",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -53,7 +53,7 @@ import Step from '../components/step/step.jsx'
53
53
  import axios from 'axios';
54
54
  import CryptoJS from "crypto-js";
55
55
 
56
- const SDK_VERISON = '2.0.22'
56
+ const SDK_VERISON = '2.0.24'
57
57
  const IDtypeFront = '请客户在其设备后置摄像头下展示证件正面(如:身份证照片页面)'
58
58
  const IDtypeBack = '请在后置摄像头下展示证件反面(如:身份证国徽页)'
59
59
  const { Option } = Select;
@@ -1703,22 +1703,23 @@ class Video extends Component {
1703
1703
  }
1704
1704
  }
1705
1705
  } else if (Mival.typeId == 10020) {
1706
- // 录制中断
1707
- this.messageClick('录制服务异常中断,请重试', 'error')
1708
- this.saveLog('recording error')
1709
- this.setState({
1710
- isRecordingeErrorModalVisible: true,
1711
- recordId: ''
1712
- })
1713
- // 循环播放录制中断语音
1714
- const loopPlay = () => {
1715
- if(!this.state.recordId && document.getElementById("publish_video1")){
1716
- let audio = new Audio(recordErrorAudio)
1717
- audio.play()
1718
- setTimeout(loopPlay, 3000);
1719
- }
1720
- }
1721
- setTimeout(loopPlay, 0);
1706
+ // 录制中断(模拟测试)
1707
+ // this.messageClick('双录异常中断,请重新开启', 'error')
1708
+ // this.setState({
1709
+ // isRecordingeErrorModalVisible: true,
1710
+ // businessRecordId: '',
1711
+ // })
1712
+ // // 循环播放录制中断语音
1713
+ // clearTimeout(this.recordLoopPlay)
1714
+ // this.recordLoopPlay = () => {
1715
+ // console.log('loop recordId', this.state.recordId, 'businessRecordId ', this.state.businessRecordId)
1716
+ // if(!this.state.businessRecordId && document.getElementById("publish_video1")){
1717
+ // let audio = new Audio(recordErrorAudio)
1718
+ // audio.play()
1719
+ // setTimeout(this.recordLoopPlay, 3000);
1720
+ // }
1721
+ // }
1722
+ // setTimeout(this.recordLoopPlay, 0);
1722
1723
 
1723
1724
  } else if (Mival.typeId == 33001 && this.state.sessionId == Mival.data.sessionId) {
1724
1725
  if (Mival.type == 1) {
@@ -2885,6 +2886,28 @@ class Video extends Component {
2885
2886
  msg
2886
2887
  ) => {
2887
2888
  console.log('服务端录制失败通知', recordId, feedId, code, msg)
2889
+ this.saveLog(`recording error, recordId=${recordId}`)
2890
+
2891
+ // 如果在业务双录中,需要重新开启;如果是full录制出错,则不用处理
2892
+ if (this.state.businessRecordId == recordId) {
2893
+ // 录制中断
2894
+ this.messageClick('双录异常中断,请重新开启', 'error')
2895
+ this.setState({
2896
+ isRecordingeErrorModalVisible: true,
2897
+ businessRecordId: '',
2898
+ })
2899
+ // 循环播放录制中断语音
2900
+ clearTimeout(this.recordLoopPlay)
2901
+ this.recordLoopPlay = () => {
2902
+ console.log('loop recordId', this.state.recordId, 'businessRecordId ', this.state.businessRecordId)
2903
+ if(!this.state.businessRecordId && document.getElementById("publish_video1")){
2904
+ let audio = new Audio(recordErrorAudio)
2905
+ audio.play()
2906
+ setTimeout(this.recordLoopPlay, 3000);
2907
+ }
2908
+ }
2909
+ setTimeout(this.recordLoopPlay, 0);
2910
+ }
2888
2911
  };
2889
2912
  // 停止浏览器录制成功回调
2890
2913
  this.test_controller.OnClientStopRecordSuccess = (
@@ -3298,6 +3321,7 @@ class Video extends Component {
3298
3321
  roomId: this.state.channelId + '',
3299
3322
  appId: this.state.appId,
3300
3323
  recordId: this.state.recordId,
3324
+ customerId: this.props.customerId,
3301
3325
  type: type,
3302
3326
  status: status
3303
3327
  });
@@ -3328,6 +3352,7 @@ class Video extends Component {
3328
3352
  id: businessId,
3329
3353
  appId: this.state.appId,
3330
3354
  recordId: this.state.businessRecordId,
3355
+ customerId: this.props.customerId,
3331
3356
  type: type,
3332
3357
  status: status
3333
3358
  });
@@ -3426,6 +3451,7 @@ class Video extends Component {
3426
3451
  }
3427
3452
  message.destroy()
3428
3453
  clearTimeout(this.loopPlay)
3454
+ clearTimeout(this.recordLoopPlay)
3429
3455
  clearInterval(this.state.drawCanvasInterval)
3430
3456
  clearInterval(this.state.faceDetectionTimer);
3431
3457
  clearInterval(this.state.imageDetectionTimer);
@@ -3651,20 +3677,6 @@ class Video extends Component {
3651
3677
  }
3652
3678
  componentWillMount() {
3653
3679
  console.log('hsbc_teller_sdk', SDK_VERISON)
3654
- // window.document.startRecord = () => {
3655
- // this.enableServerRecording();
3656
- // }
3657
- // window.document.stopRecord = (recordId) => {
3658
- // this.test_controller.StopRemoteRecord(recordId || this.state.recordId)
3659
- // }
3660
- // window.document.detectNetworkWeak = () => {
3661
- // console.log('detectNetworkWeak')
3662
- // this.test_controller.detectNetworkWeak()
3663
- // }
3664
- // window.document.start = () => {
3665
- // this.startFaceDetection();
3666
- // this.startImageDetection();
3667
- // }
3668
3680
  let arr = []
3669
3681
  for(let i=1;i<=12;i++){
3670
3682
  arr.push({
@@ -4005,8 +4017,8 @@ class Video extends Component {
4005
4017
  if (!this.state.isPictureInPicture) {
4006
4018
  this.pictureInPicture()
4007
4019
  }
4008
- this.saveLog('Start recording')
4009
- this.enableServerRecording()
4020
+ this.saveLog('Start business recording')
4021
+ this.enableServerRecording(this.state.businessId)
4010
4022
  }
4011
4023
  handleOk = () => {
4012
4024
  // 代表此时按钮是暂停会话,把isSuspend改成true变成恢复会话
@@ -6138,7 +6150,7 @@ class Video extends Component {
6138
6150
 
6139
6151
  </ul>
6140
6152
  </div>
6141
- {!this.state.loading && this.state.sessionType && this.state.sessionId?
6153
+ {!this.state.loading && this.state.sessionType && this.state.sessionId && this.props.recordMode == 2?
6142
6154
  <div className='QRCode'>
6143
6155
  <QRCode
6144
6156
  value={JSON.stringify({
@@ -51,7 +51,7 @@ function debounce(fn, delay = 500) {
51
51
  }
52
52
  function isLight(src) {
53
53
  let gray = new cv.Mat()
54
- cv.cvtColor(src, gray, cv.COLOR_RGBA2RGB)
54
+ cv.cvtColor(src, gray, cv.COLOR_BGR2GRAY)
55
55
  let sum = 0;
56
56
  let avg = 0;
57
57
  let scalar = new cv.Scalar()
@@ -59,15 +59,12 @@ function isLight(src) {
59
59
  let size = gray.rows * gray.cols;
60
60
  for (let i = 0; i < 256; i++)
61
61
  ls[i] = 0;
62
- const data = gray.data;
63
- // console.log(data)
64
62
 
65
63
  for (let i = 0; i < gray.rows; i++)
66
64
  {
67
65
  for (let j = 0; j < gray.cols; j++)
68
66
  {
69
- const pos = i*gray.cols + j;
70
- scalar = [data[pos*3], data[pos*3+1], data[pos*3+2]]
67
+ scalar = gray.ucharPtr(i, j);
71
68
  sum += (scalar[0] - 128);
72
69
  let x = scalar[0];
73
70
  ls[x]++;
@@ -78,7 +75,7 @@ function isLight(src) {
78
75
  let mean = 0;
79
76
  for (let i = 0; i < 256; i++)
80
77
  {
81
- total += Math.abs(parseFloat(i - 128) - avg) * ls[i];
78
+ total += Math.abs((i - 128) - avg) * ls[i];
82
79
  }
83
80
  mean = total / size;
84
81
  let cast = Math.abs(avg / mean);