@agilemotion/oui-react-js 1.5.5 → 1.5.6
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.
|
@@ -15,7 +15,7 @@ var _VCEventType = require("./VCEventType");
|
|
|
15
15
|
|
|
16
16
|
var _VCEventManager = _interopRequireDefault(require("./VCEventManager"));
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _VCRoomRecorder = _interopRequireDefault(require("./VCRoomRecorder"));
|
|
19
19
|
|
|
20
20
|
var _MediaSoupHelper = _interopRequireDefault(require("./MediaSoupHelper"));
|
|
21
21
|
|
|
@@ -409,7 +409,7 @@ const VCRoomParticipant = props => {
|
|
|
409
409
|
audioRef.current = stream;
|
|
410
410
|
|
|
411
411
|
if (props.isHost && type === 'audio') {
|
|
412
|
-
|
|
412
|
+
_VCRoomRecorder.default.addTrack(props.data.userId, track);
|
|
413
413
|
|
|
414
414
|
tracks.current.setAudioTrack(track);
|
|
415
415
|
}
|
|
@@ -517,8 +517,8 @@ const VCRoomParticipant = props => {
|
|
|
517
517
|
track.stop();
|
|
518
518
|
});
|
|
519
519
|
|
|
520
|
-
if (userId &&
|
|
521
|
-
|
|
520
|
+
if (userId && _VCRoomRecorder.default) {
|
|
521
|
+
_VCRoomRecorder.default.removeTrack(userId);
|
|
522
522
|
}
|
|
523
523
|
|
|
524
524
|
let elementById = document.getElementById(props.data.userId + '-audio-el-container');
|
|
@@ -561,7 +561,7 @@ const VCRoomParticipant = props => {
|
|
|
561
561
|
document.getElementById('meeting-audio-el-container').appendChild(audioElement);
|
|
562
562
|
|
|
563
563
|
if (props.isHost) {
|
|
564
|
-
|
|
564
|
+
_VCRoomRecorder.default.addTrack(userId, stream.getAudioTracks()[0]);
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
567
|
}
|
package/package.json
CHANGED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _SocketManager = _interopRequireDefault(require("../SocketManager"));
|
|
9
|
-
|
|
10
|
-
var _VCEventManager = _interopRequireDefault(require("./VCEventManager"));
|
|
11
|
-
|
|
12
|
-
var _VCEventType = require("./VCEventType");
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
-
|
|
18
|
-
const {
|
|
19
|
-
electron
|
|
20
|
-
} = window;
|
|
21
|
-
|
|
22
|
-
class Recorder {
|
|
23
|
-
constructor() {
|
|
24
|
-
_defineProperty(this, "init", async (meetingId, meetingTitle) => {
|
|
25
|
-
this.meetingId = meetingId;
|
|
26
|
-
this.meetingTitle = meetingTitle;
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
_defineProperty(this, "addTrack", (id, track) => {
|
|
30
|
-
console.log("ADDING TRACK FOR : " + id);
|
|
31
|
-
this.audioTracks.set(id, track);
|
|
32
|
-
|
|
33
|
-
if (this.recorder && this.recorder.state === 'recording') {
|
|
34
|
-
let mediaStream = new MediaStream([track]);
|
|
35
|
-
const mediaStreamAudioSourceNode = new MediaStreamAudioSourceNode(this.audioContext, {
|
|
36
|
-
mediaStream: mediaStream
|
|
37
|
-
});
|
|
38
|
-
mediaStreamAudioSourceNode.connect(this.mediaStreamAudioDestinationNode);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
_defineProperty(this, "removeTrack", id => {
|
|
43
|
-
if (this.audioTracks.has(id)) {
|
|
44
|
-
this.audioTracks.delete(id);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
_defineProperty(this, "handleRecordingDataAvailable", e => {
|
|
49
|
-
if (e.data.size > 0) {
|
|
50
|
-
console.log("ADDED CHUNK : " + this.recordingSequence);
|
|
51
|
-
const blob = new Blob([e.data], {
|
|
52
|
-
type: "video/webm"
|
|
53
|
-
});
|
|
54
|
-
const data = {
|
|
55
|
-
userId: _VCEventManager.default.getUserDetails().userId,
|
|
56
|
-
meetingId: this.meetingId,
|
|
57
|
-
name: this.meetingTitle,
|
|
58
|
-
type: blob.type,
|
|
59
|
-
size: blob.size,
|
|
60
|
-
sequenceNumber: this.recordingSequence,
|
|
61
|
-
sessionId: this.currentRecordingId
|
|
62
|
-
};
|
|
63
|
-
const reader = new FileReader();
|
|
64
|
-
reader.readAsDataURL(blob);
|
|
65
|
-
|
|
66
|
-
let _this = this;
|
|
67
|
-
|
|
68
|
-
reader.onload = function (evt) {
|
|
69
|
-
const result = evt.target.result;
|
|
70
|
-
_this.recordingType = blob.type;
|
|
71
|
-
_this.recordingSize += blob.size;
|
|
72
|
-
data.recordedData = result.replace('data:video/webm;base64,', '');
|
|
73
|
-
console.log("======== SAVING RECORDING CHUNK =========");
|
|
74
|
-
console.log(data);
|
|
75
|
-
|
|
76
|
-
_SocketManager.default.emitEvent(_VCEventType.VCEventType.SAVE_RECORDING, data).then(data => {
|
|
77
|
-
console.log("===== SAVE RECORDING SUCCESS ======");
|
|
78
|
-
|
|
79
|
-
if (!_this.isRecording) {
|
|
80
|
-
console.log("======= STOPPING RECORDING =======", _this.meetingTitle);
|
|
81
|
-
const data = {
|
|
82
|
-
meetingId: _this.meetingId,
|
|
83
|
-
name: _this.meetingTitle,
|
|
84
|
-
type: _this.recordingType,
|
|
85
|
-
size: _this.recordingSize,
|
|
86
|
-
sequenceNumber: _this.recordingSequence,
|
|
87
|
-
sessionId: _this.currentRecordingId
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
_SocketManager.default.emitEvent(_VCEventType.VCEventType.STOP_RECORDING, data).catch(error => {});
|
|
91
|
-
}
|
|
92
|
-
}).catch(error => {
|
|
93
|
-
console.log("===== SAVE RECORDING ERROR ======");
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
_this.recordingSequence++;
|
|
98
|
-
} else {
|
|
99
|
-
console.log("no data to push");
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
_defineProperty(this, "recordMeeting", async () => {
|
|
104
|
-
this.recorder = await this.createMediaRecorder();
|
|
105
|
-
|
|
106
|
-
let _this = this;
|
|
107
|
-
|
|
108
|
-
if (this.recorder != null) {
|
|
109
|
-
_SocketManager.default.emitEvent(_VCEventType.VCEventType.TOGGLE_RECORD_MEETING, {
|
|
110
|
-
roomID: _this.meetingId,
|
|
111
|
-
isRecording: true
|
|
112
|
-
}).then(data => {
|
|
113
|
-
console.log("RECORDING STARTED : " + data.id);
|
|
114
|
-
_this.currentRecordingId = data.id;
|
|
115
|
-
_this.recordingSequence = 0;
|
|
116
|
-
_this.recordingSize = 0;
|
|
117
|
-
_this.recordingType = '';
|
|
118
|
-
|
|
119
|
-
_this.recorder.start(60000);
|
|
120
|
-
|
|
121
|
-
_this.isRecording = true;
|
|
122
|
-
}).catch(error => {
|
|
123
|
-
console.log("RECORD START ERROR");
|
|
124
|
-
console.log(error);
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
_defineProperty(this, "stopRecordingMeeting", () => {
|
|
130
|
-
try {
|
|
131
|
-
this.isRecording = false;
|
|
132
|
-
|
|
133
|
-
_SocketManager.default.emitEvent(_VCEventType.VCEventType.TOGGLE_RECORD_MEETING, {
|
|
134
|
-
roomID: this.meetingId,
|
|
135
|
-
isRecording: false
|
|
136
|
-
}).catch(error => {});
|
|
137
|
-
|
|
138
|
-
if (this.recorder && this.recorder.state === 'recording') {
|
|
139
|
-
if (this.recorder.stream) {
|
|
140
|
-
var _this$recorder$stream;
|
|
141
|
-
|
|
142
|
-
if (((_this$recorder$stream = this.recorder.stream.getVideoTracks()) === null || _this$recorder$stream === void 0 ? void 0 : _this$recorder$stream.length) > 0) {
|
|
143
|
-
this.recorder.stream.getVideoTracks()[0].stop();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
this.recorder.stop();
|
|
148
|
-
}
|
|
149
|
-
} catch (e) {
|
|
150
|
-
console.error(e);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
_defineProperty(this, "handleStopRecording", e => {
|
|
155
|
-
this.isRecording = false;
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
_defineProperty(this, "createMediaRecorder", () => {
|
|
159
|
-
return new Promise((resolve, reject) => {
|
|
160
|
-
electron.ipcRenderer.getMainWindowId().then(id => {
|
|
161
|
-
if (id) {
|
|
162
|
-
const videoConstraints = {
|
|
163
|
-
audio: false,
|
|
164
|
-
video: {
|
|
165
|
-
mandatory: {
|
|
166
|
-
chromeMediaSource: 'desktop',
|
|
167
|
-
chromeMediaSourceId: id,
|
|
168
|
-
minWidth: 1280,
|
|
169
|
-
maxWidth: 1280,
|
|
170
|
-
minHeight: 720,
|
|
171
|
-
maxHeight: 720
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
let _this = this;
|
|
177
|
-
|
|
178
|
-
navigator.mediaDevices.getUserMedia(videoConstraints).then(stream => {
|
|
179
|
-
const options = {
|
|
180
|
-
mimeType: "video/webm; codecs=vp9"
|
|
181
|
-
};
|
|
182
|
-
let audioContext = new AudioContext();
|
|
183
|
-
let mediaStreamAudioDestinationNode = new MediaStreamAudioDestinationNode(audioContext);
|
|
184
|
-
let tracks = [mediaStreamAudioDestinationNode.stream.getAudioTracks()[0], stream.getVideoTracks()[0]];
|
|
185
|
-
|
|
186
|
-
if (this.audioTracks.size > 0) {
|
|
187
|
-
for (const value of this.audioTracks.values()) {
|
|
188
|
-
tracks.push(value);
|
|
189
|
-
let mediaStreamAudioSourceNode = new MediaStreamAudioSourceNode(audioContext, {
|
|
190
|
-
mediaStream: new MediaStream([value])
|
|
191
|
-
});
|
|
192
|
-
mediaStreamAudioSourceNode.connect(mediaStreamAudioDestinationNode);
|
|
193
|
-
}
|
|
194
|
-
} else {
|
|
195
|
-
let mediaStreamAudioSourceNode = new MediaStreamAudioSourceNode(audioContext, {
|
|
196
|
-
mediaStream: new MediaStream(tracks)
|
|
197
|
-
});
|
|
198
|
-
mediaStreamAudioSourceNode.connect(mediaStreamAudioDestinationNode);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
console.log("INIT WITH TRACKS : ", tracks);
|
|
202
|
-
let initialMediaStream = new MediaStream(tracks);
|
|
203
|
-
const recorder = new MediaRecorder(initialMediaStream, options);
|
|
204
|
-
recorder.ondataavailable = _this.handleRecordingDataAvailable;
|
|
205
|
-
recorder.onstop = _this.handleStopRecording;
|
|
206
|
-
this.audioContext = audioContext;
|
|
207
|
-
this.mediaStreamAudioDestinationNode = mediaStreamAudioDestinationNode;
|
|
208
|
-
resolve(recorder);
|
|
209
|
-
}).catch(e => {
|
|
210
|
-
console.error(e);
|
|
211
|
-
reject(new Error(e.message));
|
|
212
|
-
});
|
|
213
|
-
} else {
|
|
214
|
-
reject(new Error("Cannot initialize recorder. Application screen source not found"));
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
this.meetingId = null;
|
|
221
|
-
this.meetingTitle = '';
|
|
222
|
-
this.recordingSequence = 0;
|
|
223
|
-
this.currentRecordingId = null;
|
|
224
|
-
this.recordingType = null;
|
|
225
|
-
this.recordingSize = null;
|
|
226
|
-
this.isRecording = false;
|
|
227
|
-
this.recorder = null;
|
|
228
|
-
this.audioTracks = new Map();
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
const instance = new Recorder();
|
|
234
|
-
var _default = instance;
|
|
235
|
-
exports.default = _default;
|