stop method
Last updated: 2026-03-05T10:53:28.864Z
Metrics
LOC: 27
Complexity: 5
Params: 0
Signature
stop()
Source Code
async stop() {
if (state !== "recording" || !recorder || !stream) {
return new Blob([], { type: "video/webm" });
}
state = "stopping";
return new Promise<Blob>((resolve) => {
recorder!.onstop = () => {
const blob = new Blob(chunks, {
type: recorder!.mimeType || "video/webm",
});
log.info(`Recording stopped — ${(blob.size / 1024).toFixed(1)} KB`);
// Release tracks
stream!.getTracks().forEach((t) => t.stop());
stream = null;
recorder = null;
chunks = [];
state = "inactive";
resolve(blob);
};
recorder!.stop();
});
},
No outgoing dependencies.
No incoming dependencies.