Skip to content

fix: third getUserMedia contention source still truncating webcam recordings - #19

Merged
Alfredoalv13 merged 1 commit into
mainfrom
fix/video-devices-permission-probe-contention
Jul 25, 2026
Merged

fix: third getUserMedia contention source still truncating webcam recordings#19
Alfredoalv13 merged 1 commit into
mainfrom
fix/video-devices-permission-probe-contention

Conversation

@Alfredoalv13

Copy link
Copy Markdown
Owner

Summary

Live-inspected a real recorded session after PR #18 merged: webcam file was still only 0.4s long against a 30.3s screen recording - the truncation bug PR #18 targeted was not actually resolved.

Found a third, independent getUserMedia() call site PR #18 didn't cover: useVideoDevices opens its own temporary camera stream purely to read device labels (Chromium hides labels until some getUserMedia grant exists this session). It's gated by enabled=(webcamEnabled || openId==="webcam"), and webcamEnabled stays true for the entire duration of a webcam-enabled recording - so if this hook's one-time label fetch happens to land at/after recording start instead of before it, its independent stream contends with useScreenRecorder's own concurrent session on the same physical camera. Same failure mode PR #18 diagnosed, different source.

Fix: skip the label-probing getUserMedia() call entirely while a recording is already in progress (LaunchWindow.tsx now passes !recording through). Device labels aren't needed mid-recording.

Test plan

  • tsc --noEmit clean
  • npm test - 94/94 files, 819/819 tests passing
  • Manual: record with camera enabled for 15-30s, confirm the resulting webcam file plays back its full duration in the editor (not frozen/looping near the start)

I'm not 100% certain this is the only remaining contention source - flagging that directly rather than overclaiming, given this is the third attempt at this same bug.

…camera

Confirmed with live inspection of a real recorded session: the webcam file
was still truncating to a fraction of a second (0.4s against a 30.3s screen
recording) even after PR #18's stream-sharing fix between the floating
preview and the actual recording.

Found a third, independent getUserMedia() call PR #18 didn't cover:
useVideoDevices opens its own temporary camera stream just to read device
labels (Chromium hides labels until some getUserMedia grant exists this
session), gated only by enabled=(webcamEnabled || openId==="webcam") and a
module-level "have we done this once" flag. webcamEnabled stays true for
the entire duration of a webcam-enabled recording, so if this hook's first
label-fetch happens to land at/after recording start rather than before it,
its independent stream request contends with useScreenRecorder's own
concurrent session on the same physical camera - the exact failure mode
PR #18 already diagnosed, just from a source it didn't know about.

Device labels aren't needed while a recording is already in progress, so
the fix is to skip the probe entirely during an active recording rather
than have it compete for the camera.
@Alfredoalv13
Alfredoalv13 merged commit 4e2dd04 into main Jul 25, 2026
1 check passed
@Alfredoalv13
Alfredoalv13 deleted the fix/video-devices-permission-probe-contention branch July 25, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants