TT-6917 force the chosen device to be used (was a preference before) - #555
Open
sarahentzel wants to merge 3 commits into
Open
TT-6917 force the chosen device to be used (was a preference before)#555sarahentzel wants to merge 3 commits into
sarahentzel wants to merge 3 commits into
Conversation
# Conflicts: # src/renderer/public/localization/strings6254aa94.json # src/renderer/src/store/localization/model.tsx # src/renderer/src/store/localization/reducers.tsx
sarahentzel
marked this pull request as ready for review
August 28, 2026 21:22
gtryus
approved these changes
Aug 28, 2026
gtryus
left a comment
Contributor
There was a problem hiding this comment.
I made a comment on a potential improvement but it isn't required...
|
|
||
| function delay(ms: number): Promise<void> { | ||
| return new Promise((resolve) => setTimeout(resolve, ms)); | ||
| } |
Contributor
There was a problem hiding this comment.
The delay function (sometimes called sleep) may belong in our general utils folder?
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the renderer’s audio-capture pipeline to more reliably honor the user-selected microphone (by requesting the device as an exact constraint), and adds handling for device-disconnect scenarios during recording.
Changes:
- Enforce selected microphone usage by building capture constraints with
deviceId: { exact: ... }and centralizing this logic in a newcaptureConstraintsutility. - Add capture recovery helpers (unusable-stream detection, device-loss detection, retry/fallback wrapper around
getUserMedia) and integrate them intouseUserMedia/useWavRecorder. - Add a new localized warning string and surface it in
WSAudioPlayerwhen a device-loss error is reported.
Reviewed changes
Copilot reviewed 10 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/renderer/src/store/localization/reducers.tsx | Adds new wsAudioPlayer.microphoneDisconnected string to the in-app localization defaults. |
| src/renderer/src/store/localization/model.tsx | Extends IWsAudioPlayerStrings with microphoneDisconnected. |
| src/renderer/src/store/localization/exported-strings-name.json | Updates exported strings bundle filename reference. |
| src/renderer/src/crud/useWavRecorder.tsx | Uses shared capture-constraint utilities; improves robustness when streams/tracks are gone; flags device-loss errors to the UI. |
| src/renderer/src/crud/useUserMedia.tsx | Wraps getUserMedia with retry/fallback logic and avoids reusing unusable streams. |
| src/renderer/src/crud/captureConstraints.ts | New shared helper for building constraints, detecting device-loss/unusable streams, and retrying getUserMedia. |
| src/renderer/src/crud/captureConstraints.test.ts | Adds unit tests covering exact-device constraints, device-loss detection, unusable-stream detection, and fallback behavior. |
| src/renderer/src/components/WSAudioPlayer.tsx | Shows a localized warning when recording fails with deviceLost. |
| localization/TranscriberAdmin-en.xlf | Adds the new string unit for translation. |
| localization/TranscriberAdmin-en-1.2.xliff | Adds the new string unit for translation (xliff variant). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+102
to
+106
| const retryConstraints = requestedExactDeviceId(constraints) | ||
| ? constraintsWithoutDeviceId(constraints) | ||
| : constraints; | ||
| if (isDeviceLossError(error)) { | ||
| await wait(CAPTURE_DEVICE_LOSS_RETRY_MS); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.