react_hsbc_teller 2.0.2 → 2.0.4

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.2",
3
+ "version": "2.0.4",
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.2&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.4&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
 
@@ -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
  };
@@ -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')
@@ -1829,23 +1843,7 @@ class Video extends Component {
1829
1843
  if (publish_tag == 'tag1') {
1830
1844
  console.log('tag1', stream)
1831
1845
  let newStream = stream;
1832
- // if (stream.getVideoTracks()[0]) {
1833
- // await startBeauty(newStream);
1834
- // newStream = beautyCaptureStream();
1835
- // // 清理原始流
1836
- // newStream.oninactive = function () {
1837
- // clearOriginStream(stream);
1838
- // };
1839
- // newStream.getVideoTracks()[0].onended = function () {
1840
- // clearOriginStream(stream);
1841
- // };
1842
- // function clearOriginStream(stream) {
1843
- // stream.getTracks().forEach((track) => {
1844
- // track.stop();
1845
- // });
1846
- // stream = null;
1847
- // }
1848
- // };
1846
+
1849
1847
  if (stream.getVideoTracks()[0]) {
1850
1848
  await startBeauty(newStream);
1851
1849
  newStream = beautyCaptureStream();
@@ -1872,8 +1870,7 @@ class Video extends Component {
1872
1870
  }
1873
1871
 
1874
1872
  if (publish_tag == 'projectionWhiteboard' && publish_device == 2) {
1875
- // this.graffiti()
1876
- console.log('projectionWhiteboard', stream)
1873
+
1877
1874
  let newStream1 = stream;
1878
1875
  if (stream.getVideoTracks()[0]) {
1879
1876
  if (this.state.operateShow) {
@@ -1890,6 +1887,8 @@ class Video extends Component {
1890
1887
  }
1891
1888
 
1892
1889
  newStream1 = mixCaptureStream();
1890
+ newStream1.getVideoTracks()[0].contentHint = "text"; // 解决清晰度问题
1891
+
1893
1892
  console.log('projectionWhiteboard1', newStream1)
1894
1893
  // 清理原始流
1895
1894
  newStream1.oninactive = function () {
@@ -2996,7 +2995,7 @@ class Video extends Component {
2996
2995
  }
2997
2996
  }
2998
2997
  componentWillMount() {
2999
- console.log('hsbc_teller_sdk', '2.0.2')
2998
+ console.log('hsbc_teller_sdk', '2.0.4')
3000
2999
  let arr = []
3001
3000
  for(let i=1;i<=12;i++){
3002
3001
  arr.push({
@@ -4306,6 +4305,83 @@ class Video extends Component {
4306
4305
  console.log("Unable to acquire screen capture", error);
4307
4306
  });
4308
4307
  }
4308
+ // publishAllScreen = () => {
4309
+
4310
+ // }
4311
+ publishAllScreen = () => {
4312
+ const that = this
4313
+ const publish_config = {};
4314
+ const canvas = document.createElement('canvas');
4315
+ const videoMedia = document.getElementById('recordvideo');
4316
+ const cobj = canvas.getContext('2d'); // 获取绘图环境
4317
+ const left = document.getElementById("whiteboardDIV").getBoundingClientRect().left;
4318
+ const right = document.getElementById("whiteboardDIV").getBoundingClientRect().right
4319
+ const top = document.getElementById("whiteboardDIV").getBoundingClientRect().top
4320
+ const bottom = document.getElementById("whiteboardDIV").getBoundingClientRect().bottom
4321
+ let width = ((right - left) * window.screen.width / document.body.clientWidth) - 5
4322
+ let height = ((bottom - top) * window.screen.width / document.body.clientWidth) - 30
4323
+ let x = (left * window.screen.width / document.body.clientWidth)
4324
+ let y = (top * window.screen.width / document.body.clientWidth) + 8
4325
+ // console.error(left, right, top, bottom)
4326
+ // console.error(width,height,x,y)
4327
+
4328
+
4329
+ canvas.width = 960;
4330
+ canvas.height = 540;
4331
+
4332
+
4333
+ videoMedia.addEventListener('play', (event) => {
4334
+ var $this = this; //cache
4335
+ console.log('addEventListener', !$this.paused, !$this.ended, x, y, width, height)
4336
+ loop()
4337
+ function loop() {
4338
+ if (!$this.paused && !$this.ended) {
4339
+ cobj.drawImage(videoMedia, x, y, width, height, 0, 0, 960, 540);
4340
+ setTimeout(loop, 1000 / 20); // drawing at 30fps
4341
+ }
4342
+ }
4343
+
4344
+ publish_config.media_type = 3
4345
+ publish_config.publish_device = 5
4346
+ publish_config.need_volume_analyser = false
4347
+ publish_config.video_profile_type = 1
4348
+ publish_config.degradationType = 2
4349
+ publish_config.stream = canvas.captureStream(10)
4350
+ publish_config.publish_video_id = 'record_video'
4351
+ publish_config.publish_streamId_id = 'record_video_streamId'
4352
+ publish_config.publish_tag = 'RM_ALL_SCREEN'
4353
+ this.test_controller.Publish(publish_config)
4354
+ }, 0);
4355
+ navigator.mediaDevices.getDisplayMedia({
4356
+ video: true,
4357
+ preferCurrentTab: true,
4358
+ })
4359
+ .then((stream) => {
4360
+ if (streamRecord) {
4361
+ streamRecord.getTracks().forEach(track => track.stop());
4362
+ streamRecord = ''
4363
+ }
4364
+ videoMedia.srcObject = stream;
4365
+ stream.getVideoTracks()[0].applyConstraints({
4366
+ // width: 1280,
4367
+ // height: 720
4368
+ width: window.screen.width,
4369
+ height: window.screen.height
4370
+ })
4371
+
4372
+ streamRecord = stream
4373
+
4374
+ stream.getVideoTracks()[0].onended = async () => {
4375
+ //单击停止共享按钮后,触发这个事件
4376
+ streamRecord = ''
4377
+ if (document.getElementById('record_video').name) {
4378
+ that.test_controller.UnPublish(document.getElementById('record_video').name)
4379
+ }
4380
+ }
4381
+ }, error => {
4382
+ console.log("Unable to acquire screen capture", error);
4383
+ });
4384
+ }
4309
4385
  switchExternal = () => {
4310
4386
  if (this.isFileSuccuse()) {
4311
4387
  if (!this.state.tabTitles.find(el => el.value == 'staffScreen')) {
@@ -5713,6 +5789,8 @@ class Video extends Component {
5713
5789
  <video className="mixedvideo" id="manedvideo" autoPlay width="0" height="0"></video>
5714
5790
  <video className="mixedvideo" id="video30" autoPlay width="0" height="0"></video>
5715
5791
 
5792
+ <video className="mixedvideo" id="recordvideo" autoPlay width="0" height="0"></video>
5793
+ <video className="mixedvideo" id="record_video" muted autoPlay></video>
5716
5794
 
5717
5795
  </Spin>
5718
5796
  </div>);