react_hsbc_teller 1.1.4 → 1.1.5

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.4",
3
+ "version": "1.1.5",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -255,6 +255,7 @@ class Video extends Component {
255
255
  };
256
256
  // 初始化视频
257
257
  ConnectMRTC = () => {
258
+ this.test_controller.SetLocalCodecType("H264")
258
259
  const config_param = {};
259
260
  config_param.auto_publish_subscribe = 4;
260
261
  config_param.media_type = 1;
@@ -1153,6 +1154,9 @@ class Video extends Component {
1153
1154
  if (Mival.type == 1) {
1154
1155
  this.switchExternal()
1155
1156
  } else if (Mival.type == 2) {
1157
+ if(streamShare) {
1158
+ streamShare.getTracks().forEach(track => track.stop());
1159
+ }
1156
1160
  this.tabTitlesClick('RMWhiteboard', 'delect')
1157
1161
  if (this.state.isSharedScreen) {
1158
1162
  this.setState({
@@ -3280,7 +3284,6 @@ class Video extends Component {
3280
3284
  )
3281
3285
  }
3282
3286
  switchExternalAge = ()=>{
3283
- const that = this
3284
3287
  if(this.state.isSharedScreen) {
3285
3288
  this.state.isSharedScreen = false
3286
3289
  this.setState({
@@ -3293,26 +3296,30 @@ class Video extends Component {
3293
3296
  }
3294
3297
  }
3295
3298
 
3299
+ this.navigatorClick()
3300
+
3301
+ }
3302
+ navigatorClick=()=>{
3303
+ const that = this
3296
3304
  const publish_config = {};
3297
3305
  const canvas = document.createElement('canvas');
3298
3306
  const videoMedia = document.getElementById('manedvideo');
3299
3307
  const cobj = canvas.getContext('2d'); // 获取绘图环境
3300
3308
  const left = document.getElementById("whiteboardDIV").getBoundingClientRect().left;
3301
- const right = document.getElementById("whiteboardDIV").getBoundingClientRect().right
3302
3309
  const top = document.getElementById("whiteboardDIV").getBoundingClientRect().top
3303
- const bottom = document.getElementById("whiteboardDIV").getBoundingClientRect().bottom
3304
- const width = right - left + 10
3305
- const height = bottom - top - 33
3310
+ const right = document.getElementById("whiteboardDIV").getBoundingClientRect().right
3311
+ const width = left > 21 ? right : right + left
3312
+ const height = document.getElementById("whiteboardDIV").getBoundingClientRect().height
3306
3313
  canvas.width = width;
3307
3314
  canvas.height = height;
3308
- videoMedia.addEventListener('play', (event) =>{
3315
+ videoMedia.addEventListener('play', (event) =>{
3309
3316
  var $this = this; //cache
3310
3317
  console.log('addEventListener',!$this.paused,!$this.ended)
3311
3318
  loop()
3312
3319
  function loop() {
3313
3320
  if (!$this.paused && !$this.ended) {
3314
- cobj.drawImage(videoMedia, left-10, top, width, height, 0, 0,width, height,);
3315
- setTimeout(loop, 1000 / 10); // drawing at 30fps
3321
+ cobj.drawImage(videoMedia, 0, top, width, height, 0, 0,width, height);
3322
+ setTimeout(loop, 1000 / 10); // drawing at 30fps
3316
3323
  }
3317
3324
  }
3318
3325
 
@@ -3345,10 +3352,14 @@ class Video extends Component {
3345
3352
  })
3346
3353
  .then((stream) => {
3347
3354
  videoMedia.srcObject = stream;
3355
+ stream.getVideoTracks()[0].applyConstraints({
3356
+ width: document.body.offsetWidth,
3357
+ height: document.body.offsetHeight
3358
+ })
3348
3359
  streamShare = stream
3349
3360
  stream.getVideoTracks()[0].onended = async ()=>{
3350
3361
  //单击停止共享按钮后,触发这个事件
3351
- if(document.getElementById('video20').name && !this.state.isSharedScreen) {
3362
+ if(document.getElementById('video20').name&&!this.state.isSharedScreen) {
3352
3363
  that.test_controller.UnPublish(document.getElementById('video20').name)
3353
3364
  }
3354
3365
  }
@@ -3357,9 +3368,8 @@ class Video extends Component {
3357
3368
  });
3358
3369
  }
3359
3370
  switchExternal = () => {
3360
- const that = this
3371
+
3361
3372
  if (!this.state.isWhiteboard) {
3362
- const publish_config = {};
3363
3373
  this.setState({
3364
3374
  isWhiteboard: true
3365
3375
  })
@@ -3378,67 +3388,7 @@ class Video extends Component {
3378
3388
  document.exitPictureInPicture()
3379
3389
  }
3380
3390
  }
3381
- const canvas = document.createElement('canvas');
3382
- const videoMedia = document.getElementById('manedvideo');
3383
- const cobj = canvas.getContext('2d'); // 获取绘图环境
3384
- const left = document.getElementById("whiteboardDIV").getBoundingClientRect().left;
3385
- const right = document.getElementById("whiteboardDIV").getBoundingClientRect().right
3386
- const top = document.getElementById("whiteboardDIV").getBoundingClientRect().top
3387
- const bottom = document.getElementById("whiteboardDIV").getBoundingClientRect().bottom
3388
- const width = right - left + 10
3389
- const height = bottom - top - 33
3390
- canvas.width = width;
3391
- canvas.height = height;
3392
- videoMedia.addEventListener('play', (event) =>{
3393
- var $this = this; //cache
3394
- console.log('addEventListener',!$this.paused,!$this.ended)
3395
- loop()
3396
- function loop() {
3397
- if (!$this.paused && !$this.ended) {
3398
- cobj.drawImage(videoMedia, left-10, top, width, height, 0, 0,width, height,);
3399
- setTimeout(loop, 1000 / 10); // drawing at 30fps
3400
- }
3401
- }
3402
-
3403
- if (document.getElementById('video20').name) {
3404
- // 代表已经有了进行切流
3405
- publish_config.publish_device = 5
3406
- publish_config.media_type = 1
3407
- publish_config.degradationType=2
3408
- publish_config.sid = document.getElementById('video20').name
3409
- publish_config.stream = canvas.captureStream(10)
3410
- publish_config.video_profile_type = 9
3411
- this.test_controller.ChangeMediaStream(publish_config);
3412
- } else {
3413
-
3414
- publish_config.media_type = 1
3415
- publish_config.publish_device = 5
3416
- publish_config.need_volume_analyser = true
3417
- publish_config.video_profile_type = 9
3418
- publish_config.degradationType=2
3419
- publish_config.stream = canvas.captureStream(10)
3420
- publish_config.publish_video_id = 'video20'
3421
- publish_config.publish_streamId_id = 'subscribe_streamId10'
3422
- publish_config.publish_tag = 'projectionWhiteboard'
3423
- this.test_controller.Publish(publish_config)
3424
- }
3425
- }, 0);
3426
- navigator.mediaDevices.getDisplayMedia({
3427
- video: true,
3428
- preferCurrentTab:true,
3429
- })
3430
- .then((stream) => {
3431
- videoMedia.srcObject = stream;
3432
- streamShare = stream
3433
- stream.getVideoTracks()[0].onended = async ()=>{
3434
- //单击停止共享按钮后,触发这个事件
3435
- if(document.getElementById('video20').name&&!this.state.isSharedScreen) {
3436
- that.test_controller.UnPublish(document.getElementById('video20').name)
3437
- }
3438
- }
3439
- }, error => {
3440
- console.log("Unable to acquire screen capture", error);
3441
- });
3391
+ this.navigatorClick()
3442
3392
  } else {
3443
3393
  this.messageClick('当前已经切换RM白板','success')
3444
3394
 
@@ -3626,7 +3576,7 @@ class Video extends Component {
3626
3576
  <div className="projection" style={{background: this.state.tabTitles.length > 0 ? '#f0f0f0' : '#ffffff'}}>
3627
3577
  {tabTitleList}
3628
3578
  {/* <img style={sectionStyle} src={require("../../assets/img/placeholder_bg.png").default} alt="" /> */}
3629
- <div id="whiteboardDIV" style={{height: this.state.tabTitles.length > 0 ? 'calc(100% - 33px)' : '100%'}}>
3579
+ <div id="whiteboardDIV" style={{height: 'calc(100% - 33px)'}}>
3630
3580
 
3631
3581
  <div className="videoDiv" style={{ display: (this.state.isSelect == 'RMScreen') ? '' : 'none', }}>
3632
3582
  <div className="videoDiv">
@@ -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{