Skip to content

Commit ff28920

Browse files
committed
browser-emulator: implement stopping full screen recording on dockerized browsers
1 parent e100539 commit ff28920

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

browser-emulator/src/services/selenium.service.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export class SeleniumService {
3535
private readonly scriptRunnerService: ScriptRunnerService;
3636

3737
private recordingScript: ChildProcess | undefined;
38+
private recordingDockerContainerId: string | undefined;
3839
private isRecordingFullScreen = false;
3940

4041
private readonly dockerizedSessionContainers = new Map<string, string>();
@@ -450,7 +451,8 @@ export class SeleniumService {
450451
Env: [`FILE_NAME=session_${dateNow}.mp4`],
451452
};
452453

453-
await this.dockerService.startContainer(createOptions);
454+
this.recordingDockerContainerId =
455+
await this.dockerService.startContainer(createOptions);
454456
} else {
455457
const ffmpegCommand = [
456458
'ffmpeg -hide_banner -loglevel warning -nostdin -y',
@@ -484,5 +486,11 @@ export class SeleniumService {
484486
console.log('Stopping full screen recording');
485487
await this.scriptRunnerService.killDetached(this.recordingScript);
486488
}
489+
if (this.recordingDockerContainerId) {
490+
console.log('Stopping full screen recording container');
491+
await this.dockerService.removeContainer(
492+
this.recordingDockerContainerId,
493+
);
494+
}
487495
}
488496
}

0 commit comments

Comments
 (0)