|
@@ -20,9 +20,28 @@ function highPrecisionTime(): number {
|
20
|
20
|
|
21
|
21
|
// Have to use string literal here, instead of Symbols,
|
22
|
22
|
// because these values need to be JSON-serializible.
|
|
23
|
+
|
|
24
|
+/**
|
|
25
|
+ * Types of SessionEvents.
|
|
26
|
+ */
|
23
|
27
|
const SessionEventType = Object.freeze({
|
|
28
|
+ /**
|
|
29
|
+ * Start of local recording session. This is recorded when the
|
|
30
|
+ * {@code RecordingController} receives the signal to start local recording,
|
|
31
|
+ * before the actual adapter is engaged.
|
|
32
|
+ */
|
24
|
33
|
SESSION_STARTED: 'SESSION_STARTED',
|
|
34
|
+
|
|
35
|
+ /**
|
|
36
|
+ * Start of a continuous segment. This is recorded when the adapter is
|
|
37
|
+ * engaged. Can happen multiple times in a local recording session,
|
|
38
|
+ * due to browser reloads or switching of recording device.
|
|
39
|
+ */
|
25
|
40
|
SEGMENT_STARTED: 'SEGMENT_STARTED',
|
|
41
|
+
|
|
42
|
+ /**
|
|
43
|
+ * End of a continuous segment. This is recorded when the adapter unengages.
|
|
44
|
+ */
|
26
|
45
|
SEGMENT_ENDED: 'SEGMENT_ENDED'
|
27
|
46
|
});
|
28
|
47
|
|
|
@@ -169,8 +188,8 @@ class SessionManager {
|
169
|
188
|
/**
|
170
|
189
|
* Creates a session if not exists.
|
171
|
190
|
*
|
172
|
|
- * @param {string} sessionToken - .
|
173
|
|
- * @param {string} format - .
|
|
191
|
+ * @param {string} sessionToken - The local recording session token.
|
|
192
|
+ * @param {string} format - The local recording format.
|
174
|
193
|
* @returns {void}
|
175
|
194
|
*/
|
176
|
195
|
createSession(sessionToken: string, format: string) {
|
|
@@ -218,7 +237,7 @@ class SessionManager {
|
218
|
237
|
/**
|
219
|
238
|
* Removes session metadata.
|
220
|
239
|
*
|
221
|
|
- * @param {*} sessionToken - The session token.
|
|
240
|
+ * @param {string} sessionToken - The session token.
|
222
|
241
|
* @returns {void}
|
223
|
242
|
*/
|
224
|
243
|
removeSession(sessionToken: string) {
|
|
@@ -319,7 +338,7 @@ class SessionManager {
|
319
|
338
|
* {@code SessionEvent}s.
|
320
|
339
|
*
|
321
|
340
|
* @private
|
322
|
|
- * @param {*} events - The array of {@code SessionEvent}s.
|
|
341
|
+ * @param {SessionEvent[]} events - The array of {@code SessionEvent}s.
|
323
|
342
|
* @returns {SegmentInfo[]}
|
324
|
343
|
*/
|
325
|
344
|
_constructSegments(events: SessionEvent[]): SegmentInfo[] {
|
|
@@ -416,5 +435,5 @@ class SessionManager {
|
416
|
435
|
*/
|
417
|
436
|
export const sessionManager = new SessionManager();
|
418
|
437
|
|
419
|
|
-// For debug only. Remove later.
|
|
438
|
+// For debug only. To remove later.
|
420
|
439
|
window.sessionManager = sessionManager;
|