Spaces:
Running on Zero
Running on Zero
fix: guard voice recording until bootstrap
Browse filesCo-authored-by: Codex <noreply@openai.com>
- static/app.js +3 -1
static/app.js
CHANGED
|
@@ -52,6 +52,7 @@ let voiceStream = null;
|
|
| 52 |
let voiceChunks = [];
|
| 53 |
let voiceRecordingState = "idle";
|
| 54 |
|
|
|
|
| 55 |
bootstrap().catch(handleBootstrapError);
|
| 56 |
|
| 57 |
form.addEventListener("submit", async (event) => {
|
|
@@ -244,7 +245,7 @@ async function toggleVoiceRecording() {
|
|
| 244 |
}
|
| 245 |
|
| 246 |
async function startVoiceRecording() {
|
| 247 |
-
if (sessionControlsLocked || voiceBusy || voiceRecordingState !== "idle") return;
|
| 248 |
if (!navigator.mediaDevices?.getUserMedia || !window.MediaRecorder) {
|
| 249 |
setSessionStatus("Voice recording is not available in this browser. Upload a voice note instead.");
|
| 250 |
return;
|
|
@@ -394,6 +395,7 @@ async function bootstrap() {
|
|
| 394 |
renderProfile(session.profile);
|
| 395 |
renderRestoredSession(data);
|
| 396 |
renderWhitespace(data.whitespace || []);
|
|
|
|
| 397 |
}
|
| 398 |
|
| 399 |
function handleBootstrapError(error) {
|
|
|
|
| 52 |
let voiceChunks = [];
|
| 53 |
let voiceRecordingState = "idle";
|
| 54 |
|
| 55 |
+
setVoiceRecordingState("idle");
|
| 56 |
bootstrap().catch(handleBootstrapError);
|
| 57 |
|
| 58 |
form.addEventListener("submit", async (event) => {
|
|
|
|
| 245 |
}
|
| 246 |
|
| 247 |
async function startVoiceRecording() {
|
| 248 |
+
if (!bootstrapData || sessionControlsLocked || voiceBusy || voiceRecordingState !== "idle") return;
|
| 249 |
if (!navigator.mediaDevices?.getUserMedia || !window.MediaRecorder) {
|
| 250 |
setSessionStatus("Voice recording is not available in this browser. Upload a voice note instead.");
|
| 251 |
return;
|
|
|
|
| 395 |
renderProfile(session.profile);
|
| 396 |
renderRestoredSession(data);
|
| 397 |
renderWhitespace(data.whitespace || []);
|
| 398 |
+
setVoiceRecordingState("idle");
|
| 399 |
}
|
| 400 |
|
| 401 |
function handleBootstrapError(error) {
|