react_hsbc_teller 1.1.3 → 1.1.6

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.3",
3
+ "version": "1.1.6",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -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',
@@ -30,6 +30,7 @@ const LEAVE_TYPE = {
30
30
  let pictureInPictureVideo
31
31
  let mix_stream
32
32
  let worker
33
+ let streamShare
33
34
  message.config({
34
35
  getContainer: ()=>document.getElementById('allHSBC')
35
36
  })
@@ -157,11 +158,7 @@ class Video extends Component {
157
158
  });
158
159
  console.log(result);
159
160
  this.state.imRoomId = result.imRoomId,
160
- this.state.sessionId = result.sessionId,
161
- this.setState({
162
-
163
- loading: false,
164
- });
161
+ this.state.sessionId = result.sessionId;
165
162
  let publish_config = {}
166
163
  publish_config.media_type = 1
167
164
  publish_config.publish_device = 1
@@ -258,6 +255,7 @@ class Video extends Component {
258
255
  };
259
256
  // 初始化视频
260
257
  ConnectMRTC = () => {
258
+ this.test_controller.SetLocalCodecType("H264")
261
259
  const config_param = {};
262
260
  config_param.auto_publish_subscribe = 4;
263
261
  config_param.media_type = 1;
@@ -585,6 +583,9 @@ class Video extends Component {
585
583
  }
586
584
  };
587
585
  endSessionValue = () => {
586
+ if(streamShare) {
587
+ streamShare.getTracks().forEach(track => track.stop());
588
+ }
588
589
  this.finishSession()
589
590
 
590
591
  };
@@ -725,6 +726,7 @@ class Video extends Component {
725
726
  workerClick=()=>{
726
727
  const canvas = document.createElement('canvas');
727
728
  const cobj = canvas.getContext('2d'); // 获取绘图环境
729
+ let microTimerMap = new Map()
728
730
  let blob = new Blob([
729
731
  `
730
732
  let timer;
@@ -841,6 +843,7 @@ class Video extends Component {
841
843
  aou(analyser)
842
844
  function aou(analyser){
843
845
  if(analyser) {
846
+ cancelAnimationFrame(microTimerMap.get(sid))
844
847
  let dataArray = new Uint8Array(analyser.frequencyBinCount);
845
848
  analyser.getByteFrequencyData(dataArray);
846
849
  let step = Math.round(dataArray.length / 60); //采样步长
@@ -864,7 +867,7 @@ class Video extends Component {
864
867
  let startY = y1 - height // 绘制起始点y
865
868
  cobj.fillRect(startX, startY, width, height )
866
869
  }
867
- requestAnimationFrame(aou.bind(this, analyser));
870
+ microTimerMap.set(sid,requestAnimationFrame(aou.bind(this, analyser)) )
868
871
  }
869
872
 
870
873
 
@@ -1153,6 +1156,9 @@ class Video extends Component {
1153
1156
  if (Mival.type == 1) {
1154
1157
  this.switchExternal()
1155
1158
  } else if (Mival.type == 2) {
1159
+ if(streamShare) {
1160
+ streamShare.getTracks().forEach(track => track.stop());
1161
+ }
1156
1162
  this.tabTitlesClick('RMWhiteboard', 'delect')
1157
1163
  if (this.state.isSharedScreen) {
1158
1164
  this.setState({
@@ -1586,8 +1592,16 @@ class Video extends Component {
1586
1592
  'tellerId': this.props.tellerAccount
1587
1593
  })
1588
1594
  });
1595
+ if(this.state.screenName == '取消共享') {
1596
+ this.state.isSharedScreen = true
1597
+ this.state.isScreenSwitching = false
1598
+ }
1589
1599
  }
1590
1600
  if(sid == document.getElementById('publish_video1').name) {
1601
+ this.setState({
1602
+
1603
+ loading: false,
1604
+ });
1591
1605
  this.enterRoom()
1592
1606
  this.timer = setInterval(
1593
1607
  () => {
@@ -2323,7 +2337,12 @@ class Video extends Component {
2323
2337
  loading: false
2324
2338
  })
2325
2339
  }
2326
-
2340
+ if (sid == document.getElementById('video20').name) {
2341
+ if(this.state.screenName == '取消共享') {
2342
+ this.state.isSharedScreen = true
2343
+ this.state.isScreenSwitching = false
2344
+ }
2345
+ }
2327
2346
  };
2328
2347
  // 切流失败通知
2329
2348
  this.test_controller.OnChangeMediaStreamFailed = (
@@ -2838,6 +2857,9 @@ class Video extends Component {
2838
2857
  console.log('投屏')
2839
2858
  if (this.isFileSuccuse()) {
2840
2859
  const publish_config = {};
2860
+ if(streamShare) {
2861
+ streamShare.getTracks().forEach(track => track.stop());
2862
+ }
2841
2863
  if (this.state.isSharedScreen) {
2842
2864
  // if (this.state.isWhiteboard) {
2843
2865
  // publish_config.publish_device = 4
@@ -2883,8 +2905,8 @@ class Video extends Component {
2883
2905
  publish_config.publish_tag = 'projectionWhiteboard'
2884
2906
  this.test_controller.Publish(publish_config)
2885
2907
  }
2886
- this.state.isSharedScreen = true
2887
- this.state.isScreenSwitching = false
2908
+ // this.state.isSharedScreen = true
2909
+ // this.state.isScreenSwitching = false
2888
2910
  this.setState({
2889
2911
  screenName: '取消共享',
2890
2912
  isPDF: false
@@ -3273,7 +3295,6 @@ class Video extends Component {
3273
3295
  )
3274
3296
  }
3275
3297
  switchExternalAge = ()=>{
3276
- const that = this
3277
3298
  if(this.state.isSharedScreen) {
3278
3299
  this.state.isSharedScreen = false
3279
3300
  this.setState({
@@ -3286,26 +3307,30 @@ class Video extends Component {
3286
3307
  }
3287
3308
  }
3288
3309
 
3310
+ this.navigatorClick()
3311
+
3312
+ }
3313
+ navigatorClick=()=>{
3314
+ const that = this
3289
3315
  const publish_config = {};
3290
3316
  const canvas = document.createElement('canvas');
3291
3317
  const videoMedia = document.getElementById('manedvideo');
3292
3318
  const cobj = canvas.getContext('2d'); // 获取绘图环境
3293
3319
  const left = document.getElementById("whiteboardDIV").getBoundingClientRect().left;
3294
- const right = document.getElementById("whiteboardDIV").getBoundingClientRect().right
3295
3320
  const top = document.getElementById("whiteboardDIV").getBoundingClientRect().top
3296
- const bottom = document.getElementById("whiteboardDIV").getBoundingClientRect().bottom
3297
- const width = right - left + 10
3298
- const height = bottom - top - 33
3321
+ const right = document.getElementById("whiteboardDIV").getBoundingClientRect().right
3322
+ const width = left > 21 ? right : right + left
3323
+ const height = document.getElementById("whiteboardDIV").getBoundingClientRect().height
3299
3324
  canvas.width = width;
3300
3325
  canvas.height = height;
3301
- videoMedia.addEventListener('play', (event) =>{
3326
+ videoMedia.addEventListener('play', (event) =>{
3302
3327
  var $this = this; //cache
3303
3328
  console.log('addEventListener',!$this.paused,!$this.ended)
3304
3329
  loop()
3305
3330
  function loop() {
3306
3331
  if (!$this.paused && !$this.ended) {
3307
- cobj.drawImage(videoMedia, left-10, top, width, height, 0, 0,width, height,);
3308
- setTimeout(loop, 1000 / 10); // drawing at 30fps
3332
+ cobj.drawImage(videoMedia, 0, top, width, height, 0, 0,width, height);
3333
+ setTimeout(loop, 1000 / 10); // drawing at 30fps
3309
3334
  }
3310
3335
  }
3311
3336
 
@@ -3338,9 +3363,14 @@ class Video extends Component {
3338
3363
  })
3339
3364
  .then((stream) => {
3340
3365
  videoMedia.srcObject = stream;
3366
+ stream.getVideoTracks()[0].applyConstraints({
3367
+ width: document.body.offsetWidth,
3368
+ height: document.body.offsetHeight
3369
+ })
3370
+ streamShare = stream
3341
3371
  stream.getVideoTracks()[0].onended = async ()=>{
3342
3372
  //单击停止共享按钮后,触发这个事件
3343
- if(document.getElementById('video20').name && !this.state.isSharedScreen) {
3373
+ if(document.getElementById('video20').name&&!this.state.isSharedScreen) {
3344
3374
  that.test_controller.UnPublish(document.getElementById('video20').name)
3345
3375
  }
3346
3376
  }
@@ -3349,9 +3379,8 @@ class Video extends Component {
3349
3379
  });
3350
3380
  }
3351
3381
  switchExternal = () => {
3352
- const that = this
3382
+
3353
3383
  if (!this.state.isWhiteboard) {
3354
- const publish_config = {};
3355
3384
  this.setState({
3356
3385
  isWhiteboard: true
3357
3386
  })
@@ -3370,66 +3399,7 @@ class Video extends Component {
3370
3399
  document.exitPictureInPicture()
3371
3400
  }
3372
3401
  }
3373
- const canvas = document.createElement('canvas');
3374
- const videoMedia = document.getElementById('manedvideo');
3375
- const cobj = canvas.getContext('2d'); // 获取绘图环境
3376
- const left = document.getElementById("whiteboardDIV").getBoundingClientRect().left;
3377
- const right = document.getElementById("whiteboardDIV").getBoundingClientRect().right
3378
- const top = document.getElementById("whiteboardDIV").getBoundingClientRect().top
3379
- const bottom = document.getElementById("whiteboardDIV").getBoundingClientRect().bottom
3380
- const width = right - left + 10
3381
- const height = bottom - top - 33
3382
- canvas.width = width;
3383
- canvas.height = height;
3384
- videoMedia.addEventListener('play', (event) =>{
3385
- var $this = this; //cache
3386
- console.log('addEventListener',!$this.paused,!$this.ended)
3387
- loop()
3388
- function loop() {
3389
- if (!$this.paused && !$this.ended) {
3390
- cobj.drawImage(videoMedia, left-10, top, width, height, 0, 0,width, height,);
3391
- setTimeout(loop, 1000 / 10); // drawing at 30fps
3392
- }
3393
- }
3394
-
3395
- if (document.getElementById('video20').name) {
3396
- // 代表已经有了进行切流
3397
- publish_config.publish_device = 5
3398
- publish_config.media_type = 1
3399
- publish_config.degradationType=2
3400
- publish_config.sid = document.getElementById('video20').name
3401
- publish_config.stream = canvas.captureStream(10)
3402
- publish_config.video_profile_type = 9
3403
- this.test_controller.ChangeMediaStream(publish_config);
3404
- } else {
3405
-
3406
- publish_config.media_type = 1
3407
- publish_config.publish_device = 5
3408
- publish_config.need_volume_analyser = true
3409
- publish_config.video_profile_type = 9
3410
- publish_config.degradationType=2
3411
- publish_config.stream = canvas.captureStream(10)
3412
- publish_config.publish_video_id = 'video20'
3413
- publish_config.publish_streamId_id = 'subscribe_streamId10'
3414
- publish_config.publish_tag = 'projectionWhiteboard'
3415
- this.test_controller.Publish(publish_config)
3416
- }
3417
- }, 0);
3418
- navigator.mediaDevices.getDisplayMedia({
3419
- video: true,
3420
- preferCurrentTab:true,
3421
- })
3422
- .then((stream) => {
3423
- videoMedia.srcObject = stream;
3424
- stream.getVideoTracks()[0].onended = async ()=>{
3425
- //单击停止共享按钮后,触发这个事件
3426
- if(document.getElementById('video20').name&&!this.state.isSharedScreen) {
3427
- that.test_controller.UnPublish(document.getElementById('video20').name)
3428
- }
3429
- }
3430
- }, error => {
3431
- console.log("Unable to acquire screen capture", error);
3432
- });
3402
+ this.navigatorClick()
3433
3403
  } else {
3434
3404
  this.messageClick('当前已经切换RM白板','success')
3435
3405
 
@@ -3492,7 +3462,7 @@ class Video extends Component {
3492
3462
  var box=document.getElementById("whiteboardDIV");
3493
3463
  if(box){ //此处在加一层判断,更加严密,如果box存在的情况下获取
3494
3464
  this.state.whiteboardWidth = box.offsetWidth,
3495
- this.state.whiteboardHeight = box.offsetHeight - 33,
3465
+ this.state.whiteboardHeight = box.offsetHeight * 0.92,
3496
3466
  console.log('whiteboardDIV', this.state.whiteboardHeight,box.clientHeight,this.state.whiteboardWidth)
3497
3467
  }
3498
3468
  }
@@ -3617,7 +3587,7 @@ class Video extends Component {
3617
3587
  <div className="projection" style={{background: this.state.tabTitles.length > 0 ? '#f0f0f0' : '#ffffff'}}>
3618
3588
  {tabTitleList}
3619
3589
  {/* <img style={sectionStyle} src={require("../../assets/img/placeholder_bg.png").default} alt="" /> */}
3620
- <div id="whiteboardDIV" style={{height: this.state.tabTitles.length > 0 ? 'calc(100% - 33px)' : '100%'}}>
3590
+ <div id="whiteboardDIV" style={{height: 'calc(100% - 33px)'}}>
3621
3591
 
3622
3592
  <div className="videoDiv" style={{ display: (this.state.isSelect == 'RMScreen') ? '' : 'none', }}>
3623
3593
  <div className="videoDiv">
@@ -4169,7 +4139,7 @@ class Video extends Component {
4169
4139
  ></CanvasDraw>
4170
4140
  </div>
4171
4141
  </Modal>
4172
- <Modal title="设置视频设备" closable={false} centered={true} visible={this.state.isModalVisibleInspection} footer={[
4142
+ <Modal title="设置视频设备" width={650} closable={false} centered={true} visible={this.state.isModalVisibleInspection} footer={[
4173
4143
  <div key='inspection'>
4174
4144
  <Button className="modelButtonCancel" onClick={this.handleCancelInspection}>取消</Button>
4175
4145
  <Button className="modelButtonOk" type="primary" danger onClick={this.handleOkInspection}>确定</Button>
@@ -4184,7 +4154,7 @@ class Video extends Component {
4184
4154
  this.state.speakerList.length > 0 &&
4185
4155
  <span>
4186
4156
  <div>扬声器:
4187
- <span className='speakerTitle'>(请更改系统设置)</span>
4157
+ <span className='speakerTitle'>(此为默认选项。若需切换,请在平板电脑右下角任务栏中的Speaker设置中调整)</span>
4188
4158
  </div>
4189
4159
  {speaker}
4190
4160
  </span>
@@ -79,7 +79,7 @@
79
79
  height: 100%;
80
80
  }
81
81
  .health{
82
- padding: 20px;
82
+ padding: 20Px;
83
83
  background: #f0f0f0;
84
84
  }
85
85
  .healthVideo{