Add preparation state to VoiceRecorder component

This commit is contained in:
Thorsten Sommer 2026-01-18 20:49:17 +01:00
parent ce7a334fef
commit 78f69479a3
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 6 additions and 1 deletions

View File

@ -6,7 +6,7 @@
@if (PreviewFeatures.PRE_SPEECH_TO_TEXT_2026.IsEnabled(this.SettingsManager) && !string.IsNullOrWhiteSpace(this.SettingsManager.ConfigurationData.App.UseTranscriptionProvider)) @if (PreviewFeatures.PRE_SPEECH_TO_TEXT_2026.IsEnabled(this.SettingsManager) && !string.IsNullOrWhiteSpace(this.SettingsManager.ConfigurationData.App.UseTranscriptionProvider))
{ {
<MudTooltip Text="@this.Tooltip"> <MudTooltip Text="@this.Tooltip">
@if (this.isTranscribing) @if (this.isTranscribing || this.isPreparing)
{ {
<MudProgressCircular Size="Size.Small" Indeterminate="true" Color="Color.Primary"/> <MudProgressCircular Size="Size.Small" Indeterminate="true" Color="Color.Primary"/>
} }

View File

@ -41,6 +41,7 @@ public partial class VoiceRecorder : MSGComponentBase
private uint numReceivedChunks; private uint numReceivedChunks;
private bool isRecording; private bool isRecording;
private bool isPreparing;
private bool isTranscribing; private bool isTranscribing;
private FileStream? currentRecordingStream; private FileStream? currentRecordingStream;
private string? currentRecordingPath; private string? currentRecordingPath;
@ -58,6 +59,9 @@ public partial class VoiceRecorder : MSGComponentBase
{ {
if (toggled) if (toggled)
{ {
this.isPreparing = true;
this.StateHasChanged();
try try
{ {
// Warm up sound effects: // Warm up sound effects:
@ -94,6 +98,7 @@ public partial class VoiceRecorder : MSGComponentBase
this.currentRecordingMimeType = actualMimeType; this.currentRecordingMimeType = actualMimeType;
this.Logger.LogInformation("Audio recording started with MIME type: '{ActualMimeType}'.", actualMimeType); this.Logger.LogInformation("Audio recording started with MIME type: '{ActualMimeType}'.", actualMimeType);
this.isPreparing = false;
this.isRecording = true; this.isRecording = true;
} }
catch (Exception e) catch (Exception e)