Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(local-recording) defend against out of order events

Saúl Ibarra Corretgé589baab2ae70
diff --git a/react/features/recording/components/Recording/LocalRecordingManager.web.ts b/react/features/recording/components/Recording/LocalRecordingManager.web.ts
index cf41b78571..6dcd01a8f4 100644
--- a/react/features/recording/components/Recording/LocalRecordingManager.web.ts
+++ b/react/features/recording/components/Recording/LocalRecordingManager.web.ts
@@ -10,6 +10,7 @@ import { isMobileBrowser } from '../../../base/environment/utils';
import { browser } from '../../../base/lib-jitsi-meet';
import { isEmbedded } from '../../../base/util/embedUtils';
import { stopLocalVideoRecording } from '../../actions.any';
+import logger from '../../logger';
interface ISelfRecording {
on: boolean;
@@ -251,7 +252,7 @@ const LocalRecordingManager: ILocalRecordingManager = {
});
this.recorder.addEventListener('dataavailable', async e => {
- if (e.data && e.data.size > 0) {
+ if (this.recorder && e.data && e.data.size > 0) {
let data = e.data;
if (!this.firstChunk) {
@@ -281,11 +282,13 @@ const LocalRecordingManager: ILocalRecordingManager = {
if (this.writableStream) {
try {
- await this.writableStream.seek(0);
- await this.writableStream.write(await fixDuration(this.firstChunk!, duration));
+ if (this.firstChunk) {
+ await this.writableStream.seek(0);
+ await this.writableStream.write(await fixDuration(this.firstChunk!, duration));
+ }
await this.writableStream.close();
- } catch (_) {
- // Ignored, not much we can do here.
+ } catch (e) {
+ logger.error('Error while writing to the local recording file', e);
} finally {
this.firstChunk = undefined;
this.fileHandle = undefined;
@@ -304,7 +307,7 @@ const LocalRecordingManager: ILocalRecordingManager = {
});
}
- this.recorder.start(1000);
+ this.recorder.start(5000);
},
/**