react_hsbc_teller 1.1.2 → 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
package/packages/demo/demo.js
CHANGED
|
@@ -4,17 +4,17 @@ import Pdf from './pdf.js'
|
|
|
4
4
|
|
|
5
5
|
class Demo extends Component {
|
|
6
6
|
state = {
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
7
|
+
// imRoomId: "9K9ea1vOM@conference.ls-im-xmpp.chinawp.dev.ali.cloud.cn.hsbc",
|
|
8
|
+
// sessionId: "9K9ea1vOM",
|
|
9
|
+
// mtoken: "d4e648858b03",
|
|
10
|
+
// roomId: "645110140224386",
|
|
11
11
|
roomId: '',
|
|
12
12
|
mtoken: '',
|
|
13
13
|
imRoomId: '',
|
|
14
14
|
sessionId: '',
|
|
15
15
|
isVideo: false,
|
|
16
16
|
tellerAccount: '00000000',
|
|
17
|
-
callbackUrl: 'http://
|
|
17
|
+
callbackUrl: 'http://47.102.126.132: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
|
};
|
|
@@ -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({
|
|
@@ -1533,7 +1537,7 @@ class Video extends Component {
|
|
|
1533
1537
|
// 音视频关闭通知
|
|
1534
1538
|
this.test_controller.OnMediaClose = (code, sid) => {
|
|
1535
1539
|
console.log(code, sid)
|
|
1536
|
-
if(
|
|
1540
|
+
if(code == 5004 || code == 5007) {
|
|
1537
1541
|
this.roomCallBack(2, '媒体链路连接异常/超时',8)
|
|
1538
1542
|
}
|
|
1539
1543
|
};
|
|
@@ -1588,6 +1592,10 @@ class Video extends Component {
|
|
|
1588
1592
|
});
|
|
1589
1593
|
}
|
|
1590
1594
|
if(sid == document.getElementById('publish_video1').name) {
|
|
1595
|
+
this.setState({
|
|
1596
|
+
|
|
1597
|
+
loading: false,
|
|
1598
|
+
});
|
|
1591
1599
|
this.enterRoom()
|
|
1592
1600
|
this.timer = setInterval(
|
|
1593
1601
|
() => {
|
|
@@ -2838,6 +2846,9 @@ class Video extends Component {
|
|
|
2838
2846
|
console.log('投屏')
|
|
2839
2847
|
if (this.isFileSuccuse()) {
|
|
2840
2848
|
const publish_config = {};
|
|
2849
|
+
if(streamShare) {
|
|
2850
|
+
streamShare.getTracks().forEach(track => track.stop());
|
|
2851
|
+
}
|
|
2841
2852
|
if (this.state.isSharedScreen) {
|
|
2842
2853
|
// if (this.state.isWhiteboard) {
|
|
2843
2854
|
// publish_config.publish_device = 4
|
|
@@ -3273,7 +3284,6 @@ class Video extends Component {
|
|
|
3273
3284
|
)
|
|
3274
3285
|
}
|
|
3275
3286
|
switchExternalAge = ()=>{
|
|
3276
|
-
const that = this
|
|
3277
3287
|
if(this.state.isSharedScreen) {
|
|
3278
3288
|
this.state.isSharedScreen = false
|
|
3279
3289
|
this.setState({
|
|
@@ -3286,23 +3296,29 @@ class Video extends Component {
|
|
|
3286
3296
|
}
|
|
3287
3297
|
}
|
|
3288
3298
|
|
|
3299
|
+
this.navigatorClick()
|
|
3300
|
+
|
|
3301
|
+
}
|
|
3302
|
+
navigatorClick=()=>{
|
|
3303
|
+
const that = this
|
|
3289
3304
|
const publish_config = {};
|
|
3290
|
-
const width = this.state.whiteboardWidth;
|
|
3291
|
-
const height = this.state.whiteboardHeight;
|
|
3292
3305
|
const canvas = document.createElement('canvas');
|
|
3293
3306
|
const videoMedia = document.getElementById('manedvideo');
|
|
3294
3307
|
const cobj = canvas.getContext('2d'); // 获取绘图环境
|
|
3295
|
-
const
|
|
3296
|
-
const
|
|
3308
|
+
const left = document.getElementById("whiteboardDIV").getBoundingClientRect().left;
|
|
3309
|
+
const top = document.getElementById("whiteboardDIV").getBoundingClientRect().top
|
|
3310
|
+
const right = document.getElementById("whiteboardDIV").getBoundingClientRect().right
|
|
3311
|
+
const width = left > 21 ? right : right + left
|
|
3312
|
+
const height = document.getElementById("whiteboardDIV").getBoundingClientRect().height
|
|
3297
3313
|
canvas.width = width;
|
|
3298
3314
|
canvas.height = height;
|
|
3299
3315
|
videoMedia.addEventListener('play', (event) =>{
|
|
3300
3316
|
var $this = this; //cache
|
|
3301
|
-
console.log('
|
|
3317
|
+
console.log('addEventListener',!$this.paused,!$this.ended)
|
|
3302
3318
|
loop()
|
|
3303
3319
|
function loop() {
|
|
3304
3320
|
if (!$this.paused && !$this.ended) {
|
|
3305
|
-
cobj.drawImage(videoMedia,
|
|
3321
|
+
cobj.drawImage(videoMedia, 0, top, width, height, 0, 0,width, height);
|
|
3306
3322
|
setTimeout(loop, 1000 / 10); // drawing at 30fps
|
|
3307
3323
|
}
|
|
3308
3324
|
}
|
|
@@ -3331,13 +3347,19 @@ class Video extends Component {
|
|
|
3331
3347
|
}
|
|
3332
3348
|
}, 0);
|
|
3333
3349
|
navigator.mediaDevices.getDisplayMedia({
|
|
3334
|
-
video: true
|
|
3350
|
+
video: true,
|
|
3351
|
+
preferCurrentTab:true,
|
|
3335
3352
|
})
|
|
3336
3353
|
.then((stream) => {
|
|
3337
3354
|
videoMedia.srcObject = stream;
|
|
3355
|
+
stream.getVideoTracks()[0].applyConstraints({
|
|
3356
|
+
width: document.body.offsetWidth,
|
|
3357
|
+
height: document.body.offsetHeight
|
|
3358
|
+
})
|
|
3359
|
+
streamShare = stream
|
|
3338
3360
|
stream.getVideoTracks()[0].onended = async ()=>{
|
|
3339
3361
|
//单击停止共享按钮后,触发这个事件
|
|
3340
|
-
if(document.getElementById('video20').name
|
|
3362
|
+
if(document.getElementById('video20').name&&!this.state.isSharedScreen) {
|
|
3341
3363
|
that.test_controller.UnPublish(document.getElementById('video20').name)
|
|
3342
3364
|
}
|
|
3343
3365
|
}
|
|
@@ -3346,9 +3368,8 @@ class Video extends Component {
|
|
|
3346
3368
|
});
|
|
3347
3369
|
}
|
|
3348
3370
|
switchExternal = () => {
|
|
3349
|
-
|
|
3371
|
+
|
|
3350
3372
|
if (!this.state.isWhiteboard) {
|
|
3351
|
-
const publish_config = {};
|
|
3352
3373
|
this.setState({
|
|
3353
3374
|
isWhiteboard: true
|
|
3354
3375
|
})
|
|
@@ -3367,83 +3388,7 @@ class Video extends Component {
|
|
|
3367
3388
|
document.exitPictureInPicture()
|
|
3368
3389
|
}
|
|
3369
3390
|
}
|
|
3370
|
-
|
|
3371
|
-
const height = this.state.whiteboardHeight;
|
|
3372
|
-
const canvas = document.createElement('canvas');
|
|
3373
|
-
const videoMedia = document.getElementById('manedvideo');
|
|
3374
|
-
const cobj = canvas.getContext('2d'); // 获取绘图环境
|
|
3375
|
-
const w = document.getElementById("whiteboardDIV").getBoundingClientRect().left;
|
|
3376
|
-
const h = document.getElementById("whiteboardDIV").getBoundingClientRect().top
|
|
3377
|
-
canvas.width = width;
|
|
3378
|
-
canvas.height = height;
|
|
3379
|
-
videoMedia.addEventListener('play', (event) =>{
|
|
3380
|
-
var $this = this; //cache
|
|
3381
|
-
console.log('333111',!$this.paused,!$this.ended)
|
|
3382
|
-
loop()
|
|
3383
|
-
function loop() {
|
|
3384
|
-
if (!$this.paused && !$this.ended) {
|
|
3385
|
-
cobj.drawImage(videoMedia, w, h, width, height, 0, 0,width, height,);
|
|
3386
|
-
setTimeout(loop, 1000 / 10); // drawing at 30fps
|
|
3387
|
-
}
|
|
3388
|
-
}
|
|
3389
|
-
|
|
3390
|
-
if (document.getElementById('video20').name) {
|
|
3391
|
-
// 代表已经有了进行切流
|
|
3392
|
-
publish_config.publish_device = 5
|
|
3393
|
-
publish_config.media_type = 1
|
|
3394
|
-
publish_config.degradationType=2
|
|
3395
|
-
publish_config.sid = document.getElementById('video20').name
|
|
3396
|
-
publish_config.stream = canvas.captureStream(10)
|
|
3397
|
-
publish_config.video_profile_type = 9
|
|
3398
|
-
this.test_controller.ChangeMediaStream(publish_config);
|
|
3399
|
-
} else {
|
|
3400
|
-
|
|
3401
|
-
publish_config.media_type = 1
|
|
3402
|
-
publish_config.publish_device = 5
|
|
3403
|
-
publish_config.need_volume_analyser = true
|
|
3404
|
-
publish_config.video_profile_type = 9
|
|
3405
|
-
publish_config.degradationType=2
|
|
3406
|
-
publish_config.stream = canvas.captureStream(10)
|
|
3407
|
-
publish_config.publish_video_id = 'video20'
|
|
3408
|
-
publish_config.publish_streamId_id = 'subscribe_streamId10'
|
|
3409
|
-
publish_config.publish_tag = 'projectionWhiteboard'
|
|
3410
|
-
this.test_controller.Publish(publish_config)
|
|
3411
|
-
}
|
|
3412
|
-
}, 0);
|
|
3413
|
-
navigator.mediaDevices.getDisplayMedia({
|
|
3414
|
-
video: true
|
|
3415
|
-
})
|
|
3416
|
-
.then((stream) => {
|
|
3417
|
-
videoMedia.srcObject = stream;
|
|
3418
|
-
stream.getVideoTracks()[0].onended = async ()=>{
|
|
3419
|
-
//单击停止共享按钮后,触发这个事件
|
|
3420
|
-
if(document.getElementById('video20').name&&!this.state.isSharedScreen) {
|
|
3421
|
-
that.test_controller.UnPublish(document.getElementById('video20').name)
|
|
3422
|
-
}
|
|
3423
|
-
}
|
|
3424
|
-
}, error => {
|
|
3425
|
-
console.log("Unable to acquire screen capture", error);
|
|
3426
|
-
});
|
|
3427
|
-
// if (document.getElementById('video20').name) {
|
|
3428
|
-
// // 代表已经有了进行切流
|
|
3429
|
-
// publish_config.publish_device = 4
|
|
3430
|
-
// publish_config.media_type = 1
|
|
3431
|
-
// publish_config.sid = document.getElementById('video20').name
|
|
3432
|
-
// publish_config.part_of_screen_id = 'touBoxItem'
|
|
3433
|
-
// publish_config.video_profile_type = 5
|
|
3434
|
-
// this.test_controller.ChangeMediaStream(publish_config);
|
|
3435
|
-
// } else {
|
|
3436
|
-
|
|
3437
|
-
// publish_config.media_type = 1
|
|
3438
|
-
// publish_config.publish_device = 4
|
|
3439
|
-
// publish_config.need_volume_analyser = true
|
|
3440
|
-
// publish_config.video_profile_type = 5
|
|
3441
|
-
// publish_config.part_of_screen_id = 'touBoxItem';
|
|
3442
|
-
// publish_config.publish_video_id = 'video20'
|
|
3443
|
-
// publish_config.publish_streamId_id = 'subscribe_streamId10'
|
|
3444
|
-
// publish_config.publish_tag = 'projectionWhiteboard'
|
|
3445
|
-
// this.test_controller.Publish(publish_config)
|
|
3446
|
-
// }
|
|
3391
|
+
this.navigatorClick()
|
|
3447
3392
|
} else {
|
|
3448
3393
|
this.messageClick('当前已经切换RM白板','success')
|
|
3449
3394
|
|
|
@@ -3506,8 +3451,8 @@ class Video extends Component {
|
|
|
3506
3451
|
var box=document.getElementById("whiteboardDIV");
|
|
3507
3452
|
if(box){ //此处在加一层判断,更加严密,如果box存在的情况下获取
|
|
3508
3453
|
this.state.whiteboardWidth = box.offsetWidth,
|
|
3509
|
-
this.state.whiteboardHeight = box.offsetHeight,
|
|
3510
|
-
console.log('whiteboardDIV', this.state.whiteboardHeight,this.state.whiteboardWidth)
|
|
3454
|
+
this.state.whiteboardHeight = box.offsetHeight * 0.92,
|
|
3455
|
+
console.log('whiteboardDIV', this.state.whiteboardHeight,box.clientHeight,this.state.whiteboardWidth)
|
|
3511
3456
|
}
|
|
3512
3457
|
}
|
|
3513
3458
|
render() {
|
|
@@ -3631,7 +3576,7 @@ class Video extends Component {
|
|
|
3631
3576
|
<div className="projection" style={{background: this.state.tabTitles.length > 0 ? '#f0f0f0' : '#ffffff'}}>
|
|
3632
3577
|
{tabTitleList}
|
|
3633
3578
|
{/* <img style={sectionStyle} src={require("../../assets/img/placeholder_bg.png").default} alt="" /> */}
|
|
3634
|
-
<div id="whiteboardDIV" style={{height:
|
|
3579
|
+
<div id="whiteboardDIV" style={{height: 'calc(100% - 33px)'}}>
|
|
3635
3580
|
|
|
3636
3581
|
<div className="videoDiv" style={{ display: (this.state.isSelect == 'RMScreen') ? '' : 'none', }}>
|
|
3637
3582
|
<div className="videoDiv">
|
|
@@ -4183,7 +4128,7 @@ class Video extends Component {
|
|
|
4183
4128
|
></CanvasDraw>
|
|
4184
4129
|
</div>
|
|
4185
4130
|
</Modal>
|
|
4186
|
-
<Modal title="设置视频设备" closable={false} centered={true} visible={this.state.isModalVisibleInspection} footer={[
|
|
4131
|
+
<Modal title="设置视频设备" width={650} closable={false} centered={true} visible={this.state.isModalVisibleInspection} footer={[
|
|
4187
4132
|
<div key='inspection'>
|
|
4188
4133
|
<Button className="modelButtonCancel" onClick={this.handleCancelInspection}>取消</Button>
|
|
4189
4134
|
<Button className="modelButtonOk" type="primary" danger onClick={this.handleOkInspection}>确定</Button>
|
|
@@ -4198,7 +4143,7 @@ class Video extends Component {
|
|
|
4198
4143
|
this.state.speakerList.length > 0 &&
|
|
4199
4144
|
<span>
|
|
4200
4145
|
<div>扬声器:
|
|
4201
|
-
<span className='speakerTitle'
|
|
4146
|
+
<span className='speakerTitle'>(此为默认选项。若需切换,请在平板电脑右下角任务栏中的Speaker设置中调整)</span>
|
|
4202
4147
|
</div>
|
|
4203
4148
|
{speaker}
|
|
4204
4149
|
</span>
|