react_hsbc_teller 1.7.6 → 1.7.9

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.7.6",
3
+ "version": "1.7.9",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -15,16 +15,16 @@ roomId: "656467744508298",
15
15
  // sessionId: '',
16
16
  isVideo: false,
17
17
  tellerAccount: '00000000',
18
- callbackUrl: 'http://182.92.184.31:8720/hsbc/callback',
19
- // callbackUrl: 'https://aag.wealth-platform.uat.ali.cloud.cn.hsbc/nosaml/api/appointment/wealth/api/v1/appointment/ali/createMeetingRoom',
18
+ // callbackUrl: 'http://182.92.184.31:8720/hsbc/callback',
19
+ callbackUrl: 'https://aag.wealth-platform.uat.ali.cloud.cn.hsbc/nosaml/api/appointment/wealth/api/v1/appointment/ali/createMeetingRoom',
20
20
  businessNumber: '',
21
21
  lang: 'zh',
22
- roomServerUrl: 'wss://mrtc.mpaas.cn-hangzhou.aliyuncs.com/ws',
23
- baseURL:'https://counter-web.leimondata.cn:18082/api/leimon-counter-api',
24
- resourcePath: 'https://counter-web.leimondata.cn:7199',
25
- // roomServerUrl: 'wss://app.uat.dsp.hsbcfts.com.cn/mpaas/mrtc/ws',
26
- // baseURL:'https://zuul.uat.dsp.hsbcfts.com.cn/wealth/zuul/api/leimon-counter-api',
27
- // resourcePath:'https://zuul.uat.dsp.hsbcfts.com.cn/wealth/js/',
22
+ // roomServerUrl: 'wss://mrtc.mpaas.cn-hangzhou.aliyuncs.com/ws',
23
+ // baseURL:'https://counter-web.leimondata.cn:18082/api/leimon-counter-api',
24
+ // resourcePath: 'https://counter-web.leimondata.cn:7199',
25
+ roomServerUrl: 'wss://app.uat.dsp.hsbcfts.com.cn/mpaas/mrtc/ws',
26
+ baseURL:'https://zuul.uat.dsp.hsbcfts.com.cn/wealth/zuul/api/leimon-counter-api',
27
+ resourcePath:'https://zuul.uat.dsp.hsbcfts.com.cn/wealth/js/',
28
28
  prohibitPrompt: '无客户',
29
29
  titleBackground: '#40a9ff',
30
30
  titleColor: '#faad14',
@@ -47,6 +47,8 @@ let rateList = []
47
47
  let beautyDiv = {};
48
48
  let isBackgroundBlur = true
49
49
  let isSuccuseHs = false
50
+ let isGraffiti = false
51
+ let strokeColor = '#333'
50
52
  let CanvasHome = styled.div`
51
53
  position: fixed;
52
54
  z-index: ${props=>props.zIndexNum};
@@ -94,6 +96,13 @@ function startBeauty(stream) {
94
96
  beautyDiv = meetingBeautifyStream(newStream, beautyNum);
95
97
  newStream = beautyDiv.stream;
96
98
  return newStream
99
+ }
100
+ async function startMix(stream,onState) {
101
+ var drawCanvas = document.getElementById('canvas');
102
+ await mixInit(drawCanvas);
103
+ mixStart(stream,onState);
104
+
105
+
97
106
  }
98
107
  async function startHs(stream) {
99
108
  // var canvas = document.getElementById('publish_video_canvas');
@@ -117,6 +126,18 @@ async function stopHs() {
117
126
  }
118
127
  isSuccuseHs = false
119
128
 
129
+ }
130
+ async function mixStopClick() {
131
+ var stop_stream = true;//控制是否内部来进行关闭流
132
+ var stream = mixStop(stop_stream);
133
+ if (stream != null && stream != undefined) {
134
+ stream.getTracks().forEach((track) => {
135
+ track.stop();
136
+ });
137
+ stream = null;
138
+ }
139
+ isGraffiti = false
140
+
120
141
  }
121
142
  message.config({
122
143
  getContainer: ()=>document.getElementById('allHSBC')
@@ -135,8 +156,10 @@ class Video extends Component {
135
156
  isScreenSwitching: false,
136
157
  whiteboardWidth: '',
137
158
  whiteboardHeight: '',
159
+ widthVideo: '',
138
160
  whiteboardTop: '',
139
161
  whiteboardLeft: '',
162
+ leftVideo: '',
140
163
  laveRoomSharedScreen: false,
141
164
  isJoinRoom: false,
142
165
  sessionType: false,
@@ -425,11 +448,11 @@ class Video extends Component {
425
448
  handleEdit = () => {
426
449
  console.log(JSON.parse(window.sessionStorage.getItem('sigData')));
427
450
  // eslint-disable-next-line no-undef
428
- initWebSocket('wss://im.uat.dsp.hsbcfts.com.cn:443/wealth/im/ws/')
451
+ // initWebSocket('wss://im.uat.dsp.hsbcfts.com.cn:443/wealth/im/ws/')
429
452
  // initWebSocket('wss://' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname + ':' + '15603' + '/ws/');
430
453
  if(!this.state.imStatus){
431
454
  this.state.manualClose = false
432
- // initWebSocket('wss://' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname + ':' + JSON.parse(window.sessionStorage.getItem('sigData')).webPort + '/ws/');
455
+ initWebSocket('wss://' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname + ':' + JSON.parse(window.sessionStorage.getItem('sigData')).webPort + '/ws/');
433
456
 
434
457
  }
435
458
  const config_param = {};
@@ -2199,7 +2222,7 @@ class Video extends Component {
2199
2222
  this.test_controller.OnSendTextMsgFailed =(msgId, code, msg)=>{
2200
2223
  console.log('发送失败',msgId,code, msg)
2201
2224
  }
2202
- this.test_controller.StreamFilterHandler = async function (publish_tag, stream, stream_type, publish_device, media_type) {
2225
+ this.test_controller.StreamFilterHandler = async (publish_tag, stream, stream_type, publish_device, media_type) =>{
2203
2226
  console.log(`stream processed by client, publish_device=${publish_device}, media_type=${media_type}, publish_tag=${publish_tag},stream_type=${stream_type}`);
2204
2227
  if (stream_type == "subscribe") {
2205
2228
  return stream
@@ -2207,7 +2230,11 @@ class Video extends Component {
2207
2230
  if (media_type == 2 || media_type == 4) {
2208
2231
  return stream
2209
2232
  }
2233
+ // if (publish_device != 2) {
2234
+ // return stream
2235
+ // }
2210
2236
  if(publish_tag == 'tag1') {
2237
+ console.log('tag1',stream)
2211
2238
  let newStream = stream;
2212
2239
  let beauty_strength = beautyNum;
2213
2240
  if (beauty_strength != 0 && stream.getVideoTracks()[0]) {
@@ -2247,6 +2274,43 @@ class Video extends Component {
2247
2274
  newStream.addTrack(stream.getAudioTracks()[0])
2248
2275
  }
2249
2276
  return newStream
2277
+ }
2278
+
2279
+ if(publish_tag == 'projectionWhiteboard' && publish_device == 2) {
2280
+ // this.graffiti()
2281
+ console.log('projectionWhiteboard',stream)
2282
+ let newStream1 = stream;
2283
+ if (stream.getVideoTracks()[0]) {
2284
+ if(this.state.operateShow) {
2285
+ await startMix(newStream1,'mix');
2286
+
2287
+ isGraffiti = true
2288
+ this.setState({
2289
+ zIndexNum: 999
2290
+ })
2291
+ const canvas = document.getElementById('canvas');
2292
+ canvas.width = this.state.widthVideo
2293
+ } else {
2294
+ await startMix(newStream1,'none');
2295
+ }
2296
+
2297
+ newStream1 = mixCaptureStream();
2298
+ console.log('projectionWhiteboard1',newStream1)
2299
+ // 清理原始流
2300
+ newStream1.oninactive = function () {
2301
+ clearOriginStream(stream);
2302
+ };
2303
+ newStream1.getVideoTracks()[0].onended = function () {
2304
+ clearOriginStream(stream);
2305
+ };
2306
+ function clearOriginStream(stream) {
2307
+ stream.getTracks().forEach((track) => {
2308
+ track.stop();
2309
+ });
2310
+ stream = null;
2311
+ }
2312
+ }
2313
+ return newStream1
2250
2314
  } else {
2251
2315
  return stream
2252
2316
  }
@@ -2272,14 +2336,7 @@ class Video extends Component {
2272
2336
  }
2273
2337
  }
2274
2338
  if(sid == document.getElementById('publish_video1').name) {
2275
- var box=document.getElementById("whiteboardDIV");
2276
- if(box){ //此处在加一层判断,更加严密,如果box存在的情况下获取
2277
- this.setState({
2278
- whiteboardTop: box.getBoundingClientRect().top * 1.08 - 40,
2279
- whiteboardLeft: box.getBoundingClientRect().left
2280
- })
2281
- console.log('whiteboardDIV',this.state.whiteboardTop,this.state.whiteboardLeft)
2282
- }
2339
+
2283
2340
  this.setState({
2284
2341
 
2285
2342
  loading: false,
@@ -2317,6 +2374,18 @@ class Video extends Component {
2317
2374
  },
2318
2375
  1000
2319
2376
  );
2377
+ } else {
2378
+ var box=document.getElementById("whiteboardDIV");
2379
+ var box1 = document.getElementById("operate")
2380
+ var height = box1 ? box1.offsetHeight : 40
2381
+ if(box){ //此处在加一层判断,更加严密,如果box存在的情况下获取
2382
+ this.setState({
2383
+ whiteboardTop: box.getBoundingClientRect().top - height,
2384
+ whiteboardLeft: box.getBoundingClientRect().left,
2385
+ leftVideo: (box.offsetWidth - this.state.widthVideo)/2 + box.getBoundingClientRect().left
2386
+ })
2387
+ console.log('whiteboardDIV',this.state.whiteboardTop,this.state.whiteboardLeft)
2388
+ }
2320
2389
  }
2321
2390
  };
2322
2391
  // 发布媒体流失败
@@ -3071,6 +3140,9 @@ class Video extends Component {
3071
3140
  if(isSuccuseHs) {
3072
3141
  stopHs();
3073
3142
  }
3143
+ if(isGraffiti) {
3144
+ mixStopClick()
3145
+ }
3074
3146
 
3075
3147
  console.log('退出房间回调', leaveType);
3076
3148
  };
@@ -3662,7 +3734,8 @@ userType:'1'
3662
3734
  this.props.resourcePath + "/hs/hs_human_segmentation.js",
3663
3735
  this.props.resourcePath + "/hs/hs_human_segmentation.wasm",
3664
3736
 
3665
-
3737
+ this.props.resourcePath + "/mix/mix_frame.js",
3738
+ this.props.resourcePath + "/mix/pageBoard.js"
3666
3739
 
3667
3740
  ]
3668
3741
  const that = this
@@ -4539,6 +4612,14 @@ userType:'1'
4539
4612
 
4540
4613
  videoMedia.addEventListener('play', (event) =>{
4541
4614
  var $this = this; //cache
4615
+ if($this.state.operateShow) {
4616
+ isGraffiti = false
4617
+ this.setState({
4618
+ zIndexNum: 999
4619
+ })
4620
+ const canvas = document.getElementById('canvas');
4621
+ canvas.width = this.state.whiteboardWidth
4622
+ }
4542
4623
  console.log('addEventListener',!$this.paused,!$this.ended,x, y, width, height)
4543
4624
  loop()
4544
4625
  function loop() {
@@ -4580,6 +4661,7 @@ userType:'1'
4580
4661
  navigator.mediaDevices.getDisplayMedia({
4581
4662
  video: true,
4582
4663
  preferCurrentTab:true,
4664
+ audio: true
4583
4665
  // video: {
4584
4666
  // width: document.body.clientWidth,
4585
4667
  // height: document.body.clientHeight
@@ -4599,6 +4681,7 @@ userType:'1'
4599
4681
  })
4600
4682
 
4601
4683
  streamShare = stream
4684
+
4602
4685
  stream.getVideoTracks()[0].onended = async ()=>{
4603
4686
  //单击停止共享按钮后,触发这个事件
4604
4687
  streamShare = ''
@@ -4643,7 +4726,7 @@ userType:'1'
4643
4726
  openCanvas(drawCanvas) {
4644
4727
  if (!this.boardOperate) {
4645
4728
  this.boardOperate = new BoardOperate(drawCanvas, {
4646
- drawColor: "#000000",
4729
+ drawColor: strokeColor,
4647
4730
  drawType: "pen",
4648
4731
  lineWidth: 5,
4649
4732
  fillStyle: '', // 初始背景色,若为空则透明背景
@@ -4663,8 +4746,23 @@ userType:'1'
4663
4746
  });
4664
4747
 
4665
4748
  this.setState({ drawConfig,selectSpan: type });
4749
+ this.boardOperate.drawColor = '#333'
4666
4750
  }
4751
+ setStrokeColor() {
4752
+ console.log(this.boardOperate)
4753
+ const { drawConfig } = this.state;
4754
+ const type = 'pen'
4755
+ drawConfig.curryControl = type;
4756
+ this.boardOperate.changeWay({
4757
+ type
4758
+ });
4667
4759
 
4760
+ this.setState({ drawConfig,selectSpan: type });
4761
+ this.boardOperate.drawColor = '#ff4d4f'
4762
+ this.setState({
4763
+ selectSpan: 'redPen'
4764
+ })
4765
+ }
4668
4766
  setOpreate(type) {
4669
4767
  this.boardOperate[type]();
4670
4768
  }
@@ -4682,13 +4780,30 @@ userType:'1'
4682
4780
  img.src = base64;
4683
4781
  document.body.appendChild(img);
4684
4782
 
4783
+ }
4784
+ graffitiClick=async()=>{
4785
+ if(!isGraffiti) {
4786
+ if (this.state.tabTitles.find(el=>el.value == 'RMScreen')) {
4787
+ // await startMix(document.getElementById('video20').srcObject);
4788
+ // document.getElementById('video20').srcObject = mixCaptureStream();
4789
+
4790
+ mixSetMode('mix')
4791
+ isGraffiti = true
4792
+ console.log('isGraffiti',isGraffiti)
4793
+ const canvas = document.getElementById('canvas');
4794
+ canvas.width = this.state.widthVideo
4795
+ }
4796
+ }
4797
+
4685
4798
  }
4686
4799
  graffiti=()=>{
4800
+
4687
4801
  if(!this.state.operateShow) {
4688
4802
  this.setState({
4689
4803
  zIndexNum: 999
4690
4804
  })
4691
4805
  this.change(true)
4806
+
4692
4807
  }
4693
4808
 
4694
4809
  }
@@ -4697,6 +4812,13 @@ userType:'1'
4697
4812
  zIndexNum: -1
4698
4813
  })
4699
4814
  this.change(false)
4815
+ if(isGraffiti) {
4816
+ isGraffiti = false
4817
+ mixSetMode('none')
4818
+ console.log('isGraffiti',isGraffiti)
4819
+ // var stream = mixStop(false);
4820
+ // document.getElementById('video20').srcObject = stream
4821
+ }
4700
4822
  }
4701
4823
  change(val) {
4702
4824
  this.setState({ operateShow: val })
@@ -4708,6 +4830,10 @@ userType:'1'
4708
4830
  setTimeout(() => {
4709
4831
  this.openCanvas(canvas)
4710
4832
  }, 0);
4833
+ this.graffitiClick()
4834
+ this.setState({
4835
+ selectSpan: 'pen'
4836
+ })
4711
4837
  } else {
4712
4838
  // this.downCanvas()
4713
4839
  this.closeCanvas();
@@ -4784,11 +4910,15 @@ userType:'1'
4784
4910
  }
4785
4911
  componentDidMount() {
4786
4912
  var box=document.getElementById("whiteboardDIV");
4913
+ var box1 = document.getElementById("operate")
4914
+ var height = box1 ? box1.offsetHeight : 40
4787
4915
  if(box){ //此处在加一层判断,更加严密,如果box存在的情况下获取
4788
4916
  this.state.whiteboardWidth = box.offsetWidth,
4789
4917
  this.state.whiteboardHeight = box.offsetHeight * 0.92,
4790
- this.state.whiteboardTop = box.getBoundingClientRect().top * 1.08 - 40
4918
+ this.state.widthVideo = this.state.whiteboardHeight * 1280 / 720
4919
+ this.state.whiteboardTop = box.getBoundingClientRect().top - height
4791
4920
  this.state.whiteboardLeft = box.getBoundingClientRect().left
4921
+ this.state.leftVideo = (box.offsetWidth - this.state.widthVideo)/2 + box.getBoundingClientRect().left
4792
4922
  console.log('whiteboardDIV', this.state.whiteboardHeight,this.state.whiteboardWidth,this.state.whiteboardTop,this.state.whiteboardLeft)
4793
4923
  }
4794
4924
  }
@@ -5092,10 +5222,11 @@ userType:'1'
5092
5222
  {tabTitleList}
5093
5223
  {/* <img style={sectionStyle} src={require("../../assets/img/placeholder_bg.png").default} alt="" /> */}
5094
5224
  <div id="whiteboardDIV" style={{height: 'calc(100% - 33px)'}}>
5095
- <CanvasHome zIndexNum={this.state.zIndexNum} style={{width: this.state.whiteboardWidth + 'Px',height: this.state.whiteboardHeight + 'Px',top: this.state.whiteboardTop + 'Px',left:this.state.whiteboardLeft + 'Px'}}>
5225
+ <CanvasHome zIndexNum={this.state.zIndexNum} style={{width: isGraffiti ? this.state.widthVideo + 'px' : this.state.whiteboardWidth + 'Px',height: this.state.whiteboardHeight + 'Px',top: this.state.whiteboardTop + 'Px',left: isGraffiti ? this.state.leftVideo + 'px' :this.state.whiteboardLeft + 'Px'}}>
5096
5226
  {this.state.operateShow &&
5097
5227
  <OpreateDiv id="operate">
5098
5228
  <span style={{color: this.state.selectSpan == 'pen' ? '#1890ff' : '#333'}} onClick={() => this.setTool('pen')}>铅笔</span>
5229
+ <span style={{color: this.state.selectSpan == 'redPen' ? '#1890ff' : '#333'}} onClick={() => this.setStrokeColor()}>红笔</span>
5099
5230
  <span style={{color: this.state.selectSpan == 'eraser' ? '#1890ff' : '#333'}} onClick={() => this.setTool('eraser')}>橡皮</span>
5100
5231
  <span onClick={() => this.setOpreate('undo')}>撤销</span>
5101
5232
  <span onClick={() => this.setOpreate('redo')}>恢复</span>
@@ -5106,11 +5237,12 @@ userType:'1'
5106
5237
  <canvas id="canvas" className="canvas"></canvas>
5107
5238
  </CanvasHome>
5108
5239
  <div className="videoDiv" style={{ display: (this.state.isSelect == 'RMScreen' || this.state.isSelect == 'staffScreen') ? '' : 'none', }}>
5109
- <div className="videoDiv">
5240
+ <div className="videoDiv" style={{'text-align': 'center'}}>
5110
5241
  <video
5111
5242
  id="video20"
5112
5243
  autoPlay
5113
5244
  muted={true}
5245
+ style={{ height: this.state.whiteboardHeight + 'px',width: this.state.widthVideo + 'px'}}
5114
5246
  className="videoTab"
5115
5247
  disablePictureInPicture
5116
5248
  />