react_hsbc_teller 2.0.1 → 2.0.3

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.1",
3
+ "version": "2.0.3",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -56,6 +56,7 @@ let pictureInPictureVideo
56
56
  let mix_stream
57
57
  let worker
58
58
  let streamShare
59
+ let streamRecord
59
60
  let videoName
60
61
  let muteJson = new Map()
61
62
  let dateTime = 0
@@ -295,7 +296,7 @@ class Video extends Component {
295
296
  saveLog = (val) => {
296
297
  axios({
297
298
  method: 'get',
298
- baseURL: this.props.logUrl + '&message=' + encodeURIComponent(val) + '&react_hsbc_teller=2.0.1&logTime=' + Date.now() + '&mtoken=' + encodeURIComponent(this.state.rtoken) + '&roomId=' + encodeURIComponent(this.state.channelId) + '&sessionId=' + encodeURIComponent(this.state.sessionId) + '&appointmentID=' + this.props.businessNumber,
299
+ baseURL: this.props.logUrl + '&message=' + encodeURIComponent(val) + '&react_hsbc_teller=2.0.3&logTime=' + Date.now() + '&mtoken=' + encodeURIComponent(this.state.rtoken) + '&roomId=' + encodeURIComponent(this.state.channelId) + '&sessionId=' + encodeURIComponent(this.state.sessionId) + '&appointmentID=' + this.props.businessNumber,
299
300
 
300
301
  }).then(res => {
301
302
 
@@ -327,7 +328,7 @@ class Video extends Component {
327
328
 
328
329
  this.state.cameraList.forEach((el, i) => {
329
330
  let publish_config = {}
330
- publish_config.media_type = 1
331
+ publish_config.media_type = i==0? 1:3
331
332
  publish_config.publish_device = 1
332
333
  publish_config.videoSource = el.actionid
333
334
  publish_config.audioSource = this.state.microphoneValue
@@ -340,6 +341,7 @@ class Video extends Component {
340
341
  publish_config.publish_tag = 'tag' + (i+1)
341
342
  this.test_controller.Publish(publish_config)
342
343
  })
344
+ this.publishAllScreen();
343
345
 
344
346
  // eslint-disable-next-line no-undef
345
347
  setTimeout(() => {
@@ -633,6 +635,13 @@ class Video extends Component {
633
635
  width: 213,
634
636
  height: 175
635
637
  },
638
+ {
639
+ tag: 'RM_ALL_SCREEN',
640
+ xPosition: 960,
641
+ yPosition: 180,
642
+ width: 320,
643
+ height: 180
644
+ }
636
645
  ]
637
646
  Array.isArray(res) ?
638
647
  res.map((item) => {
@@ -954,6 +963,10 @@ class Video extends Component {
954
963
  streamShare.getTracks().forEach(track => track.stop());
955
964
  streamShare = ''
956
965
  }
966
+ if (streamRecord) {
967
+ streamRecord.getTracks().forEach(track => track.stop());
968
+ streamRecord = ''
969
+ }
957
970
  this.finishSession()
958
971
 
959
972
  };
@@ -1703,7 +1716,7 @@ class Video extends Component {
1703
1716
 
1704
1717
  this.state.cameraList.forEach((el, i) => {
1705
1718
  let publish_config = {}
1706
- publish_config.media_type = 1
1719
+ publish_config.media_type = i==0? 1:3
1707
1720
  publish_config.publish_device = 1
1708
1721
  publish_config.videoSource = el.actionid
1709
1722
  publish_config.audioSource = this.state.microphoneValue
@@ -1716,6 +1729,7 @@ class Video extends Component {
1716
1729
  publish_config.publish_tag = 'tag' + (i+1)
1717
1730
  this.test_controller.Publish(publish_config)
1718
1731
  })
1732
+ this.publishAllScreen();
1719
1733
 
1720
1734
  this.roomCallBack(1, '', 0)
1721
1735
  this.saveLog('mrtc join room success')
@@ -2996,7 +3010,7 @@ class Video extends Component {
2996
3010
  }
2997
3011
  }
2998
3012
  componentWillMount() {
2999
- console.log('hsbc_teller_sdk', '2.0.1')
3013
+ console.log('hsbc_teller_sdk', '2.0.3')
3000
3014
  let arr = []
3001
3015
  for(let i=1;i<=12;i++){
3002
3016
  arr.push({
@@ -4306,6 +4320,83 @@ class Video extends Component {
4306
4320
  console.log("Unable to acquire screen capture", error);
4307
4321
  });
4308
4322
  }
4323
+ // publishAllScreen = () => {
4324
+
4325
+ // }
4326
+ publishAllScreen = () => {
4327
+ const that = this
4328
+ const publish_config = {};
4329
+ const canvas = document.createElement('canvas');
4330
+ const videoMedia = document.getElementById('recordvideo');
4331
+ const cobj = canvas.getContext('2d'); // 获取绘图环境
4332
+ const left = document.getElementById("whiteboardDIV").getBoundingClientRect().left;
4333
+ const right = document.getElementById("whiteboardDIV").getBoundingClientRect().right
4334
+ const top = document.getElementById("whiteboardDIV").getBoundingClientRect().top
4335
+ const bottom = document.getElementById("whiteboardDIV").getBoundingClientRect().bottom
4336
+ let width = ((right - left) * window.screen.width / document.body.clientWidth) - 5
4337
+ let height = ((bottom - top) * window.screen.width / document.body.clientWidth) - 30
4338
+ let x = (left * window.screen.width / document.body.clientWidth)
4339
+ let y = (top * window.screen.width / document.body.clientWidth) + 8
4340
+ // console.error(left, right, top, bottom)
4341
+ // console.error(width,height,x,y)
4342
+
4343
+
4344
+ canvas.width = 960;
4345
+ canvas.height = 540;
4346
+
4347
+
4348
+ videoMedia.addEventListener('play', (event) => {
4349
+ var $this = this; //cache
4350
+ console.log('addEventListener', !$this.paused, !$this.ended, x, y, width, height)
4351
+ loop()
4352
+ function loop() {
4353
+ if (!$this.paused && !$this.ended) {
4354
+ cobj.drawImage(videoMedia, x, y, width, height, 0, 0, 960, 540);
4355
+ setTimeout(loop, 1000 / 20); // drawing at 30fps
4356
+ }
4357
+ }
4358
+
4359
+ publish_config.media_type = 3
4360
+ publish_config.publish_device = 5
4361
+ publish_config.need_volume_analyser = false
4362
+ publish_config.video_profile_type = 1
4363
+ publish_config.degradationType = 2
4364
+ publish_config.stream = canvas.captureStream(10)
4365
+ publish_config.publish_video_id = 'record_video'
4366
+ publish_config.publish_streamId_id = 'record_video_streamId'
4367
+ publish_config.publish_tag = 'RM_ALL_SCREEN'
4368
+ this.test_controller.Publish(publish_config)
4369
+ }, 0);
4370
+ navigator.mediaDevices.getDisplayMedia({
4371
+ video: true,
4372
+ preferCurrentTab: true,
4373
+ })
4374
+ .then((stream) => {
4375
+ if (streamRecord) {
4376
+ streamRecord.getTracks().forEach(track => track.stop());
4377
+ streamRecord = ''
4378
+ }
4379
+ videoMedia.srcObject = stream;
4380
+ stream.getVideoTracks()[0].applyConstraints({
4381
+ // width: 1280,
4382
+ // height: 720
4383
+ width: window.screen.width,
4384
+ height: window.screen.height
4385
+ })
4386
+
4387
+ streamRecord = stream
4388
+
4389
+ stream.getVideoTracks()[0].onended = async () => {
4390
+ //单击停止共享按钮后,触发这个事件
4391
+ streamRecord = ''
4392
+ if (document.getElementById('record_video').name) {
4393
+ that.test_controller.UnPublish(document.getElementById('record_video').name)
4394
+ }
4395
+ }
4396
+ }, error => {
4397
+ console.log("Unable to acquire screen capture", error);
4398
+ });
4399
+ }
4309
4400
  switchExternal = () => {
4310
4401
  if (this.isFileSuccuse()) {
4311
4402
  if (!this.state.tabTitles.find(el => el.value == 'staffScreen')) {
@@ -5713,6 +5804,8 @@ class Video extends Component {
5713
5804
  <video className="mixedvideo" id="manedvideo" autoPlay width="0" height="0"></video>
5714
5805
  <video className="mixedvideo" id="video30" autoPlay width="0" height="0"></video>
5715
5806
 
5807
+ <video className="mixedvideo" id="recordvideo" autoPlay width="0" height="0"></video>
5808
+ <video className="mixedvideo" id="record_video" muted autoPlay></video>
5716
5809
 
5717
5810
  </Spin>
5718
5811
  </div>);