Allow reprocessing after video drop: skip audio/shots steps lacking media, limit reprocess dropdown to docs+; plus pending ext/report/ui changes

This commit is contained in:
Stefano Zini
2026-11-06 10:56:30 +01:00
parent d1d71ddafc
commit b80207a186
6 changed files with 36 additions and 23 deletions
+5 -3
View File
@@ -37,7 +37,9 @@ async function start(streamId, tabId) {
recordingName = "teams_" + new Date().toISOString().replace(/[:.]/g, "-").slice(0, 19);
// Tab capture stream: the chromeMediaSource constraint is the only way to get tab audio/video in an extension.
const captureConstraint = { mandatory: { chromeMediaSource: "tab", chromeMediaSourceId: streamId } };
tabStream = await navigator.mediaDevices.getUserMedia({ audio: captureConstraint, video: captureConstraint });
const videoConstraint = { mandatory: { ...captureConstraint.mandatory, maxFrameRate: 15 } }; // fewer fps = more bits per frame for slides/text
tabStream = await navigator.mediaDevices.getUserMedia({ audio: captureConstraint, video: videoConstraint });
for (const t of tabStream.getVideoTracks()) t.contentHint = "detail"; // favor sharpness over motion
// Mixer: tab audio + optional mic are mixed into one destination track.
audioContext = new AudioContext();
const dest = audioContext.createMediaStreamDestination();
@@ -51,8 +53,8 @@ async function start(streamId, tabId) {
} catch { micStream = null; }
// Output stream: tab video + mixed audio.
const outStream = new MediaStream([...tabStream.getVideoTracks(), ...dest.stream.getAudioTracks()]);
// VP8 video + Opus audio at 1 Mbps video, a format the server's ffmpeg pipeline accepts.
recorder = new MediaRecorder(outStream, { mimeType: "video/webm;codecs=vp8,opus", videoBitsPerSecond: 1e6 });
// VP8 video + Opus audio at 3 Mbps video (1 Mbps gave blocky/ringing text on shared screens).
recorder = new MediaRecorder(outStream, { mimeType: "video/webm;codecs=vp8,opus", videoBitsPerSecond: 3e6 });
// Each 10 s chunk is uploaded in order through the uploadQueue promise chain.
recorder.ondataavailable = event => {
// Chain the upload on uploadQueue so chunks reach the server in order; count success or failure, then flush events.