@vidtreo/recorder 0.9.8 → 0.9.10
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/dist/index.d.ts +3 -0
- package/dist/index.js +27 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1183,6 +1183,8 @@ export declare class RecordingManager {
|
|
|
1183
1183
|
private isPaused;
|
|
1184
1184
|
private maxRecordingTime;
|
|
1185
1185
|
private maxTimeTimer;
|
|
1186
|
+
private recordingStartTime;
|
|
1187
|
+
private maxTimeRemaining;
|
|
1186
1188
|
private recordingSeconds;
|
|
1187
1189
|
private recordingIntervalId;
|
|
1188
1190
|
private pauseStartTime;
|
|
@@ -1216,6 +1218,7 @@ export declare class RecordingManager {
|
|
|
1216
1218
|
private resetPauseState;
|
|
1217
1219
|
private updatePausedDuration;
|
|
1218
1220
|
private startRecordingTimer;
|
|
1221
|
+
private startMaxTimeTimer;
|
|
1219
1222
|
private clearTimer;
|
|
1220
1223
|
private handleError;
|
|
1221
1224
|
}
|
package/dist/index.js
CHANGED
|
@@ -12016,6 +12016,8 @@ class RecordingManager {
|
|
|
12016
12016
|
isPaused = false;
|
|
12017
12017
|
maxRecordingTime = null;
|
|
12018
12018
|
maxTimeTimer = null;
|
|
12019
|
+
recordingStartTime = null;
|
|
12020
|
+
maxTimeRemaining = null;
|
|
12019
12021
|
recordingSeconds = 0;
|
|
12020
12022
|
recordingIntervalId = null;
|
|
12021
12023
|
pauseStartTime = null;
|
|
@@ -12147,12 +12149,10 @@ class RecordingManager {
|
|
|
12147
12149
|
return;
|
|
12148
12150
|
}
|
|
12149
12151
|
this.startRecordingTimer();
|
|
12152
|
+
this.recordingStartTime = Date.now();
|
|
12150
12153
|
if (this.maxRecordingTime && this.maxRecordingTime > 0) {
|
|
12151
|
-
this.
|
|
12152
|
-
|
|
12153
|
-
await this.stopRecording();
|
|
12154
|
-
}
|
|
12155
|
-
}, this.maxRecordingTime);
|
|
12154
|
+
this.maxTimeRemaining = this.maxRecordingTime;
|
|
12155
|
+
this.startMaxTimeTimer();
|
|
12156
12156
|
}
|
|
12157
12157
|
}
|
|
12158
12158
|
async stopRecording() {
|
|
@@ -12191,6 +12191,12 @@ class RecordingManager {
|
|
|
12191
12191
|
this.clearTimer(this.recordingIntervalId, clearInterval);
|
|
12192
12192
|
this.recordingIntervalId = null;
|
|
12193
12193
|
this.pauseStartTime = Date.now();
|
|
12194
|
+
if (this.maxTimeTimer !== null && this.recordingStartTime !== null && this.maxRecordingTime !== null) {
|
|
12195
|
+
const elapsed = Date.now() - this.recordingStartTime - this.totalPausedTime;
|
|
12196
|
+
this.maxTimeRemaining = Math.max(0, this.maxRecordingTime - elapsed);
|
|
12197
|
+
this.clearTimer(this.maxTimeTimer, clearTimeout);
|
|
12198
|
+
this.maxTimeTimer = null;
|
|
12199
|
+
}
|
|
12194
12200
|
}
|
|
12195
12201
|
resumeRecording() {
|
|
12196
12202
|
if (this.recordingState !== RECORDING_STATE_RECORDING || !this.isPaused) {
|
|
@@ -12200,6 +12206,9 @@ class RecordingManager {
|
|
|
12200
12206
|
this.isPaused = false;
|
|
12201
12207
|
this.updatePausedDuration();
|
|
12202
12208
|
this.startRecordingTimer();
|
|
12209
|
+
if (this.maxTimeRemaining !== null && this.maxTimeRemaining > 0) {
|
|
12210
|
+
this.startMaxTimeTimer();
|
|
12211
|
+
}
|
|
12203
12212
|
}
|
|
12204
12213
|
cancelCountdown() {
|
|
12205
12214
|
this.clearTimer(this.countdownTimeoutId, clearTimeout);
|
|
@@ -12223,6 +12232,8 @@ class RecordingManager {
|
|
|
12223
12232
|
this.recordingSeconds = 0;
|
|
12224
12233
|
this.totalPausedTime = 0;
|
|
12225
12234
|
this.pauseStartTime = null;
|
|
12235
|
+
this.recordingStartTime = null;
|
|
12236
|
+
this.maxTimeRemaining = null;
|
|
12226
12237
|
}
|
|
12227
12238
|
resetPauseState() {
|
|
12228
12239
|
this.isPaused = false;
|
|
@@ -12246,6 +12257,17 @@ class RecordingManager {
|
|
|
12246
12257
|
this.callbacks.onTimerUpdate(formatTime(this.recordingSeconds));
|
|
12247
12258
|
}, RECORDING_TIMER_INTERVAL);
|
|
12248
12259
|
}
|
|
12260
|
+
startMaxTimeTimer() {
|
|
12261
|
+
if (this.maxTimeRemaining === null || this.maxTimeRemaining <= 0) {
|
|
12262
|
+
return;
|
|
12263
|
+
}
|
|
12264
|
+
this.clearTimer(this.maxTimeTimer, clearTimeout);
|
|
12265
|
+
this.maxTimeTimer = window.setTimeout(async () => {
|
|
12266
|
+
if (this.recordingState === RECORDING_STATE_RECORDING && !this.isPaused) {
|
|
12267
|
+
await this.stopRecording();
|
|
12268
|
+
}
|
|
12269
|
+
}, this.maxTimeRemaining);
|
|
12270
|
+
}
|
|
12249
12271
|
clearTimer(timerId, clearFn) {
|
|
12250
12272
|
if (timerId !== null) {
|
|
12251
12273
|
clearFn(timerId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vidtreo/recorder",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vidtreo SDK for browser-based video recording and transcoding. Features include camera/screen recording, real-time MP4 transcoding, audio level analysis, mute/pause controls, source switching, device selection, and automatic backend uploads. Similar to Ziggeo and Addpipe, Vidtreo provides enterprise-grade video processing capabilities for web applications.",
|
|
6
6
|
"main": "./dist/index.js",
|