react_hsbc_teller 0.0.1
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/.babelrc +4 -0
- package/README.en.md +36 -0
- package/README.md +57 -0
- package/config/webpack.config.js +114 -0
- package/config/webpack.dev.js +108 -0
- package/config/webpack.prod.js +113 -0
- package/package.json +94 -0
- package/packages/api/api.js +135 -0
- package/packages/api/server.js +48 -0
- package/packages/assets/img/Face_recognition.png +0 -0
- package/packages/assets/img/Projection_screen.png +0 -0
- package/packages/assets/img/huazhonghua.png +0 -0
- package/packages/assets/img/icon_Graffiti.png +0 -0
- package/packages/assets/img/icon_Mute.png +0 -0
- package/packages/assets/img/icon_MuteOne.png +0 -0
- package/packages/assets/img/icon_camera.png +0 -0
- package/packages/assets/img/icon_cameraOne.png +0 -0
- package/packages/assets/img/icon_copy.png +0 -0
- package/packages/assets/img/icon_invitation.png +0 -0
- package/packages/assets/img/icon_ocr.png +0 -0
- package/packages/assets/img/icon_suspend.png +0 -0
- package/packages/assets/img/sign_out.png +0 -0
- package/packages/assets/img/yingpin.png +0 -0
- package/packages/assets/img/zanTing.png +0 -0
- package/packages/assets/pdf/1.png +0 -0
- package/packages/assets/pdf/2.png +0 -0
- package/packages/assets/pdf/3.png +0 -0
- package/packages/assets/pdf/4.png +0 -0
- package/packages/assets/pdf/5.png +0 -0
- package/packages/assets/pdf/6.png +0 -0
- package/packages/common/JKL.js +61 -0
- package/packages/common/XML.js +271 -0
- package/packages/common/websocket.js +246 -0
- package/packages/demo/demo.js +27 -0
- package/packages/demo/index.js +3 -0
- package/packages/envconfig/envconfig.js +13 -0
- package/packages/index.js +2 -0
- package/packages/pages/foot/foot.jsx +101 -0
- package/packages/pages/foot/foot.less +49 -0
- package/packages/pages/header/header.jsx +25 -0
- package/packages/pages/header/header.less +52 -0
- package/packages/pages/pdf/pdf.jsx +72 -0
- package/packages/pages/pdf/pdf.less +18 -0
- package/packages/pages/video/video.jsx +1317 -0
- package/packages/pages/video/video.less +97 -0
- package/packages/style/index.less +1 -0
- package/packages/style/reset.less +345 -0
- package/packages/utils/asyncComponent.jsx +27 -0
- package/packages/utils/cell.js +64 -0
- package/packages/utils/mixin.js +27 -0
- package/packages/utils/setRem.js +11 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +40 -0
- package/public/snowman.svg +1 -0
- package/script.js +0 -0
- package/src/index.js +10 -0
- package/src/index.less +1 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,1317 @@
|
|
|
1
|
+
/* eslint-disable no-undef */
|
|
2
|
+
/* eslint-disable no-unused-vars */
|
|
3
|
+
/* eslint-disable eqeqeq */
|
|
4
|
+
import React, { Component, useState } from 'react';
|
|
5
|
+
import API from '../../api/api';
|
|
6
|
+
import initWebSocket from '../../common/websocket';
|
|
7
|
+
import './video.less'
|
|
8
|
+
import Header from '../header/header.jsx'
|
|
9
|
+
import Foot from '../foot/foot.jsx'
|
|
10
|
+
import voiceImgOpen from '../../assets/img/icon_Mute.png'
|
|
11
|
+
import voiceImgCloe from '../../assets/img/icon_MuteOne.png'
|
|
12
|
+
import cameraImgOpen from '../../assets/img/icon_camera.png'
|
|
13
|
+
import cameraImgCloe from '../../assets/img/icon_cameraOne.png'
|
|
14
|
+
import {callNimIM} from '../../utils/cell.js'
|
|
15
|
+
import Modal from "antd/lib/modal";
|
|
16
|
+
import 'antd/lib/modal/style'
|
|
17
|
+
import message from "antd/lib/message";
|
|
18
|
+
import 'antd/lib/message/style'
|
|
19
|
+
import Pdf from '../pdf/pdf'
|
|
20
|
+
|
|
21
|
+
class Video extends Component {
|
|
22
|
+
state = {
|
|
23
|
+
isTranscribing: false,
|
|
24
|
+
transcribingData: '',
|
|
25
|
+
isPDF: true,
|
|
26
|
+
roomCustomerList: [],
|
|
27
|
+
facialImg: '',
|
|
28
|
+
isModalVisibleFacial: false,
|
|
29
|
+
isModalVisibleEnd: false,
|
|
30
|
+
isModalVisible: false,
|
|
31
|
+
screenName: '投屏',
|
|
32
|
+
suspendName: '暂停',
|
|
33
|
+
cameraImg: cameraImgOpen,
|
|
34
|
+
voiceStatue: false,
|
|
35
|
+
voiceImg: voiceImgOpen,
|
|
36
|
+
isBigVideo: 'video2',
|
|
37
|
+
isCustomer: true,
|
|
38
|
+
publishDevic: 1,
|
|
39
|
+
isSharedScreen: false,
|
|
40
|
+
isSuspend: false,
|
|
41
|
+
audioed: false,
|
|
42
|
+
customAudioed: false,
|
|
43
|
+
recordId: '', // 录制id
|
|
44
|
+
contentDress: '', // 地理位置
|
|
45
|
+
callbackUrl: 'http://47.102.126.132:8720/hsbc/callback',// 回调地址外部
|
|
46
|
+
businessNumber: '', // 外部传入的流水号
|
|
47
|
+
workSpaceId: '',
|
|
48
|
+
tellerId: 'ts001',
|
|
49
|
+
bizName: '',
|
|
50
|
+
appId: '',
|
|
51
|
+
room_server_url: 'wss://cn-hangzhou-mrtc.cloud.alipay.com/ws',
|
|
52
|
+
// room_server_url: 'wss://mrtc.mpaas.cn-hangzhou.aliyuncs.com/ws',
|
|
53
|
+
channelId: '',
|
|
54
|
+
rtoken: '',
|
|
55
|
+
sessionId: '',
|
|
56
|
+
imRoomId: '',
|
|
57
|
+
html_string: '<span style="color:red">123456</span>',
|
|
58
|
+
};
|
|
59
|
+
// eslint-disable-next-line no-undef
|
|
60
|
+
test_controller = new McuController();
|
|
61
|
+
/**
|
|
62
|
+
* 创建房间成功后回调后台
|
|
63
|
+
* @param {JSON} data 数据类型
|
|
64
|
+
*/
|
|
65
|
+
createRoom = async data => {
|
|
66
|
+
console.log(data);
|
|
67
|
+
try {
|
|
68
|
+
let result = await API.createRoom({
|
|
69
|
+
tellerAccount: this.state.tellerId,
|
|
70
|
+
businessNumber: this.state.businessNumber,
|
|
71
|
+
callbackUrl: this.state.callbackUrl,
|
|
72
|
+
roomId: this.state.channelId,
|
|
73
|
+
mtoken: this.state.rtoken
|
|
74
|
+
});
|
|
75
|
+
console.log(result);
|
|
76
|
+
this.setState({
|
|
77
|
+
imRoomId: result.imRoomId
|
|
78
|
+
});
|
|
79
|
+
this.setState({
|
|
80
|
+
sessionId: result.sessionId
|
|
81
|
+
});
|
|
82
|
+
// eslint-disable-next-line no-undef
|
|
83
|
+
joinRoom((this.state.tellerId + '@' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname), this.state.imRoomId)
|
|
84
|
+
} catch (err) {
|
|
85
|
+
console.error(err);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* 初始化获取数据
|
|
90
|
+
* @param {JSON} data 数据类型
|
|
91
|
+
*/
|
|
92
|
+
mpaasSig = async data => {
|
|
93
|
+
console.log(data);
|
|
94
|
+
try {
|
|
95
|
+
let result = await API.mpaasSig({account: data.account, type: data.type});
|
|
96
|
+
console.log(result);
|
|
97
|
+
window.sessionStorage.setItem('alimpassSig', result.mpsSig);
|
|
98
|
+
this.setState({
|
|
99
|
+
workSpaceId: result.workSpaceId
|
|
100
|
+
});
|
|
101
|
+
this.setState({
|
|
102
|
+
appId: result.appId
|
|
103
|
+
});
|
|
104
|
+
this.setState({
|
|
105
|
+
bizName: result.bizName
|
|
106
|
+
});
|
|
107
|
+
this.setState({
|
|
108
|
+
bizName: result.bizName
|
|
109
|
+
});
|
|
110
|
+
window.sessionStorage.setItem('sigData', JSON.stringify(result));
|
|
111
|
+
if (data.sigType == 1) {
|
|
112
|
+
this.handleEdit()
|
|
113
|
+
}
|
|
114
|
+
} catch (err) {
|
|
115
|
+
console.error(err);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
handleEdit = () => {
|
|
119
|
+
console.log(JSON.parse(window.sessionStorage.getItem('sigData')));
|
|
120
|
+
// eslint-disable-next-line no-undef
|
|
121
|
+
initWebSocket('wss://' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname + ':' + JSON.parse(window.sessionStorage.getItem('sigData')).webPort + '/ws/');
|
|
122
|
+
const config_param = {};
|
|
123
|
+
config_param.workspaceId = this.state.workSpaceId;
|
|
124
|
+
config_param.uid = this.state.tellerId;
|
|
125
|
+
config_param.biz_name = this.state.bizName; // 'demo'
|
|
126
|
+
config_param.appId = this.state.appId;
|
|
127
|
+
|
|
128
|
+
config_param.room_server_url = this.state.room_server_url;
|
|
129
|
+
// 允许最大断网时间 (超过未重连, 直接关闭)
|
|
130
|
+
config_param.network_check_timeout = 10000;
|
|
131
|
+
this.test_controller.Connect(config_param)
|
|
132
|
+
};
|
|
133
|
+
// 初始化视频
|
|
134
|
+
ConnectMRTC = () => {
|
|
135
|
+
const config_param = {};
|
|
136
|
+
config_param.auto_publish_subscribe = 3;
|
|
137
|
+
config_param.media_type = 1;
|
|
138
|
+
config_param.publish_device = 1;
|
|
139
|
+
config_param.video_profile_type = '5';
|
|
140
|
+
config_param.need_volume_analyser = true;
|
|
141
|
+
// config_param.audioSource = that.microphone[0].actionid
|
|
142
|
+
// config_param.videoSource = that.checkOne[0]
|
|
143
|
+
// config_param.transport_ = 'relay'
|
|
144
|
+
config_param.initPublish = [
|
|
145
|
+
{
|
|
146
|
+
publish_video_id: 'publish_video1',
|
|
147
|
+
publish_streamId_id: 'publish_streamId1',
|
|
148
|
+
publish_tag: 'tag1'
|
|
149
|
+
}
|
|
150
|
+
];
|
|
151
|
+
const recordParam = {};
|
|
152
|
+
recordParam.width = 640;
|
|
153
|
+
recordParam.height = 360;
|
|
154
|
+
recordParam.channels = 1;
|
|
155
|
+
recordParam.splitType = 0;
|
|
156
|
+
recordParam.startTimeout = 5;
|
|
157
|
+
recordParam.recordTotalStream = 0;
|
|
158
|
+
recordParam.endType = 1;
|
|
159
|
+
config_param.recordParam = recordParam;
|
|
160
|
+
config_param.initSubscribe = config_param.initSubscribe = [
|
|
161
|
+
{
|
|
162
|
+
subscribe_video_id: 'video1',
|
|
163
|
+
subscribe_audio_id: 'audio1',
|
|
164
|
+
subscribe_streamId_id: 'subscribe_streamId1',
|
|
165
|
+
feedId_id: 'feedId1'
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
subscribe_video_id: 'video2',
|
|
169
|
+
subscribe_audio_id: 'audio2',
|
|
170
|
+
subscribe_streamId_id: 'subscribe_streamId2',
|
|
171
|
+
feedId_id: 'feedId2'
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
subscribe_video_id: 'video3',
|
|
175
|
+
subscribe_audio_id: 'audio3',
|
|
176
|
+
subscribe_streamId_id: 'subscribe_streamId3',
|
|
177
|
+
feedId_id: 'feedId3'
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
subscribe_video_id: 'video4',
|
|
181
|
+
subscribe_audio_id: 'audio4',
|
|
182
|
+
subscribe_streamId_id: 'subscribe_streamId4',
|
|
183
|
+
feedId_id: 'feedId4'
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
subscribe_video_id: 'video5',
|
|
187
|
+
subscribe_audio_id: 'audio5',
|
|
188
|
+
subscribe_streamId_id: 'subscribe_streamId5',
|
|
189
|
+
feedId_id: 'feedId5'
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
subscribe_video_id: 'video6',
|
|
193
|
+
subscribe_audio_id: 'audio6',
|
|
194
|
+
subscribe_streamId_id: 'subscribe_streamId6',
|
|
195
|
+
feedId_id: 'feedId6'
|
|
196
|
+
}
|
|
197
|
+
];
|
|
198
|
+
this.test_controller.InitRoomConfig(config_param)
|
|
199
|
+
};
|
|
200
|
+
// 开启录制
|
|
201
|
+
enableServerRecording = () => {
|
|
202
|
+
const filePath = 'recordId_' + new Date().valueOf();
|
|
203
|
+
const recordParam = {};
|
|
204
|
+
recordParam.width = 640;
|
|
205
|
+
recordParam.height = 480;
|
|
206
|
+
recordParam.recordTotalStream = 0;
|
|
207
|
+
recordParam.startTimeout = 10;
|
|
208
|
+
recordParam.splitType = 0;
|
|
209
|
+
recordParam.endType = 1;
|
|
210
|
+
recordParam.overlaps = [
|
|
211
|
+
{
|
|
212
|
+
tag: '', // 流 tag,如果不设置或为空,则为全局⽔印
|
|
213
|
+
type: 1, // 1 为时间戳⽔印;2 为⽂字⽔印;3 为图⽚⽔印
|
|
214
|
+
id: 1, // ⽔印 ID
|
|
215
|
+
enable: true,
|
|
216
|
+
xPosition: 10, // x 轴位置
|
|
217
|
+
yPosition: 10, // y 轴位置
|
|
218
|
+
text: '', // ⽔印⽂字
|
|
219
|
+
fontSize: 16, // 字体⼤⼩
|
|
220
|
+
url: '' // ⽔印图⽚ HTTP 地址
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
tag: '', // 流 tag,如果不设置或为空,则为全局⽔印
|
|
224
|
+
type: 2, // 1 为时间戳⽔印;2 为⽂字⽔印;3 为图⽚⽔印
|
|
225
|
+
id: 2, // ⽔印 ID
|
|
226
|
+
enable: true,
|
|
227
|
+
xPosition: 10, // x 轴位置
|
|
228
|
+
yPosition: 50, // y 轴位置
|
|
229
|
+
text: this.state.contentDress, // ⽔印⽂字
|
|
230
|
+
fontSize: 16, // 字体⼤⼩
|
|
231
|
+
url: '' // ⽔印图⽚ HTTP 地址
|
|
232
|
+
}
|
|
233
|
+
];
|
|
234
|
+
console.log('recordParam', recordParam);
|
|
235
|
+
this.test_controller.StartRemoteRecord(filePath, recordParam, '')
|
|
236
|
+
|
|
237
|
+
};
|
|
238
|
+
// 结束会话
|
|
239
|
+
endSession = value => {
|
|
240
|
+
if (value == 'customerHangUp') {
|
|
241
|
+
this.endSessionValue()
|
|
242
|
+
} else {
|
|
243
|
+
// 退出房间
|
|
244
|
+
this.setState({
|
|
245
|
+
isModalVisibleEnd: true
|
|
246
|
+
})
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
contrastFaceVerify = async data => {
|
|
250
|
+
console.log(data);
|
|
251
|
+
try {
|
|
252
|
+
let result = await API.contrastFaceVerify({
|
|
253
|
+
sessionId: this.state.sessionId,
|
|
254
|
+
imagePath: data
|
|
255
|
+
});
|
|
256
|
+
console.log(result);
|
|
257
|
+
if (result.code == 200) {
|
|
258
|
+
message.success('人脸识别成功');
|
|
259
|
+
this.setState({
|
|
260
|
+
isModalVisibleFacial: false
|
|
261
|
+
})
|
|
262
|
+
} else {
|
|
263
|
+
message.success('人脸识别失败')
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
} catch (err) {
|
|
268
|
+
console.error(err);
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
uploadImg = async data => {
|
|
272
|
+
console.log(data);
|
|
273
|
+
try {
|
|
274
|
+
let result = await API.uploadImg(data);
|
|
275
|
+
console.log(result);
|
|
276
|
+
this.contrastFaceVerify(result.data)
|
|
277
|
+
} catch (err) {
|
|
278
|
+
console.error(err);
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
dataURLtoFile = (dataURI, type) => {
|
|
282
|
+
const binary = atob(dataURI.split(',')[1]);
|
|
283
|
+
const array = [];
|
|
284
|
+
for (let i = 0; i < binary.length; i++) {
|
|
285
|
+
array.push(binary.charCodeAt(i))
|
|
286
|
+
}
|
|
287
|
+
return new Blob([new Uint8Array(array)], {type: type})
|
|
288
|
+
};
|
|
289
|
+
// 人脸识别
|
|
290
|
+
facialRecognition = () => {
|
|
291
|
+
const sid = document.getElementById('publish_video1').name;
|
|
292
|
+
this.setState({
|
|
293
|
+
facialImg: this.test_controller.TakePicture(0, undefined, undefined, sid, 'png')
|
|
294
|
+
})
|
|
295
|
+
};
|
|
296
|
+
endSessionValue = () => {
|
|
297
|
+
this.test_controller.LeaveRoom()
|
|
298
|
+
};
|
|
299
|
+
// 放大对应的视频
|
|
300
|
+
enlargeClick = (val) => {
|
|
301
|
+
if (val == 'isLangVideo1') {
|
|
302
|
+
if (document.getElementById('video1').name) {
|
|
303
|
+
this.setState({isBigVideo: 'video1'})
|
|
304
|
+
}
|
|
305
|
+
} else if (val == 'isLangPublishVideo1') {
|
|
306
|
+
if (document.getElementById('publish_video1').name) {
|
|
307
|
+
this.setState({isBigVideo: 'publish_video1'})
|
|
308
|
+
}
|
|
309
|
+
} else if (val == 'isLangVideo2') {
|
|
310
|
+
if (document.getElementById('video2').name) {
|
|
311
|
+
this.setState({isBigVideo: 'video2'})
|
|
312
|
+
}
|
|
313
|
+
} else if (val == 'isLangVideo3') {
|
|
314
|
+
if (document.getElementById('video3').name) {
|
|
315
|
+
this.setState({isBigVideo: 'video3'})
|
|
316
|
+
}
|
|
317
|
+
} else if (val == 'isLangVideo4') {
|
|
318
|
+
if (document.getElementById('video4').name) {
|
|
319
|
+
this.setState({isBigVideo: 'video4'})
|
|
320
|
+
}
|
|
321
|
+
} else if (val == 'isLangVideo5') {
|
|
322
|
+
if (document.getElementById('video5').name) {
|
|
323
|
+
this.setState({isBigVideo: 'video5'})
|
|
324
|
+
}
|
|
325
|
+
} else if (val == 'isLangVideo6') {
|
|
326
|
+
if (document.getElementById('video6').name) {
|
|
327
|
+
this.setState({isBigVideo: 'video6'})
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
// 画中画
|
|
332
|
+
pictureInPicture = () => {
|
|
333
|
+
const publish_config = {};
|
|
334
|
+
publish_config.media_type = 1;
|
|
335
|
+
publish_config.publish_device = 4;
|
|
336
|
+
publish_config.need_volume_analyser = false;
|
|
337
|
+
publish_config.video_profile_type = 3;
|
|
338
|
+
publish_config.part_of_screen_id = 'touBoxItem';
|
|
339
|
+
publish_config.publish_video_id = 'video3';
|
|
340
|
+
publish_config.publish_streamId_id = 'subscribe_streamId3';
|
|
341
|
+
// publish_config.publish_tag = 'sharedScreen'
|
|
342
|
+
this.test_controller.Publish(publish_config);
|
|
343
|
+
callNimIM('sendCustomCmdMsg', {
|
|
344
|
+
customId: this.state.imRoomId,
|
|
345
|
+
content: JSON.stringify({
|
|
346
|
+
'typeId': 2030,
|
|
347
|
+
'sessionId': this.state.sessionId,
|
|
348
|
+
'sharedScreen': 1,
|
|
349
|
+
'tellerId': this.state.tellerId
|
|
350
|
+
})
|
|
351
|
+
});
|
|
352
|
+
if (this.isFileSuccuse()) {
|
|
353
|
+
const width = 640;
|
|
354
|
+
const height = 480;
|
|
355
|
+
const canvas = document.createElement('canvas');
|
|
356
|
+
const cobj = canvas.getContext('2d'); // 获取绘图环境
|
|
357
|
+
canvas.width = width;
|
|
358
|
+
canvas.height = height;
|
|
359
|
+
let interval = setInterval(() => {
|
|
360
|
+
cobj.clearRect(0, 0, width, height);
|
|
361
|
+
let videoId = 'publish_video1';
|
|
362
|
+
let videoDiv = document.getElementById(videoId);
|
|
363
|
+
let videoWidth = videoDiv.videoWidth;
|
|
364
|
+
let videoHeight = videoDiv.videoHeight;
|
|
365
|
+
let newVideoWidth = 320;
|
|
366
|
+
let newVideoHeight = 480;
|
|
367
|
+
if (videoHeight * 320 / videoWidth > 480) {
|
|
368
|
+
newVideoWidth = videoWidth * 480 / videoHeight;
|
|
369
|
+
} else {
|
|
370
|
+
newVideoHeight = videoHeight * 320 / videoWidth;
|
|
371
|
+
}
|
|
372
|
+
cobj.drawImage(videoDiv, 0, 480 - newVideoHeight, newVideoWidth, newVideoHeight);
|
|
373
|
+
|
|
374
|
+
let subscribeVideo = 'video1';
|
|
375
|
+
let subscribeVideoDiv = document.getElementById(subscribeVideo);
|
|
376
|
+
let subscribeVideoDivWidth = subscribeVideoDiv.videoWidth;
|
|
377
|
+
let subscribeVideoDivHeight = subscribeVideoDiv.videoHeight;
|
|
378
|
+
let newVideoWidth1 = 320;
|
|
379
|
+
let newVideoHeight1 = 480;
|
|
380
|
+
if (subscribeVideoDivHeight * 320 / subscribeVideoDivWidth > 480) {
|
|
381
|
+
newVideoWidth1 = subscribeVideoDivWidth * 480 / subscribeVideoDivHeight;
|
|
382
|
+
} else {
|
|
383
|
+
newVideoHeight1 = subscribeVideoDivHeight * 320 / subscribeVideoDivWidth;
|
|
384
|
+
}
|
|
385
|
+
cobj.drawImage(subscribeVideoDiv, 320, 480 - newVideoHeight1, newVideoWidth1, 80);
|
|
386
|
+
|
|
387
|
+
}, 100);
|
|
388
|
+
const captureStream = canvas.captureStream();
|
|
389
|
+
const mix_stream = new MediaStream(captureStream);
|
|
390
|
+
let video = document.getElementById('mixedvideo');
|
|
391
|
+
video.srcObject = mix_stream;
|
|
392
|
+
video.onloadedmetadata = () => {
|
|
393
|
+
video.requestPictureInPicture();
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
video.addEventListener('enterpictureinpicture', (event) => {
|
|
397
|
+
//可获取画中画窗口的一些数据,如宽高等
|
|
398
|
+
video.style.display = 'block';
|
|
399
|
+
video.play();
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
video.addEventListener('leavepictureinpicture', (event) => {
|
|
403
|
+
video.srcObject = null;
|
|
404
|
+
video.style.display = "none";
|
|
405
|
+
clearInterval(interval);
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
componentWillMount() {
|
|
411
|
+
|
|
412
|
+
window.IMEvt = msg => {
|
|
413
|
+
console.log(JSON.parse(msg));
|
|
414
|
+
const Mival = JSON.parse(msg);
|
|
415
|
+
if (Mival.typeId == 1210) {
|
|
416
|
+
// 进行初始化操作
|
|
417
|
+
if (Mival.sessionId == this.state.sessionId) {
|
|
418
|
+
if (Mival.type == 1) {
|
|
419
|
+
// 开启录制
|
|
420
|
+
this.enableServerRecording()
|
|
421
|
+
} else if (Mival.type == 2) {
|
|
422
|
+
// 关闭录制
|
|
423
|
+
this.test_controller.StopRemoteRecord(this.state.recordId)
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
} else if (Mival.typeId == 1010) {
|
|
427
|
+
if (Mival.sessionId == this.state.sessionId) {
|
|
428
|
+
this.endSession('customerHangUp')
|
|
429
|
+
}
|
|
430
|
+
} else if (Mival.typeId == 1214) {
|
|
431
|
+
console.log(Mival);
|
|
432
|
+
if (Mival.sessionId == this.state.sessionId) {
|
|
433
|
+
this.setState({
|
|
434
|
+
transcribingData: Mival
|
|
435
|
+
});
|
|
436
|
+
this.setState({
|
|
437
|
+
isTranscribing: true
|
|
438
|
+
})
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
let data = {
|
|
445
|
+
account: this.state.tellerId,
|
|
446
|
+
type: '2',
|
|
447
|
+
sigType: 1
|
|
448
|
+
};
|
|
449
|
+
this.mpaasSig(data);
|
|
450
|
+
this.test_controller.GetDevices();
|
|
451
|
+
// 获取设备成功
|
|
452
|
+
this.test_controller.OnGetDevicesSuccess = (devicesInfo) => {
|
|
453
|
+
console.log('devicesInfo' + JSON.stringify(devicesInfo));
|
|
454
|
+
const obj = [];
|
|
455
|
+
const obj1 = [];
|
|
456
|
+
const obj2 = [];
|
|
457
|
+
let num = 0;
|
|
458
|
+
for (let i = 0; i < devicesInfo.length; i++) {
|
|
459
|
+
const b = {};
|
|
460
|
+
if (devicesInfo[i].kind === 'videoinput') {
|
|
461
|
+
console.log('deviceId' + devicesInfo[i].deviceId);
|
|
462
|
+
|
|
463
|
+
b.actionid = devicesInfo[i].deviceId;
|
|
464
|
+
if (
|
|
465
|
+
devicesInfo[i].label === '' ||
|
|
466
|
+
devicesInfo[i].label === undefined ||
|
|
467
|
+
devicesInfo[i].label === null
|
|
468
|
+
) {
|
|
469
|
+
b.actionname = '摄像头' + ++num
|
|
470
|
+
} else {
|
|
471
|
+
b.actionname = devicesInfo[i].label
|
|
472
|
+
}
|
|
473
|
+
obj.push(b)
|
|
474
|
+
} else if (devicesInfo[i].kind === 'audioinput') {
|
|
475
|
+
// 麦克风
|
|
476
|
+
b.actionid = devicesInfo[i].deviceId;
|
|
477
|
+
if (
|
|
478
|
+
devicesInfo[i].label === '' ||
|
|
479
|
+
devicesInfo[i].label === undefined ||
|
|
480
|
+
devicesInfo[i].label === null
|
|
481
|
+
) {
|
|
482
|
+
b.actionname = '麦克风' + ++num
|
|
483
|
+
} else {
|
|
484
|
+
b.actionname = devicesInfo[i].label
|
|
485
|
+
}
|
|
486
|
+
obj1.push(b)
|
|
487
|
+
} else if (devicesInfo[i].kind === 'audiooutput') {
|
|
488
|
+
// 喇叭
|
|
489
|
+
b.actionid = devicesInfo[i].deviceId;
|
|
490
|
+
if (
|
|
491
|
+
devicesInfo[i].label === '' ||
|
|
492
|
+
devicesInfo[i].label === undefined ||
|
|
493
|
+
devicesInfo[i].label === null
|
|
494
|
+
) {
|
|
495
|
+
b.actionname = '喇叭' + ++num
|
|
496
|
+
} else {
|
|
497
|
+
b.actionname = devicesInfo[i].label
|
|
498
|
+
}
|
|
499
|
+
obj2.push(b)
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
console.log(obj, obj1)
|
|
503
|
+
};
|
|
504
|
+
// 获取设备失败
|
|
505
|
+
this.test_controller.OnGetDevicesFailed = (code, msg) => {
|
|
506
|
+
console.log('获取设备失败', code, msg)
|
|
507
|
+
};
|
|
508
|
+
// 建立连接成功
|
|
509
|
+
this.test_controller.OnConnectOK = () => {
|
|
510
|
+
console.log('建立连接成功');
|
|
511
|
+
this.ConnectMRTC()
|
|
512
|
+
};
|
|
513
|
+
this.test_controller.OnConnectFailed = (code, msg) => {
|
|
514
|
+
console.log('建立连接失败', code, msg)
|
|
515
|
+
};
|
|
516
|
+
// 断开连接回调
|
|
517
|
+
this.test_controller.OnConnectClose = (code, msg) => {
|
|
518
|
+
console.log('连接已断开', code, msg)
|
|
519
|
+
};
|
|
520
|
+
// 获取签名
|
|
521
|
+
this.test_controller.OnGetSign = (bizName, subBiz, uid) => {
|
|
522
|
+
console.log(window.sessionStorage.getItem('alimpassSig'));
|
|
523
|
+
return window.sessionStorage.getItem('alimpassSig')
|
|
524
|
+
};
|
|
525
|
+
// 初始化房间失败
|
|
526
|
+
this.test_controller.OnInitRoomConfigFail = (err_code, err_msg) => {
|
|
527
|
+
console.log('初始化房间失败', err_code, err_msg)
|
|
528
|
+
};
|
|
529
|
+
// 初始化成功回调
|
|
530
|
+
this.test_controller.OnInitRoomConfigOK = () => {
|
|
531
|
+
console.log('初始化房间成功');
|
|
532
|
+
// 视频通话的初始化
|
|
533
|
+
this.test_controller.CreateRoom()
|
|
534
|
+
};
|
|
535
|
+
// 创建房间成功
|
|
536
|
+
|
|
537
|
+
this.test_controller.OnCreateRoomSucc = (room_id, rtoken) => {
|
|
538
|
+
console.log('创建房间成功', room_id, rtoken);
|
|
539
|
+
this.setState({channelId: room_id});
|
|
540
|
+
this.setState({rtoken: rtoken});
|
|
541
|
+
this.createRoom()
|
|
542
|
+
};
|
|
543
|
+
// 创建房间失败
|
|
544
|
+
this.test_controller.OnCreateRoomFailed = (err_code, err_msg) => {
|
|
545
|
+
console.log('创建房间失败', err_code, err_msg)
|
|
546
|
+
};
|
|
547
|
+
// 初始化⾳视频成功
|
|
548
|
+
this.test_controller.OnMediaCallSucc = (sid) => {
|
|
549
|
+
console.log('初始化⾳视频成功', sid)
|
|
550
|
+
};
|
|
551
|
+
// 初始化音视频失败
|
|
552
|
+
this.test_controller.OnMediaCallFail = (err_code, err_msg) => {
|
|
553
|
+
console.log('初始化音视频失败', err_code, err_msg)
|
|
554
|
+
};
|
|
555
|
+
// 音视频关闭通知
|
|
556
|
+
this.test_controller.OnMediaClose = (code, sid) => {
|
|
557
|
+
console.log(code, sid)
|
|
558
|
+
};
|
|
559
|
+
// 加入房间成功
|
|
560
|
+
this.test_controller.OnJoinRoomSucc = () => {
|
|
561
|
+
console.log('加入房间成功')
|
|
562
|
+
};
|
|
563
|
+
// 加入房间失败
|
|
564
|
+
this.test_controller.OnJoinRoomFailed = (err_code, err_msg) => {
|
|
565
|
+
console.log('加入房间失败', err_code, err_msg)
|
|
566
|
+
};
|
|
567
|
+
// 发布媒体流成功
|
|
568
|
+
this.test_controller.OnPublishSucc = (sid) => {
|
|
569
|
+
console.log('发布媒体流成功', sid)
|
|
570
|
+
};
|
|
571
|
+
// 发布媒体流失败
|
|
572
|
+
this.test_controller.OnPublishFailed = (sid, err_code, err_msg) => {
|
|
573
|
+
console.log('发布媒体流失败', sid, err_code, err_msg)
|
|
574
|
+
};
|
|
575
|
+
// 订阅媒体流成功
|
|
576
|
+
this.test_controller.OnSubscribeSucc = (feed, sid) => {
|
|
577
|
+
console.log('订阅媒体流成功', feed, sid);
|
|
578
|
+
console.log(document.getElementById("feedId1").innerText)
|
|
579
|
+
};
|
|
580
|
+
// 订阅媒体流失败
|
|
581
|
+
this.test_controller.OnSubscribeFailed = (
|
|
582
|
+
sid,
|
|
583
|
+
err_code,
|
|
584
|
+
err_msg
|
|
585
|
+
) => {
|
|
586
|
+
console.log('订阅媒体流失败', sid, err_code, err_msg)
|
|
587
|
+
};
|
|
588
|
+
// 推送“房间与会者列表”给新加⼊者
|
|
589
|
+
this.test_controller.OnRoomAttendanceList = (participants) => {
|
|
590
|
+
console.log('房间与会者列表', participants)
|
|
591
|
+
};
|
|
592
|
+
// 推送“新加⼊房间者”给与会者
|
|
593
|
+
this.test_controller.OnNewJoinerIn = (participant) => {
|
|
594
|
+
console.log('新加⼊房间者', participant);
|
|
595
|
+
this.setState(
|
|
596
|
+
{
|
|
597
|
+
isCustomer: true
|
|
598
|
+
}
|
|
599
|
+
)
|
|
600
|
+
};
|
|
601
|
+
// 推送“有新发布”给与会者
|
|
602
|
+
this.test_controller.OnNewPublish = (feed) => {
|
|
603
|
+
console.log('有新发布者', feed);
|
|
604
|
+
let array = this.state.roomCustomerList;
|
|
605
|
+
let newArray = [...array];
|
|
606
|
+
newArray.push({
|
|
607
|
+
feedId: feed.feedId,
|
|
608
|
+
uid: feed.uid
|
|
609
|
+
});
|
|
610
|
+
console.log(array, newArray, this.state.roomCustomerList);
|
|
611
|
+
this.setState({
|
|
612
|
+
roomCustomerList: newArray
|
|
613
|
+
})
|
|
614
|
+
};
|
|
615
|
+
// 推送“有新订阅”给与会者
|
|
616
|
+
this.test_controller.OnNewSubscribe = (subscriber, feed) => {
|
|
617
|
+
console.log('有新订阅', subscriber, feed)
|
|
618
|
+
};
|
|
619
|
+
// 取消发布成功
|
|
620
|
+
this.test_controller.OnUnPublishSucc = (sid) => {
|
|
621
|
+
console.log('取消发布成功', sid)
|
|
622
|
+
};
|
|
623
|
+
// 取消订阅媒体流成功
|
|
624
|
+
this.test_controller.OnUnSubscribeSucc = (sid) => {
|
|
625
|
+
console.log('取消订阅媒体流成功', sid)
|
|
626
|
+
};
|
|
627
|
+
// 推送“取消发布”给与会者
|
|
628
|
+
this.test_controller.OnUnPublish = (feed) => {
|
|
629
|
+
console.log('取消发布者', feed)
|
|
630
|
+
};
|
|
631
|
+
// 推送“取消订阅”给与会者 OnUnSubscribe(unsubscriber,feed)
|
|
632
|
+
this.test_controller.OnUnSubscribe = (unsubscriber, feed) => {
|
|
633
|
+
console.log('取消订阅者', unsubscriber, feed)
|
|
634
|
+
};
|
|
635
|
+
// ⾳视频关闭通知
|
|
636
|
+
this.test_controller.OnMediaClose = (code, sid) => {
|
|
637
|
+
console.log('⾳视频关闭通知', code, sid)
|
|
638
|
+
};
|
|
639
|
+
// 退出房间回调
|
|
640
|
+
this.test_controller.OnLeaveRoom = (leaveType) => {
|
|
641
|
+
console.log('退出房间回调', leaveType);
|
|
642
|
+
this.setState({
|
|
643
|
+
isCustomer: false
|
|
644
|
+
});
|
|
645
|
+
this.props.onLeaveRoom()
|
|
646
|
+
};
|
|
647
|
+
// 推送“退出房间者”给与会者
|
|
648
|
+
this.test_controller.OnParticipantLeaveRoom = (
|
|
649
|
+
participant,
|
|
650
|
+
exitType
|
|
651
|
+
) => {
|
|
652
|
+
console.log('退出房间者', participant, exitType)
|
|
653
|
+
};
|
|
654
|
+
// 弱网回调
|
|
655
|
+
this.test_controller.OnNetworkWeak = (bpsSend, bpsRecv, sid) => {
|
|
656
|
+
console.log('弱网回调', bpsSend, bpsRecv, sid)
|
|
657
|
+
};
|
|
658
|
+
// 开始服务端录制成功
|
|
659
|
+
this.test_controller.OnStartRemoteRecordSucc = (record_id) => {
|
|
660
|
+
console.log('开始服务端录制成功', record_id);
|
|
661
|
+
this.setState({
|
|
662
|
+
recordId: record_id
|
|
663
|
+
});
|
|
664
|
+
};
|
|
665
|
+
// 开始服务端录制失败
|
|
666
|
+
this.test_controller.OnStartRemoteRecordFailed = (
|
|
667
|
+
record_id,
|
|
668
|
+
err_code,
|
|
669
|
+
err_msg
|
|
670
|
+
) => {
|
|
671
|
+
console.log('开始服务端录制失败', record_id, err_code, err_msg)
|
|
672
|
+
};
|
|
673
|
+
// 结束服务端录制成功
|
|
674
|
+
this.test_controller.OnStopRemoteRecordSucc = (recordId) => {
|
|
675
|
+
console.log('结束服务端录制成功', recordId);
|
|
676
|
+
this.endSessionValue()
|
|
677
|
+
// 获取服务端录制结果
|
|
678
|
+
};
|
|
679
|
+
// 结束服务端录制失败
|
|
680
|
+
this.test_controller.OnStopRemoteRecordFailed = (
|
|
681
|
+
recordId,
|
|
682
|
+
err_code,
|
|
683
|
+
err_msg
|
|
684
|
+
) => {
|
|
685
|
+
console.log('结束服务端录制失败', recordId, err_code, err_msg)
|
|
686
|
+
};
|
|
687
|
+
// 开启浏览器录制成功
|
|
688
|
+
this.test_controller.OnClientStartRecordSuccess = (
|
|
689
|
+
clientRecordId
|
|
690
|
+
) => {
|
|
691
|
+
console.log('开启浏览器录制成功', clientRecordId)
|
|
692
|
+
};
|
|
693
|
+
// 开启浏览器失败
|
|
694
|
+
this.test_controller.OnClientStartRecordFailed = (
|
|
695
|
+
clientRecordId,
|
|
696
|
+
code,
|
|
697
|
+
msg
|
|
698
|
+
) => {
|
|
699
|
+
console.log('开启浏览器失败', clientRecordId, code, msg)
|
|
700
|
+
};
|
|
701
|
+
// 获取服务端录制结果成功
|
|
702
|
+
this.test_controller.OnRemoteRecordInfoSucc = (recordInfo) => {
|
|
703
|
+
console.log('获取服务端录制结果成功', recordInfo)
|
|
704
|
+
};
|
|
705
|
+
// 获取服务端录制结果失败
|
|
706
|
+
this.test_controller.OnRemoteRecordInfoFailed = (
|
|
707
|
+
record_id,
|
|
708
|
+
err_code,
|
|
709
|
+
err_msg
|
|
710
|
+
) => {
|
|
711
|
+
console.log('获取服务端录制结果失败', record_id, err_code, err_msg)
|
|
712
|
+
};
|
|
713
|
+
// 暂停服务端录制成功
|
|
714
|
+
this.test_controller.OnPauseRemoteRecordSucc = (record_id) => {
|
|
715
|
+
console.log('暂停服务端录制成功', record_id)
|
|
716
|
+
};
|
|
717
|
+
// 暂停服务端录制失败
|
|
718
|
+
this.test_controller.OnPauseRemoteRecordFailed = (
|
|
719
|
+
record_id,
|
|
720
|
+
err_code,
|
|
721
|
+
err_msg
|
|
722
|
+
) => {
|
|
723
|
+
console.log('暂停服务端录制失败', record_id, err_code, err_msg)
|
|
724
|
+
};
|
|
725
|
+
// 恢复服务端录制成功
|
|
726
|
+
this.test_controller.OnResumeRemoteRecordSucc = (record_id) => {
|
|
727
|
+
console.log('恢复服务端录制成功', record_id)
|
|
728
|
+
};
|
|
729
|
+
// 恢复服务端录制失败
|
|
730
|
+
this.test_controller.OnResumeRemoteRecordFailed = (
|
|
731
|
+
record_id,
|
|
732
|
+
err_code,
|
|
733
|
+
err_msg
|
|
734
|
+
) => {
|
|
735
|
+
console.log('恢复服务端录制失败', record_id, err_code, err_msg)
|
|
736
|
+
};
|
|
737
|
+
// 服务端录制结束通知
|
|
738
|
+
this.test_controller.OnRemoteRecordOver = (record_id) => {
|
|
739
|
+
console.log('服务端录制结束通知', record_id)
|
|
740
|
+
};
|
|
741
|
+
// 服务端录制失败通知
|
|
742
|
+
this.test_controller.OnRemoteRecordingFailed = (
|
|
743
|
+
recordId,
|
|
744
|
+
feedId,
|
|
745
|
+
code,
|
|
746
|
+
msg
|
|
747
|
+
) => {
|
|
748
|
+
console.log('服务端录制失败通知', recordId, feedId, code, msg)
|
|
749
|
+
};
|
|
750
|
+
// 停止浏览器录制成功回调
|
|
751
|
+
this.test_controller.OnClientStopRecordSuccess = (
|
|
752
|
+
url,
|
|
753
|
+
blob,
|
|
754
|
+
clientRecordId
|
|
755
|
+
) => {
|
|
756
|
+
console.log('停止浏览器录制成功', url, blob, clientRecordId)
|
|
757
|
+
};
|
|
758
|
+
// 停止浏览器录制失败
|
|
759
|
+
this.test_controller.OnClientStopRecordFailed = (
|
|
760
|
+
clientRecordId,
|
|
761
|
+
code,
|
|
762
|
+
msg
|
|
763
|
+
) => {
|
|
764
|
+
console.log('停止浏览器录制失败', clientRecordId, code, msg)
|
|
765
|
+
};
|
|
766
|
+
// 暂停浏览器录制成功
|
|
767
|
+
this.test_controller.OnClientPauseRecordSuccess = (
|
|
768
|
+
clientRecordId
|
|
769
|
+
) => {
|
|
770
|
+
console.log('暂停浏览器录制成功', clientRecordId)
|
|
771
|
+
};
|
|
772
|
+
// 暂停浏览器录制失败
|
|
773
|
+
this.test_controller.OnClientPauseRecordFailed = (
|
|
774
|
+
clientRecordId,
|
|
775
|
+
code,
|
|
776
|
+
msg
|
|
777
|
+
) => {
|
|
778
|
+
console.log('暂停浏览器录制失败', clientRecordId, code, msg)
|
|
779
|
+
};
|
|
780
|
+
// 继续浏览器录制成功
|
|
781
|
+
this.test_controller.OnClientResumeRecordSuccess = (
|
|
782
|
+
clientRecordId
|
|
783
|
+
) => {
|
|
784
|
+
console.log('继续浏览器录制成功', clientRecordId)
|
|
785
|
+
};
|
|
786
|
+
// 继续浏览器录制失败
|
|
787
|
+
this.test_controller.OnClientResumeRecordFailed = (
|
|
788
|
+
clientRecordId,
|
|
789
|
+
code,
|
|
790
|
+
msg
|
|
791
|
+
) => {
|
|
792
|
+
console.log('继续浏览器录制失败', clientRecordId, code, msg)
|
|
793
|
+
};
|
|
794
|
+
// 下载成功
|
|
795
|
+
this.test_controller.OnClientDownloadRecordSuccess = (
|
|
796
|
+
clientRecordId
|
|
797
|
+
) => {
|
|
798
|
+
console.log('下载成功', clientRecordId)
|
|
799
|
+
};
|
|
800
|
+
// 下载失败
|
|
801
|
+
this.test_controller.OnClientDownloadRecordFailed = (
|
|
802
|
+
clientRecordId,
|
|
803
|
+
code,
|
|
804
|
+
msg
|
|
805
|
+
) => {
|
|
806
|
+
console.log('下载失败', clientRecordId, code, msg)
|
|
807
|
+
};
|
|
808
|
+
// 切流成功通知
|
|
809
|
+
this.test_controller.OnChangeMediaStreamSuccess = (sid) => {
|
|
810
|
+
console.log('切流成功通知', sid);
|
|
811
|
+
if (this.state.publishDevic == 2) {
|
|
812
|
+
// 打开共享
|
|
813
|
+
callNimIM('sendCustomCmdMsg', {
|
|
814
|
+
customId: this.state.imRoomId,
|
|
815
|
+
content: JSON.stringify({
|
|
816
|
+
'typeId': 2030,
|
|
817
|
+
'sessionId': this.state.sessionId,
|
|
818
|
+
'sharedScreen': 1,
|
|
819
|
+
'tellerId': this.state.tellerId
|
|
820
|
+
})
|
|
821
|
+
});
|
|
822
|
+
this.setState({
|
|
823
|
+
isSharedScreen: true
|
|
824
|
+
});
|
|
825
|
+
this.setState({
|
|
826
|
+
screenName: '取消共享'
|
|
827
|
+
})
|
|
828
|
+
} else {
|
|
829
|
+
this.setState({
|
|
830
|
+
isSharedScreen: false
|
|
831
|
+
});
|
|
832
|
+
this.setState({
|
|
833
|
+
screenName: '投屏'
|
|
834
|
+
});
|
|
835
|
+
callNimIM('sendCustomCmdMsg', {
|
|
836
|
+
customId: this.state.imRoomId,
|
|
837
|
+
content: JSON.stringify({
|
|
838
|
+
'typeId': 2030,
|
|
839
|
+
'sessionId': this.state.sessionId,
|
|
840
|
+
'sharedScreen': 0,
|
|
841
|
+
'tellerId': this.state.tellerId
|
|
842
|
+
})
|
|
843
|
+
})
|
|
844
|
+
}
|
|
845
|
+
};
|
|
846
|
+
// 切流失败通知
|
|
847
|
+
this.test_controller.OnChangeMediaStreamFailed = (
|
|
848
|
+
sid,
|
|
849
|
+
code,
|
|
850
|
+
msg
|
|
851
|
+
) => {
|
|
852
|
+
console.log('切流失败通知', sid, code, msg)
|
|
853
|
+
};
|
|
854
|
+
// 服务端录制初始化成功
|
|
855
|
+
this.test_controller.OnInitRemoteRecordSucc = (
|
|
856
|
+
record_id,
|
|
857
|
+
record_third_id
|
|
858
|
+
) => {
|
|
859
|
+
console.log('服务端录制初始化成功', record_id, record_third_id)
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
voice = () => {
|
|
864
|
+
if (!this.state.voiceStatue) {
|
|
865
|
+
// 静音本地
|
|
866
|
+
this.setState({
|
|
867
|
+
voiceStatue: true
|
|
868
|
+
});
|
|
869
|
+
this.setState({
|
|
870
|
+
voiceImg: voiceImgCloe
|
|
871
|
+
});
|
|
872
|
+
let sid = document.getElementById('publish_video1').name;
|
|
873
|
+
if (!sid) {
|
|
874
|
+
// 纯音频的时候sid在publish_streamId标签中
|
|
875
|
+
sid = document.getElementById('publish_streamId1').name
|
|
876
|
+
}
|
|
877
|
+
this.test_controller.SetLocalAudioEnable(0, parseInt(sid, 10));
|
|
878
|
+
callNimIM('sendCustomCmdMsg', {
|
|
879
|
+
customId: this.state.imRoomId,
|
|
880
|
+
content: JSON.stringify({
|
|
881
|
+
'typeId': 1013,
|
|
882
|
+
'state': 0,
|
|
883
|
+
'sessionId': this.state.sessionId,
|
|
884
|
+
})
|
|
885
|
+
}, function (code, message, data) {
|
|
886
|
+
console.log(data)
|
|
887
|
+
})
|
|
888
|
+
} else if (this.state.voiceStatue) {
|
|
889
|
+
// 打开本地
|
|
890
|
+
this.setState({
|
|
891
|
+
voiceStatue: false
|
|
892
|
+
});
|
|
893
|
+
this.setState({
|
|
894
|
+
voiceImg: voiceImgOpen
|
|
895
|
+
});
|
|
896
|
+
let sid = document.getElementById('publish_video1').name;
|
|
897
|
+
if (!sid) {
|
|
898
|
+
// 纯音频的时候sid在publish_streamId标签中
|
|
899
|
+
sid = document.getElementById('publish_streamId1').name
|
|
900
|
+
}
|
|
901
|
+
this.test_controller.SetLocalAudioEnable(1, parseInt(sid, 10));
|
|
902
|
+
callNimIM('sendCustomCmdMsg', {
|
|
903
|
+
customId: this.state.imRoomId,
|
|
904
|
+
content: JSON.stringify({
|
|
905
|
+
'typeId': 1013,
|
|
906
|
+
'state': 1,
|
|
907
|
+
'sessionId': this.state.sessionId,
|
|
908
|
+
})
|
|
909
|
+
}, function (code, message, data) {
|
|
910
|
+
console.log(data)
|
|
911
|
+
})
|
|
912
|
+
}
|
|
913
|
+
};
|
|
914
|
+
isFileSuccuse = () => {
|
|
915
|
+
if (!this.state.sessionId) {
|
|
916
|
+
return false
|
|
917
|
+
} else if (this.state.isSuspend) {
|
|
918
|
+
return false
|
|
919
|
+
} else if (!this.state.isCustomer) {
|
|
920
|
+
return false
|
|
921
|
+
} else {
|
|
922
|
+
return true
|
|
923
|
+
}
|
|
924
|
+
};
|
|
925
|
+
cameraClick = () => {
|
|
926
|
+
if (this.isFileSuccuse()) {
|
|
927
|
+
if (!this.state.audioed) {
|
|
928
|
+
this.setState({
|
|
929
|
+
audioed: true
|
|
930
|
+
});
|
|
931
|
+
this.setState({
|
|
932
|
+
cameraImg: cameraImgCloe
|
|
933
|
+
});
|
|
934
|
+
let sid = document.getElementById('publish_video1').name;
|
|
935
|
+
if (!sid) {
|
|
936
|
+
// 纯音频的时候sid在publish_streamId标签中
|
|
937
|
+
sid = document.getElementById('publish_streamId1').name
|
|
938
|
+
}
|
|
939
|
+
this.test_controller.SetLocalVideoEnable(0, parseInt(sid, 10));
|
|
940
|
+
callNimIM('sendCustomCmdMsg', {
|
|
941
|
+
customId: this.state.imRoomId,
|
|
942
|
+
content: JSON.stringify({
|
|
943
|
+
'typeId': 1012,
|
|
944
|
+
'state': 0,
|
|
945
|
+
'sessionId': this.state.sessionId,
|
|
946
|
+
'userId': this.state.tellerId
|
|
947
|
+
})
|
|
948
|
+
}, function (code, message, data) {
|
|
949
|
+
console.log(data)
|
|
950
|
+
})
|
|
951
|
+
} else if (this.state.audioed) {
|
|
952
|
+
this.setState({
|
|
953
|
+
audioed: false
|
|
954
|
+
});
|
|
955
|
+
this.setState({
|
|
956
|
+
cameraImg: cameraImgOpen
|
|
957
|
+
});
|
|
958
|
+
let sid = document.getElementById('publish_video1').name;
|
|
959
|
+
if (!sid) {
|
|
960
|
+
// 纯音频的时候sid在publish_streamId标签中
|
|
961
|
+
sid = document.getElementById('publish_streamId1').name
|
|
962
|
+
}
|
|
963
|
+
this.test_controller.SetLocalVideoEnable(1, parseInt(sid, 10));
|
|
964
|
+
callNimIM('sendCustomCmdMsg', {
|
|
965
|
+
customId: this.state.imRoomId,
|
|
966
|
+
content: JSON.stringify({
|
|
967
|
+
'typeId': 1012,
|
|
968
|
+
'state': 1,
|
|
969
|
+
'sessionId': this.state.sessionId,
|
|
970
|
+
'userId': this.state.tellerId
|
|
971
|
+
})
|
|
972
|
+
}, function (code, message, data) {
|
|
973
|
+
console.log(data)
|
|
974
|
+
})
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
sharedScreen = () => {
|
|
979
|
+
if (this.isFileSuccuse()) {
|
|
980
|
+
const publish_config = {};
|
|
981
|
+
if (this.state.isSharedScreen) {
|
|
982
|
+
publish_config.publish_device = 1;
|
|
983
|
+
publish_config.media_type = 1;
|
|
984
|
+
publish_config.sid = document.getElementById('publish_video1').name;
|
|
985
|
+
publish_config.video_profile_type = 5;
|
|
986
|
+
this.test_controller.ChangeMediaStream(publish_config);
|
|
987
|
+
this.setState({
|
|
988
|
+
publishDevic: 1
|
|
989
|
+
});
|
|
990
|
+
this.setState({
|
|
991
|
+
screenName: '投屏'
|
|
992
|
+
});
|
|
993
|
+
this.setState({
|
|
994
|
+
isSharedScreen: false
|
|
995
|
+
})
|
|
996
|
+
} else {
|
|
997
|
+
publish_config.media_type = 1;
|
|
998
|
+
publish_config.publish_device = 2;
|
|
999
|
+
publish_config.video_profile_type = 5;
|
|
1000
|
+
publish_config.sid = document.getElementById('publish_video1').name;
|
|
1001
|
+
this.test_controller.ChangeMediaStream(publish_config);
|
|
1002
|
+
this.setState({
|
|
1003
|
+
publishDevic: 2
|
|
1004
|
+
})
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
suspend = () => {
|
|
1009
|
+
if (this.state.isSuspend) {
|
|
1010
|
+
// 代表此时按钮是恢复会话,把isSuspend改成true变成暂停会话
|
|
1011
|
+
this.setState({
|
|
1012
|
+
isSuspend: false
|
|
1013
|
+
});
|
|
1014
|
+
this.setState({
|
|
1015
|
+
suspendName: '暂停'
|
|
1016
|
+
});
|
|
1017
|
+
let sid = document.getElementById('publish_video1').name;
|
|
1018
|
+
if (!sid) {
|
|
1019
|
+
// 纯音频的时候sid在publish_streamId标签中
|
|
1020
|
+
sid = document.getElementById('publish_streamId1').name
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
this.test_controller.SetLocalVideoEnable(1, parseInt(sid, 10));
|
|
1024
|
+
if (this.state.voiceStatue) {
|
|
1025
|
+
// 当前是音频
|
|
1026
|
+
this.setState({
|
|
1027
|
+
voiceImg: voiceImgCloe
|
|
1028
|
+
});
|
|
1029
|
+
let sid = document.getElementById('publish_video1').name;
|
|
1030
|
+
if (!sid) {
|
|
1031
|
+
// 纯音频的时候sid在publish_streamId标签中
|
|
1032
|
+
sid = document.getElementById('publish_streamId1').name
|
|
1033
|
+
}
|
|
1034
|
+
this.test_controller.SetLocalAudioEnable(0, parseInt(sid, 10))
|
|
1035
|
+
} else {
|
|
1036
|
+
// 当前是
|
|
1037
|
+
this.test_controller.SetLocalAudioEnable(1, parseInt(sid, 10));
|
|
1038
|
+
this.setState({
|
|
1039
|
+
voiceImg: voiceImgOpen
|
|
1040
|
+
})
|
|
1041
|
+
}
|
|
1042
|
+
callNimIM('sendCustomCmdMsg', {
|
|
1043
|
+
customId: this.state.imRoomId,
|
|
1044
|
+
content: JSON.stringify({
|
|
1045
|
+
'typeId': 1011,
|
|
1046
|
+
'state': 1,
|
|
1047
|
+
'sessionId': this.state.sessionId,
|
|
1048
|
+
'userId': this.state.tellerId
|
|
1049
|
+
})
|
|
1050
|
+
}, function (code, message, data) {
|
|
1051
|
+
console.log(data)
|
|
1052
|
+
})
|
|
1053
|
+
} else {
|
|
1054
|
+
this.setState({
|
|
1055
|
+
isModalVisible: true
|
|
1056
|
+
})
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
};
|
|
1060
|
+
handleOk = () => {
|
|
1061
|
+
// 代表此时按钮是暂停会话,把isSuspend改成true变成恢复会话
|
|
1062
|
+
callNimIM('sendCustomCmdMsg', {
|
|
1063
|
+
customId: this.state.imRoomId,
|
|
1064
|
+
content: JSON.stringify({
|
|
1065
|
+
'typeId': 1012,
|
|
1066
|
+
'state': 1,
|
|
1067
|
+
'sessionId': this.state.sessionId,
|
|
1068
|
+
'userId': this.state.tellerId
|
|
1069
|
+
})
|
|
1070
|
+
}, function (code, message, data) {
|
|
1071
|
+
console.log(data)
|
|
1072
|
+
});
|
|
1073
|
+
this.setState({
|
|
1074
|
+
isSuspend: true
|
|
1075
|
+
});
|
|
1076
|
+
this.setState({
|
|
1077
|
+
suspendName: '恢复'
|
|
1078
|
+
});
|
|
1079
|
+
callNimIM('sendCustomCmdMsg', {
|
|
1080
|
+
customId: this.state.imRoomId,
|
|
1081
|
+
content: JSON.stringify({
|
|
1082
|
+
'typeId': 1011,
|
|
1083
|
+
'state': 0,
|
|
1084
|
+
'sessionId': this.state.sessionId,
|
|
1085
|
+
'userId': this.state.tellerId
|
|
1086
|
+
})
|
|
1087
|
+
}, function (code, message, data) {
|
|
1088
|
+
console.log(data)
|
|
1089
|
+
});
|
|
1090
|
+
let sid = document.getElementById('publish_video1').name;
|
|
1091
|
+
if (!sid) {
|
|
1092
|
+
// 纯音频的时候sid在publish_streamId标签中
|
|
1093
|
+
sid = document.getElementById('publish_streamId1').name
|
|
1094
|
+
}
|
|
1095
|
+
this.test_controller.SetLocalAudioEnable(0, parseInt(sid, 10));
|
|
1096
|
+
this.test_controller.SetLocalVideoEnable(0, parseInt(sid, 10));
|
|
1097
|
+
this.setState({
|
|
1098
|
+
isModalVisible: false
|
|
1099
|
+
})
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1102
|
+
handleCancel = () => {
|
|
1103
|
+
|
|
1104
|
+
this.setState({
|
|
1105
|
+
isModalVisible: false
|
|
1106
|
+
})
|
|
1107
|
+
};
|
|
1108
|
+
handleOkEnd = () => {
|
|
1109
|
+
this.endSessionValue();
|
|
1110
|
+
this.setState({
|
|
1111
|
+
isModalVisibleEnd: false
|
|
1112
|
+
})
|
|
1113
|
+
};
|
|
1114
|
+
handleCancelEnd = () => {
|
|
1115
|
+
|
|
1116
|
+
this.setState({
|
|
1117
|
+
isModalVisibleEnd: false
|
|
1118
|
+
})
|
|
1119
|
+
};
|
|
1120
|
+
handleOkFacial = () => {
|
|
1121
|
+
const frontIdcard = new File([this.dataURLtoFile(this.state.facialImg, 'image/jpeg')], new Date() + '.png'); // 重命名了
|
|
1122
|
+
const formData = new FormData();
|
|
1123
|
+
formData.append('file', frontIdcard);
|
|
1124
|
+
formData.append('sessionId', this.state.sessionId);
|
|
1125
|
+
this.uploadImg(formData)
|
|
1126
|
+
};
|
|
1127
|
+
handleCancelFacial = () => {
|
|
1128
|
+
this.setState({
|
|
1129
|
+
isModalVisibleFacial: false
|
|
1130
|
+
})
|
|
1131
|
+
};
|
|
1132
|
+
transcribingClick = () => {
|
|
1133
|
+
callNimIM('sendCustomCmdMsg', {
|
|
1134
|
+
customId: this.state.imRoomId,
|
|
1135
|
+
content: JSON.stringify(this.state.transcribingData)
|
|
1136
|
+
})
|
|
1137
|
+
};
|
|
1138
|
+
|
|
1139
|
+
render() {
|
|
1140
|
+
return (
|
|
1141
|
+
<div className="all">
|
|
1142
|
+
<Header></Header>
|
|
1143
|
+
<div className="health">
|
|
1144
|
+
<div className="wrapper">
|
|
1145
|
+
<div
|
|
1146
|
+
className={`itemed ${this.state.isBigVideo == 'video1' ? 'item1' : ""}`}
|
|
1147
|
+
// className="itemed item1"
|
|
1148
|
+
style={{position: "relative"}}
|
|
1149
|
+
onClick={this.enlargeClick.bind(this, 'isLangVideo1')}
|
|
1150
|
+
>
|
|
1151
|
+
{
|
|
1152
|
+
this.state.customAudioed && <img
|
|
1153
|
+
alt=""
|
|
1154
|
+
src={require("../../assets/img/yingpin.png")}
|
|
1155
|
+
style={{width: "100%", height: "100%"}}
|
|
1156
|
+
></img>
|
|
1157
|
+
}
|
|
1158
|
+
<div className="video1Div" style={{display: (!this.state.customAudioed) ? '' : 'none',}}>
|
|
1159
|
+
<video
|
|
1160
|
+
id="video1"
|
|
1161
|
+
autoPlay
|
|
1162
|
+
muted={true}
|
|
1163
|
+
className="video1"
|
|
1164
|
+
/>
|
|
1165
|
+
<audio id="audio1" autoPlay/>
|
|
1166
|
+
<label style={{display: 'none'}} id="feedId1" type="text"/>
|
|
1167
|
+
</div>
|
|
1168
|
+
</div>
|
|
1169
|
+
<div
|
|
1170
|
+
className={`itemed ${this.state.isSharedScreen || this.state.publishDevic == 4 ? '' : (this.state.isBigVideo == 'publish_video1' ? 'item1 isBack' : (this.state.isCustomer ? 'isBack' : 'itemPublic'))}`}
|
|
1171
|
+
onClick={this.enlargeClick.bind(this, 'isLangPublishVideo1')}
|
|
1172
|
+
>
|
|
1173
|
+
|
|
1174
|
+
<div className="publishVideoDiv">
|
|
1175
|
+
{
|
|
1176
|
+
this.state.audioed && <img
|
|
1177
|
+
alt=""
|
|
1178
|
+
src={require("../../assets/img/yingpin.png")}
|
|
1179
|
+
className="imgClass"
|
|
1180
|
+
/>
|
|
1181
|
+
}
|
|
1182
|
+
{
|
|
1183
|
+
this.state.isSuspend && <img
|
|
1184
|
+
alt=""
|
|
1185
|
+
src={require("../../assets/img/zanTing.png")}
|
|
1186
|
+
className="imgClass"
|
|
1187
|
+
/>
|
|
1188
|
+
}
|
|
1189
|
+
{
|
|
1190
|
+
this.state.isSharedScreen && <span
|
|
1191
|
+
className="sharedScreen"
|
|
1192
|
+
>
|
|
1193
|
+
屏幕共享中
|
|
1194
|
+
</span>
|
|
1195
|
+
}
|
|
1196
|
+
<video
|
|
1197
|
+
style={{display: (!this.state.audioed && !this.state.isSuspend) ? '' : 'none',}}
|
|
1198
|
+
id="publish_video1"
|
|
1199
|
+
className={`publishVideoClass ${this.state.isCustomer ? '' : "videoFit"}`}
|
|
1200
|
+
onClick={this.enlargeClick.bind(this, 'isLangVideo2')}
|
|
1201
|
+
autoPlay
|
|
1202
|
+
muted={true}
|
|
1203
|
+
/>
|
|
1204
|
+
<audio id="audio1" autoPlay/>
|
|
1205
|
+
<label style={{display: 'none'}} id="publish_streamId1" type="text"/>
|
|
1206
|
+
</div>
|
|
1207
|
+
|
|
1208
|
+
</div>
|
|
1209
|
+
<div className={`itemed ${this.state.isBigVideo == 'video2' ? 'item1' : ""}`}>
|
|
1210
|
+
{
|
|
1211
|
+
!this.state.isPDF ? <div onClick={this.enlargeClick.bind(this, 'isLangVideo2')}>
|
|
1212
|
+
<video
|
|
1213
|
+
id="video2"
|
|
1214
|
+
autoPlay
|
|
1215
|
+
muted={true}
|
|
1216
|
+
className="video"
|
|
1217
|
+
/>
|
|
1218
|
+
<audio id="audio2" autoPlay/>
|
|
1219
|
+
<label style={{display: 'none'}} id="feedId2" type="text"/>
|
|
1220
|
+
</div>
|
|
1221
|
+
:
|
|
1222
|
+
<div className="video" id="touBoxItem">
|
|
1223
|
+
<Pdf></Pdf>
|
|
1224
|
+
</div>
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
|
|
1228
|
+
</div>
|
|
1229
|
+
<div className={`itemed ${this.state.isBigVideo == 'video3' ? 'item1' : ""}`}
|
|
1230
|
+
onClick={this.enlargeClick.bind(this, 'isLangVideo3')}>
|
|
1231
|
+
<video
|
|
1232
|
+
id="video3"
|
|
1233
|
+
autoPlay
|
|
1234
|
+
muted={true}
|
|
1235
|
+
className="video"
|
|
1236
|
+
/>
|
|
1237
|
+
<audio id="audio3" autoPlay/>
|
|
1238
|
+
<label style={{display: 'none'}} id="feedId3" type="text"/>
|
|
1239
|
+
</div>
|
|
1240
|
+
<div className={`itemed ${this.state.isBigVideo == 'video4' ? 'item1' : ""}`}
|
|
1241
|
+
onClick={this.enlargeClick.bind(this, 'isLangVideo4')}>
|
|
1242
|
+
<video
|
|
1243
|
+
id="video4"
|
|
1244
|
+
autoPlay
|
|
1245
|
+
muted={true}
|
|
1246
|
+
className="video"
|
|
1247
|
+
/>
|
|
1248
|
+
<audio id="audio4" autoPlay/>
|
|
1249
|
+
<label style={{display: 'none'}} id="feedId4" type="text"/>
|
|
1250
|
+
</div>
|
|
1251
|
+
<div className={`itemed ${this.state.isBigVideo == 'video5' ? 'item1' : ""}`}
|
|
1252
|
+
onClick={this.enlargeClick.bind(this, 'isLangVideo5')}>
|
|
1253
|
+
<video
|
|
1254
|
+
id="video5"
|
|
1255
|
+
autoPlay
|
|
1256
|
+
muted={true}
|
|
1257
|
+
className="video"
|
|
1258
|
+
/>
|
|
1259
|
+
<audio id="audio5" autoPlay/>
|
|
1260
|
+
<label style={{display: 'none'}} id="feedId5" type="text"/>
|
|
1261
|
+
</div>
|
|
1262
|
+
<div className={`itemed ${this.state.isBigVideo == 'video6' ? 'item1' : ""}`}
|
|
1263
|
+
onClick={this.enlargeClick.bind(this, 'isLangVideo6')}>
|
|
1264
|
+
<video
|
|
1265
|
+
id="video6"
|
|
1266
|
+
autoPlay
|
|
1267
|
+
muted={true}
|
|
1268
|
+
className="video"
|
|
1269
|
+
/>
|
|
1270
|
+
<audio id="audio2" autoPlay/>
|
|
1271
|
+
<label style={{display: 'none'}} id="feedId6" type="text"/>
|
|
1272
|
+
</div>
|
|
1273
|
+
</div>
|
|
1274
|
+
|
|
1275
|
+
</div>
|
|
1276
|
+
<Foot
|
|
1277
|
+
img={this.state.voiceImg}
|
|
1278
|
+
screenName={this.state.screenName}
|
|
1279
|
+
suspendName={this.state.suspendName}
|
|
1280
|
+
cameraImg={this.state.cameraImg}
|
|
1281
|
+
isTranscribing={this.state.isTranscribing}
|
|
1282
|
+
suspend={this.suspend}
|
|
1283
|
+
voice={this.voice}
|
|
1284
|
+
cameraClick={this.cameraClick}
|
|
1285
|
+
sharedScreen={this.sharedScreen}
|
|
1286
|
+
endSession={this.endSession}
|
|
1287
|
+
facialRecognition={this.facialRecognition}
|
|
1288
|
+
pictureInPicture={this.pictureInPicture}
|
|
1289
|
+
transcribingClick={this.transcribingClick}
|
|
1290
|
+
></Foot>
|
|
1291
|
+
<Modal cancelText="取消" okText="确定" visible={this.state.isModalVisible} onOk={this.handleOk}
|
|
1292
|
+
onCancel={this.handleCancel}>
|
|
1293
|
+
{
|
|
1294
|
+
this.state.isSuspend && <span>确定是否恢复会话?</span>
|
|
1295
|
+
}
|
|
1296
|
+
{
|
|
1297
|
+
!this.state.isSuspend && <span>确定是否暂停会话?</span>
|
|
1298
|
+
}
|
|
1299
|
+
</Modal>
|
|
1300
|
+
<Modal cancelText="取消" okText="确定" visible={this.state.isModalVisibleEnd} onOk={this.handleOkEnd}
|
|
1301
|
+
onCancel={this.handleCancelEnd}>
|
|
1302
|
+
<span>确定是否结束会话?</span>
|
|
1303
|
+
</Modal>
|
|
1304
|
+
<Modal title="人脸识别" cancelText="取消" okText="确定" visible={this.state.isModalVisibleFacial}
|
|
1305
|
+
onOk={this.handleOkFacial} onCancel={this.handleCancelFacial}>
|
|
1306
|
+
<img src={this.state.facialImg} alt=""></img>
|
|
1307
|
+
</Modal>
|
|
1308
|
+
<video className="mixedvideo" id="mixedvideo" autoPlay muted={true} width="0" height="0"
|
|
1309
|
+
webkit-playsinline="true" playsInline={true} x5-playsinline="x5-playsinline"
|
|
1310
|
+
x-webkit-airplay="true"></video>
|
|
1311
|
+
|
|
1312
|
+
</div>
|
|
1313
|
+
);
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
export default Video;
|