@vidtreo/recorder 1.7.6 → 1.7.7

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +2883 -2880
  2. package/dist/index.js +39 -14
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6074,8 +6074,6 @@ var RECORDING_CODEC_UNSUPPORTED_CODES = new Set([
6074
6074
  ]);
6075
6075
  var RECORDING_SERVER_TRANSCODE_FALLBACK_CODES = new Set([
6076
6076
  "recording.post-recording-transcode-fallback",
6077
- "recording.mediarecorder-empty",
6078
- "recording.mediarecorder-error",
6079
6077
  "transcode.post-recording-fallback",
6080
6078
  "route.post-recording-transcode-fallback"
6081
6079
  ]);
@@ -6128,6 +6126,12 @@ function classifyRecordingPipelineCode(errorCode) {
6128
6126
  if (RECORDING_CODEC_UNSUPPORTED_CODES.has(errorCode)) {
6129
6127
  return "recording.codec-unsupported";
6130
6128
  }
6129
+ if (errorCode === "recording.mediarecorder-empty") {
6130
+ return "recording.mediarecorder-empty";
6131
+ }
6132
+ if (errorCode === "recording.mediarecorder-error") {
6133
+ return "recording.mediarecorder-error";
6134
+ }
6131
6135
  if (RECORDING_SERVER_TRANSCODE_FALLBACK_CODES.has(errorCode)) {
6132
6136
  return "recording.post-recording-transcode-fallback";
6133
6137
  }
@@ -6311,7 +6315,7 @@ function resolveDeviceError(input) {
6311
6315
  // package.json
6312
6316
  var package_default = {
6313
6317
  name: "@vidtreo/recorder",
6314
- version: "1.7.6",
6318
+ version: "1.7.7",
6315
6319
  type: "module",
6316
6320
  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.",
6317
6321
  main: "./dist/index.js",
@@ -22793,6 +22797,7 @@ class RecordingManager {
22793
22797
  startupAborted = false;
22794
22798
  activeRecordingConfig = null;
22795
22799
  activeRouteDecision = DEFAULT_ROUTE_DECISION2;
22800
+ isFinalizingRecording = false;
22796
22801
  constructor(streamManager, callbacks, dependencies) {
22797
22802
  this.streamManager = streamManager;
22798
22803
  this.callbacks = callbacks;
@@ -22843,6 +22848,9 @@ class RecordingManager {
22843
22848
  }
22844
22849
  }
22845
22850
  async startRecording() {
22851
+ if (this.recordingState !== RECORDING_STATE_IDLE || this.isFinalizingRecording) {
22852
+ throw new Error("Recording is not ready to start");
22853
+ }
22846
22854
  try {
22847
22855
  this.callbacks.onClearUploadStatus();
22848
22856
  if (this.countdownDuration > 0) {
@@ -22967,16 +22975,26 @@ class RecordingManager {
22967
22975
  }
22968
22976
  async stopRecording() {
22969
22977
  logger.debug("[RecordingManager] stopRecording called");
22970
- try {
22971
- if (this.recordingState !== RECORDING_STATE_RECORDING) {
22972
- const stopRequestedState = this.recordingState;
22973
- this.cancelCountdown();
22974
- throw createRecordingLifecycleError(ERROR_RECORDING_STOP_NOT_READY, "Recording is not ready to stop", {
22975
- recordingState: stopRequestedState,
22976
- hasStreamProcessor: !!this.streamProcessor
22977
- });
22978
- }
22978
+ if (this.isFinalizingRecording) {
22979
+ throw createRecordingLifecycleError(ERROR_RECORDING_STOP_NOT_READY, "Recording is not ready to stop", {
22980
+ recordingState: this.recordingState,
22981
+ hasStreamProcessor: !!this.streamProcessor
22982
+ });
22983
+ }
22984
+ if (this.recordingState !== RECORDING_STATE_RECORDING) {
22985
+ const stopRequestedState = this.recordingState;
22979
22986
  this.cancelCountdown();
22987
+ const error = createRecordingLifecycleError(ERROR_RECORDING_STOP_NOT_READY, "Recording is not ready to stop", {
22988
+ recordingState: stopRequestedState,
22989
+ hasStreamProcessor: !!this.streamProcessor
22990
+ });
22991
+ this.handleError(error);
22992
+ throw error;
22993
+ }
22994
+ this.isFinalizingRecording = true;
22995
+ try {
22996
+ this.callbacks.onFinalizationStart?.();
22997
+ this.clearCountdownTimers();
22980
22998
  this.clearTimer(this.recordingIntervalId, clearInterval);
22981
22999
  this.recordingIntervalId = null;
22982
23000
  this.clearTimer(this.maxTimeTimer, clearTimeout);
@@ -23022,6 +23040,7 @@ class RecordingManager {
23022
23040
  }
23023
23041
  throw normalizedError;
23024
23042
  } finally {
23043
+ this.isFinalizingRecording = false;
23025
23044
  this.activeRecordingConfig = null;
23026
23045
  this.activeRouteDecision = DEFAULT_ROUTE_DECISION2;
23027
23046
  }
@@ -23055,14 +23074,17 @@ class RecordingManager {
23055
23074
  }
23056
23075
  }
23057
23076
  cancelCountdown() {
23077
+ this.clearCountdownTimers();
23078
+ this.recordingState = RECORDING_STATE_IDLE;
23079
+ this.callbacks.onCountdownUpdate(this.recordingState, this.countdownRemaining);
23080
+ }
23081
+ clearCountdownTimers() {
23058
23082
  this.clearTimer(this.countdownTimeoutId, clearTimeout);
23059
23083
  this.countdownTimeoutId = null;
23060
23084
  this.clearTimer(this.countdownIntervalId, clearInterval);
23061
23085
  this.countdownIntervalId = null;
23062
- this.recordingState = RECORDING_STATE_IDLE;
23063
23086
  this.countdownRemaining = 0;
23064
23087
  this.countdownStartTime = null;
23065
- this.callbacks.onCountdownUpdate(this.recordingState, this.countdownRemaining);
23066
23088
  }
23067
23089
  cleanup() {
23068
23090
  this.cancelCountdown();
@@ -23162,6 +23184,9 @@ class RecordingManager {
23162
23184
  this.callbacks.onError(errorMessage);
23163
23185
  }
23164
23186
  handleFatalProcessorError(error) {
23187
+ if (this.isFinalizingRecording) {
23188
+ return;
23189
+ }
23165
23190
  if (this.recordingState === RECORDING_STATE_RECORDING) {
23166
23191
  this.clearTimer(this.recordingIntervalId, clearInterval);
23167
23192
  this.recordingIntervalId = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vidtreo/recorder",
3
- "version": "1.7.6",
3
+ "version": "1.7.7",
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",