PrivatestreamingPrivatechunksPrivatetotalPrivatediskPrivatewritablePrivatesetupPrivateframePrivatependingPending disk write promises (File System Access API path). The ZIP chunk callback fires writes asynchronously; finalize() awaits them before close() to avoid racing close-with-pending-writes and to surface write failures the .catch handler trapped.
Private ReadonlyenvPrivate ReadonlylogStart the ZIP stream. Tries to obtain a disk handle from showSaveFilePicker; on failure or unavailability, falls back to in-memory accumulation. Always succeeds — disk failures are folded into in-memory mode, and a user-cancelled picker also falls back rather than aborting the whole capture.
Append a single frame to the ZIP. Frame names are zero-padded to
6 digits and use a private sequence counter that increments only
on successful adds, so the output sequence is always contiguous
(frame_000000, frame_000001, …) regardless of which source frame
indices the caller skipped or had errors on. The bundled ffmpeg
script in encode_video.sh assumes a contiguous sequence.
Whether a disk write has failed (caller may choose to abort the loop).
Total bytes streamed so far (used in toasts).
Finalize the ZIP stream. Behaviour:
Writes are awaited via Promise.allSettled so a late rejection
sets diskFailed and we can take the failure-toast path even if
the .catch handler hadn't yet flipped the flag at the time
end() returned.
Tear down a partial ZIP without delivering an artifact. Called by the panel when the offline session is aborted (disposed / cancelled / capture errored). Idempotent: safe to call after finalize, after abort, or on a never-set-up instance.
Output frame sequence counter. Increments after each successful addFrame so output names are contiguous even when source frames fail. See addFrame docstring for why this matters.