Records presenter microphone during a slideshow, supporting pause/resume and returns an audio blob.
// Source: https://github.com/genspark-ai/genoffice | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/** The presenter's microphone over a whole slide show: one continuous recording, pausable. */
export class NarrationRecorder {
private readonly chunks: Blob[] = []
private recordedMs = 0
private runningSince: number | null = null
private constructor(
private readonly stream: MediaStream,
private readonly recorder: MediaRecorder,
) {
recorder.ondataavailable = (e) => {
if (e.data.size > 0) this.chunks.push(e.data)
}
}
static async start(): Promise<NarrationRecorder> {
const stream = await navigator.mediaDevices.getUserMedia({
audio: {
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key