react_hsbc_teller 1.1.5 → 1.1.8

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": "1.1.5",
3
+ "version": "1.1.8",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -47,7 +47,9 @@ function websocketonopen() { // 连接建立之后执行send方法发送数据
47
47
  websocketsend(json2xml(steam));
48
48
  }
49
49
  function websocketonerror() { // 连接建立失败重连
50
- window.IMOpenfire('false');
50
+ window.IMOpenfire({
51
+ status: 'error'
52
+ });
51
53
  console.log('失败');
52
54
  // initWebSocket()
53
55
  }
@@ -99,11 +101,15 @@ function websocketonmessage(e) {
99
101
  } else if (undefined != jsondata.failure) {
100
102
  islogin = false;
101
103
  console.log('登录失败,用户名或者密码错误');
102
- window.IMOpenfire('false');
104
+ window.IMOpenfire({
105
+ status: 'error'
106
+ });
103
107
  } else if (undefined != jsondata.success) {
104
108
  islogin = true;
105
109
  console.log('登录成功!');
106
- window.IMOpenfire('true');
110
+ window.IMOpenfire({
111
+ status: 'success'
112
+ });
107
113
  // 发起新的流
108
114
  newopen();
109
115
  } else if (undefined != jsondata.iq) {
@@ -203,7 +209,10 @@ function websocketsend(Data) { // 数据发送
203
209
  }
204
210
  function websocketclose(e) { // 关闭
205
211
  console.log('断开连接', e);
206
- // window.IMOpenfire('false')
212
+ islogin = false;
213
+ window.IMOpenfire({
214
+ status: 'close'
215
+ })
207
216
  }
208
217
  // 发消息
209
218
  // // 发送消息 to---接收者id,from---发送者id,type---消息类型(chat--单聊,groupchat--群聊)。message--发送的消息
@@ -14,7 +14,7 @@ class Demo extends Component {
14
14
  sessionId: '',
15
15
  isVideo: false,
16
16
  tellerAccount: '00000000',
17
- callbackUrl: 'http://47.102.126.132:8720/hsbc/callback',
17
+ callbackUrl: 'http://182.92.184.31:8720/hsbc/callback',
18
18
  businessNumber: '',
19
19
  lang: 'zh',
20
20
  roomServerUrl: 'wss://mrtc.mpaas.cn-hangzhou.aliyuncs.com/ws',
@@ -24,7 +24,6 @@ class Demo extends Component {
24
24
  // baseURL:'https://zuul.uat.dsp.hsbcfts.com.cn/wealth/zuul/api/leimon-counter-api',
25
25
  // resourcePath:'https://zuul.uat.dsp.hsbcfts.com.cn/wealth/js/',
26
26
  prohibitPrompt: '无客户',
27
- voiceColor: '#333',
28
27
  titleBackground: '#40a9ff',
29
28
  titleColor: '#faad14',
30
29
  microphoneSize: 50,
@@ -127,6 +127,7 @@ class Video extends Component {
127
127
  imJoinRoom: false,
128
128
  analyserData: new Map(),
129
129
  analyserHeight: new Map(),
130
+ OnVolumeAnalyserMap: new Map(),
130
131
  noVideoOne: false,
131
132
  noVideoTwo: false,
132
133
  noVideoThree: false,
@@ -139,6 +140,7 @@ class Video extends Component {
139
140
  noVideoTen: false,
140
141
  noVideoEleven: false,
141
142
  noVideoTwelve: false,
143
+ manualClose: false,
142
144
  };
143
145
  // eslint-disable-next-line no-undef
144
146
  test_controller = '';
@@ -163,7 +165,9 @@ class Video extends Component {
163
165
  publish_config.media_type = 1
164
166
  publish_config.publish_device = 1
165
167
  publish_config.need_volume_analyser = true
166
- publish_config.video_profile_type = 3
168
+ // publish_config.video_profile_type = 3
169
+ publish_config.video_profile_type=100
170
+ publish_config.video_profile_diy={width:640, height:360, frameRate:15, bitrate:400}
167
171
  publish_config.publish_video_id = 'publish_video1'
168
172
  publish_config.publish_streamId_id = 'publish_streamId1'
169
173
  publish_config.publish_tag = 'tag1'
@@ -726,6 +730,7 @@ class Video extends Component {
726
730
  workerClick=()=>{
727
731
  const canvas = document.createElement('canvas');
728
732
  const cobj = canvas.getContext('2d'); // 获取绘图环境
733
+ let microTimerMap = new Map()
729
734
  let blob = new Blob([
730
735
  `
731
736
  let timer;
@@ -841,7 +846,10 @@ class Video extends Component {
841
846
  let analyser = this.state.analyserData.get(sid)
842
847
  aou(analyser)
843
848
  function aou(analyser){
849
+ clearInterval(microTimerMap.get(sid))
850
+ // cancelAnimationFrame(microTimerMap.get(sid))
844
851
  if(analyser) {
852
+
845
853
  let dataArray = new Uint8Array(analyser.frequencyBinCount);
846
854
  analyser.getByteFrequencyData(dataArray);
847
855
  let step = Math.round(dataArray.length / 60); //采样步长
@@ -865,11 +873,18 @@ class Video extends Component {
865
873
  let startY = y1 - height // 绘制起始点y
866
874
  cobj.fillRect(startX, startY, width, height )
867
875
  }
868
- requestAnimationFrame(aou.bind(this, analyser));
876
+ }
877
+ microTimerMap.set(sid,
878
+ setInterval(
879
+ aou.bind(this, analyser),
880
+ 300
881
+ )
882
+ // requestAnimationFrame(aou.bind(this, analyser))
883
+ )
869
884
  }
870
885
 
871
886
 
872
- }
887
+
873
888
  }
874
889
 
875
890
  }
@@ -1350,10 +1365,10 @@ class Video extends Component {
1350
1365
  };
1351
1366
  window.IMOpenfire = msg =>{
1352
1367
  console.log('im登录', msg)
1353
- if(!msg) {
1368
+ if(msg.status == 'error') {
1354
1369
  this.state.sessionType = false
1355
1370
  this.roomCallBack(2, 'im建立连接失败',5)
1356
- } else {
1371
+ } else if (msg.status == 'success') {
1357
1372
  this.state.imStatus = msg
1358
1373
  setTimeout(() => {
1359
1374
  if(this.state.imRoomId && !this.state.imJoinRoom) {
@@ -1362,6 +1377,15 @@ class Video extends Component {
1362
1377
  console.log('IMOpenfire 加入im房间')
1363
1378
  }
1364
1379
  }, 200);
1380
+ } else if (msg.status == 'close') {
1381
+ if(!this.state.manualClose) {
1382
+ this.timer && clearInterval(this.timer);
1383
+ this.state.sessionType = false
1384
+ console.log('IMOpenfireclose')
1385
+ this.roomCallBack(2, '账号重复登录',9)
1386
+
1387
+ }
1388
+
1365
1389
  }
1366
1390
 
1367
1391
  }
@@ -1537,8 +1561,8 @@ class Video extends Component {
1537
1561
  // 音视频关闭通知
1538
1562
  this.test_controller.OnMediaClose = (code, sid) => {
1539
1563
  console.log(code, sid)
1540
- if(code == 5004 || code == 5007) {
1541
- this.roomCallBack(2, '媒体链路连接异常/超时',8)
1564
+ if(code == 5003 || code == 5004 || code == 5005|| code == 5007|| code == 5009|| code == 5010 || code == 5011|| code == 5012) {
1565
+ this.roomCallBack(2, '音视频异常关闭',8)
1542
1566
  }
1543
1567
  };
1544
1568
  // 加入房间成功
@@ -1548,7 +1572,9 @@ class Video extends Component {
1548
1572
  publish_config.media_type = 1
1549
1573
  publish_config.publish_device = 1
1550
1574
  publish_config.need_volume_analyser = true
1551
- publish_config.video_profile_type = 3
1575
+ // publish_config.video_profile_type = 3
1576
+ publish_config.video_profile_type=100
1577
+ publish_config.video_profile_diy={width:640, height:360, frameRate:15, bitrate:400}
1552
1578
  publish_config.publish_video_id = 'publish_video1'
1553
1579
  publish_config.publish_streamId_id = 'publish_streamId1'
1554
1580
  publish_config.publish_tag = 'tag1'
@@ -1590,6 +1616,10 @@ class Video extends Component {
1590
1616
  'tellerId': this.props.tellerAccount
1591
1617
  })
1592
1618
  });
1619
+ if(this.state.screenName == '取消共享') {
1620
+ this.state.isSharedScreen = true
1621
+ this.state.isScreenSwitching = false
1622
+ }
1593
1623
  }
1594
1624
  if(sid == document.getElementById('publish_video1').name) {
1595
1625
  this.setState({
@@ -1791,26 +1821,11 @@ class Video extends Component {
1791
1821
  // 推送“新加⼊房间者”给与会者
1792
1822
  this.test_controller.OnNewJoinerIn = (participant) => {
1793
1823
  console.log('新加⼊房间者', participant);
1794
- // this.test_controller.ChangeStreamSize(document.getElementById('publish_video1').name, 5)
1795
1824
  this.state.isCustomer= true
1796
1825
  };
1797
1826
  // 推送“有新发布”给与会者
1798
1827
  this.test_controller.OnNewPublish = (feed) => {
1799
1828
  console.log('有新发布者', feed);
1800
- // callNimIM('sendChatMsg', {
1801
- // customId: feed.uid,
1802
- // content: JSON.stringify({
1803
- // 'typeId': 1014,
1804
- // 'sessionId': this.state.sessionId,
1805
- // 'meetingInfo': {
1806
- // 'title': this.props.meetingInfo.title,
1807
- // 'host': this.props.meetingInfo.host,
1808
- // 'customers': this.props.meetingInfo.customers
1809
- // }
1810
-
1811
- // })
1812
- // }, function (code, message, data) {
1813
- // })
1814
1829
 
1815
1830
  callNimIM('sendCustomCmdMsg', {
1816
1831
  customId: this.state.imRoomId,
@@ -2153,14 +2168,9 @@ class Video extends Component {
2153
2168
  this.test_controller.OnUnSubscribe = (unsubscriber, feed) => {
2154
2169
  console.log('取消订阅者', unsubscriber, feed)
2155
2170
  };
2156
- // ⾳视频关闭通知
2157
- this.test_controller.OnMediaClose = (code, sid) => {
2158
- console.log('⾳视频关闭通知', code, sid)
2159
- };
2160
2171
  // 退出房间回调
2161
2172
  this.test_controller.OnLeaveRoom = (leaveType) => {
2162
2173
  console.log('退出房间回调', leaveType);
2163
-
2164
2174
  };
2165
2175
  // 推送“退出房间者”给与会者
2166
2176
  this.test_controller.OnParticipantLeaveRoom = (
@@ -2331,7 +2341,12 @@ class Video extends Component {
2331
2341
  loading: false
2332
2342
  })
2333
2343
  }
2334
-
2344
+ if (sid == document.getElementById('video20').name) {
2345
+ if(this.state.screenName == '取消共享') {
2346
+ this.state.isSharedScreen = true
2347
+ this.state.isScreenSwitching = false
2348
+ }
2349
+ }
2335
2350
  };
2336
2351
  // 切流失败通知
2337
2352
  this.test_controller.OnChangeMediaStreamFailed = (
@@ -2355,6 +2370,7 @@ class Video extends Component {
2355
2370
  console.log('服务端录制初始化成功', record_id, record_third_id)
2356
2371
  };
2357
2372
  this.test_controller.OnVolumeAnalyser = (sid, analyser) => {
2373
+ clearInterval(this.state.OnVolumeAnalyserMap.get(sid))
2358
2374
  let publish_sid = document.getElementById('publish_video1').name || document.getElementById('publish_streamId1').name;
2359
2375
  let subscribe_sid1 = document.getElementById('video1').name || document.getElementById('audio1').name;
2360
2376
  let subscribe_sid2 = document.getElementById('video2').name || document.getElementById('audio2').name;
@@ -2450,7 +2466,12 @@ class Video extends Component {
2450
2466
  }
2451
2467
 
2452
2468
  }
2453
- requestAnimationFrame(this.test_controller.OnVolumeAnalyser.bind(this, sid, analyser));
2469
+ this.state.OnVolumeAnalyserMap.set(sid,setInterval(
2470
+ this.test_controller.OnVolumeAnalyser.bind(this, sid, analyser),
2471
+ 300
2472
+ ))
2473
+ this.state.OnVolumeAnalyserMap = this.state.OnVolumeAnalyserMap
2474
+ // requestAnimationFrame(this.test_controller.OnVolumeAnalyser.bind(this, sid, analyser));
2454
2475
 
2455
2476
  this.state.analyserData.set(sid, analyser)
2456
2477
  this.state.analyserData = this.state.analyserData
@@ -2523,16 +2544,11 @@ class Video extends Component {
2523
2544
  }
2524
2545
  if(this.state.imStatus) {
2525
2546
  console.log('disconnect断开连接')
2547
+ this.state.manualClose = true
2526
2548
  disconnect();
2527
2549
  }
2528
2550
 
2529
2551
  }
2530
- clearData=()=>{
2531
- this.setState = (state, callback) => {
2532
- return
2533
- }
2534
- this.cancel = ''
2535
- }
2536
2552
  finishSessionClick= async () => {
2537
2553
  try {
2538
2554
  let result = await API.finishSession({
@@ -2713,6 +2729,7 @@ class Video extends Component {
2713
2729
  }
2714
2730
 
2715
2731
  voice = () => {
2732
+ if (this.isFileSuccuse()) {
2716
2733
  if (!this.state.voiceStatue) {
2717
2734
  // 静音本地
2718
2735
  this.setState({
@@ -2767,10 +2784,11 @@ class Video extends Component {
2767
2784
  console.log(data)
2768
2785
  })
2769
2786
  }
2787
+ }
2770
2788
  };
2771
2789
  isFileSuccuse = () => {
2772
- if (!this.state.sessionId || this.state.isSuspend) {
2773
- this.messageClick(this.props.prohibitPrompt,'error')
2790
+ if (!this.state.sessionId || this.state.isSuspend || !this.state.sessionType) {
2791
+ this.messageClick('当前程序异常请先退出重开','error')
2774
2792
  return false
2775
2793
  } else {
2776
2794
  return true
@@ -2833,7 +2851,9 @@ class Video extends Component {
2833
2851
  const publish_config = {}
2834
2852
  publish_config.media_type = 1
2835
2853
  publish_config.publish_device = 2
2836
- publish_config.video_profile_type = 1
2854
+ // publish_config.video_profile_type = 1
2855
+ publish_config.video_profile_type=100
2856
+ publish_config.video_profile_diy={width:1280, height:720, frameRate:8, bitrate:1500}
2837
2857
  publish_config.enableDesktopAudio=true
2838
2858
  publish_config.degradationType=2
2839
2859
  publish_config.sid = document.getElementById('video20').name
@@ -2877,7 +2897,8 @@ class Video extends Component {
2877
2897
  if (document.getElementById('video20').name) {
2878
2898
  publish_config.media_type = 1;
2879
2899
  publish_config.publish_device = 2;
2880
- publish_config.video_profile_type = 1;
2900
+ publish_config.video_profile_type=100
2901
+ publish_config.video_profile_diy={width:1280, height:720, frameRate:8, bitrate:1500}
2881
2902
  publish_config.enableDesktopAudio=true
2882
2903
  publish_config.degradationType=2
2883
2904
  publish_config.sid = document.getElementById('video20').name;
@@ -2886,7 +2907,8 @@ class Video extends Component {
2886
2907
  publish_config.media_type = 1
2887
2908
  publish_config.publish_device = 2
2888
2909
  publish_config.need_volume_analyser = true
2889
- publish_config.video_profile_type = 1
2910
+ publish_config.video_profile_type=100
2911
+ publish_config.video_profile_diy={width:1280, height:720, frameRate:8, bitrate:1500}
2890
2912
  publish_config.enableDesktopAudio=true
2891
2913
  publish_config.degradationType=2
2892
2914
  publish_config.publish_video_id = 'video20'
@@ -2894,8 +2916,8 @@ class Video extends Component {
2894
2916
  publish_config.publish_tag = 'projectionWhiteboard'
2895
2917
  this.test_controller.Publish(publish_config)
2896
2918
  }
2897
- this.state.isSharedScreen = true
2898
- this.state.isScreenSwitching = false
2919
+ // this.state.isSharedScreen = true
2920
+ // this.state.isScreenSwitching = false
2899
2921
  this.setState({
2900
2922
  screenName: '取消共享',
2901
2923
  isPDF: false
@@ -3038,6 +3060,7 @@ class Video extends Component {
3038
3060
  transcribingClick = () => {
3039
3061
  };
3040
3062
  invitationClick = () => {
3063
+ if (this.isFileSuccuse()) {
3041
3064
  this.state.linkData = ''
3042
3065
  this.setState({
3043
3066
  isModalVisibleInvitation: true,
@@ -3046,7 +3069,7 @@ class Video extends Component {
3046
3069
  employeeError: '',
3047
3070
 
3048
3071
  })
3049
-
3072
+ }
3050
3073
  }
3051
3074
  handleOkInvitation = async () => {
3052
3075
  if(!this.state.employeeName || this.state.employeeError) {
@@ -3330,14 +3353,16 @@ class Video extends Component {
3330
3353
  publish_config.degradationType=2
3331
3354
  publish_config.sid = document.getElementById('video20').name
3332
3355
  publish_config.stream = canvas.captureStream(10)
3333
- publish_config.video_profile_type = 9
3356
+ publish_config.video_profile_type=100
3357
+ publish_config.video_profile_diy={width:1280, height:720, frameRate:8, bitrate:1500}
3334
3358
  this.test_controller.ChangeMediaStream(publish_config);
3335
3359
  } else {
3336
3360
 
3337
3361
  publish_config.media_type = 1
3338
3362
  publish_config.publish_device = 5
3339
3363
  publish_config.need_volume_analyser = true
3340
- publish_config.video_profile_type = 9
3364
+ publish_config.video_profile_type=100
3365
+ publish_config.video_profile_diy={width:1280, height:720, frameRate:8, bitrate:1500}
3341
3366
  publish_config.degradationType=2
3342
3367
  publish_config.stream = canvas.captureStream(10)
3343
3368
  publish_config.publish_video_id = 'video20'
@@ -3368,7 +3393,7 @@ class Video extends Component {
3368
3393
  });
3369
3394
  }
3370
3395
  switchExternal = () => {
3371
-
3396
+ if (this.isFileSuccuse()) {
3372
3397
  if (!this.state.isWhiteboard) {
3373
3398
  this.setState({
3374
3399
  isWhiteboard: true
@@ -3394,7 +3419,7 @@ class Video extends Component {
3394
3419
 
3395
3420
  }
3396
3421
 
3397
-
3422
+ }
3398
3423
  }
3399
3424
  switchSelect = (value) => {
3400
3425
  this.setState({
@@ -3416,7 +3441,9 @@ class Video extends Component {
3416
3441
  }
3417
3442
  }
3418
3443
  inspection = () => {
3444
+ if (this.isFileSuccuse()) {
3419
3445
  this.test_controller.GetDevices()
3446
+ }
3420
3447
  }
3421
3448
  handleOkInspection = () => {
3422
3449
  this.setState({