Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
Skip the 200 MB size warning toast and banner when server-side chunk streaming is active, and warn at 80% of RECORDING_MAX_HOURS before the auto-stop (fixes #332)
Murtaza Nasir2ca4ab517e9c
diff --git a/static/js/app.modular.js b/static/js/app.modular.jsindex e25a88f8..b4e7812f 100644--- a/static/js/app.modular.js+++ b/static/js/app.modular.js@@ -528,6 +528,14 @@ document.addEventListener('DOMContentLoaded', async () => {const actualBitrate = ref(0);const maxRecordingMB = ref(200);const sizeCheckInterval = ref(null);+ // True while the CURRENT recording streams its chunks to the+ // server (#287 Phase B/C). Set by the audio composable when the+ // upload session actually opens — not from the feature flag —+ // because session creation can fail and fall back to local-only+ // RAM recording, where the size limit still applies. Gates the+ // size-limit warning UI, which is meaningless when streaming+ // (#332: there is no size cap in that mode, only an hours cap).+ const isServerStreamedRecording = ref(false);// Advanced Options for ASRconst showAdvancedOptions = ref(false);@@ -1639,7 +1647,7 @@ document.addEventListener('DOMContentLoaded', async () => {systemVisualizer, animationFrameId, recordingMode, activeStreams,wakeLock, recordingNotification, isPageVisible,estimatedFileSize, fileSizeWarningShown, recordingQuality, actualBitrate,- maxRecordingMB, sizeCheckInterval,+ maxRecordingMB, sizeCheckInterval, isServerStreamedRecording,// PWA FeaturesdeferredInstallPrompt, showInstallButton, isPWAInstalled,diff --git a/static/js/modules/composables/audio.js b/static/js/modules/composables/audio.jsindex 9a56764e..c67980da 100644--- a/static/js/modules/composables/audio.js+++ b/static/js/modules/composables/audio.js@@ -12,7 +12,7 @@ export function useAudio(state, utils) {isRecording, mediaRecorder, audioContext, analyser, micAnalyser, systemAnalyser,audioChunks, recordingTime, recordingInterval, recordingMode, audioBlobURL,estimatedFileSize, actualBitrate, recordingNotes, recordingQuality,- maxRecordingMB, fileSizeWarningShown, sizeCheckInterval, recordingDisclaimer,+ maxRecordingMB, fileSizeWarningShown, sizeCheckInterval, isServerStreamedRecording, recordingDisclaimer,showRecordingDisclaimerModal, pendingRecordingMode, currentView, showUploadModal, showSystemAudioHelp, disableAudioProcessing,recordSystemVideo, recordingVideoActive, videoRetentionEnabled,selectedMicDeviceId, selectedSecondaryDeviceId,@@ -78,6 +78,7 @@ export function useAudio(state, utils) {serverSessionId = null;serverSessionUploader = null;serverSessionLastError = null;+ if (isServerStreamedRecording) isServerStreamedRecording.value = false;}// Pick the best MediaRecorder container for the capture. Video captures@@ -739,6 +740,10 @@ export function useAudio(state, utils) {}},});+ // Mirror the streaming state into a ref so the recording+ // view can hide the size-limit warning UI (#332), which+ // only applies to the in-RAM legacy path.+ if (isServerStreamedRecording) isServerStreamedRecording.value = true;} catch (e) {serverSessionLastError = e;console.warn('[Recording] Could not open server session; falling back to local-only:', e);@@ -813,8 +818,24 @@ export function useAudio(state, utils) {const appEl = document.getElementById('app');const maxHoursAttr = appEl?.dataset?.recordingMaxHours;const recordingMaxSeconds = Math.max(60, parseFloat(maxHoursAttr || '8') * 3600);+ // Warn once at 80% of the ceiling (matching the size warning's+ // threshold convention) so a long recording never just cuts off+ // by surprise. `>=` plus a flag, not `===`: a recovered/resumed+ // recording restores recordingTime past the mark in one jump and+ // then gets the warning on its first tick.+ let durationWarningShown = false;recordingInterval.value = setInterval(() => {recordingTime.value++;+ if (!durationWarningShown && recordingTime.value >= recordingMaxSeconds * 0.8) {+ durationWarningShown = true;+ const minutesLeft = Math.max(1, Math.round((recordingMaxSeconds - recordingTime.value) / 60));+ showToast(+ (utils.t && utils.t('toasts.recordingMaxDurationApproaching', { minutes: minutesLeft }))+ || `Recording will stop automatically in about ${minutesLeft} minutes (maximum duration reached).`,+ 'fa-exclamation-triangle',+ 7000+ );+ }if (recordingTime.value >= recordingMaxSeconds) {stopRecording();showToast(@@ -1373,15 +1394,22 @@ export function useAudio(state, utils) {actualBitrate.value = (totalSize * 8) / recordingTime.value;}- // Phase C of #287 (c)(d): the 200 MB cap used to be a hard auto-stop- // because the entire blob was held in browser RAM and would crash- // the tab past a certain size. When server-side chunk streaming is- // active that constraint goes away — chunks flush to the server as- // they are produced. We still surface a soft warning at the same- // threshold so users know they are recording a large file, but the- // hard auto-stop is replaced by an absolute hours-based ceiling- // (`RECORDING_MAX_HOURS`, default 8) so a runaway recording from a- // misclick still has a backstop.+ // Phase C of #287 (c)(d): the 200 MB cap exists because on the legacy+ // path the entire blob is held in browser RAM and would crash the tab+ // past a certain size. When server-side chunk streaming is active that+ // constraint goes away — chunks flush to the server as they are+ // produced, so NO size-based warning or stop applies (#332: warning+ // users about a limit that does not exist was alarming them). The+ // ceiling in streaming mode is hours-based (`RECORDING_MAX_HOURS`,+ // default 8, warned about and enforced in the recording-time tick) so+ // a runaway recording from a misclick still has a backstop.+ if (serverSessionUploader) {+ return;+ }++ // Legacy single-shot path: soft-warn at 80% of the cap, then hard+ // auto-stop at the cap so the in-memory blob does not run the tab+ // out of RAM.const sizeMB = totalSize / (1024 * 1024);const warningThresholdMB = maxRecordingMB.value * 0.8;@@ -1395,14 +1423,6 @@ export function useAudio(state, utils) {);}- // Server-streaming path: no client-side hard size cap. The absolute- // ceiling is hours-based and lives in the recording-time tick below.- if (serverSessionUploader) {- return;- }-- // Legacy single-shot path: keep the hard auto-stop at the configured- // size so the in-memory blob does not run the tab out of RAM.if (sizeMB > maxRecordingMB.value) {stopRecording();showToast(diff --git a/static/locales/de.json b/static/locales/de.jsonindex bd7c561a..c613498a 100644--- a/static/locales/de.json+++ b/static/locales/de.json@@ -1773,6 +1773,7 @@"processingCompleted": "Verarbeitung abgeschlossen!","processingFailed": "Verarbeitung fehlgeschlagen","recordingFinalized": "Aufnahme zur Verarbeitung hochgeladen",+ "recordingMaxDurationApproaching": "Die Aufnahme wird in etwa {{minutes}} Minuten automatisch gestoppt (Höchstdauer).","recordingMaxDurationReached": "Aufnahme hat die Höchstdauer erreicht und wurde automatisch gestoppt.","recordingResumeFound": "Eine laufende Aufnahme aus diesem Browser wurde auf dem Server gefunden. Fortsetzen?","recordingSizeSoftWarning": "Aufnahme ist {{size}}. Erwägen Sie, sie bei Gelegenheit zu stoppen.",diff --git a/static/locales/en.json b/static/locales/en.jsonindex 051daa12..d8522ac5 100644--- a/static/locales/en.json+++ b/static/locales/en.json@@ -1773,6 +1773,7 @@"processingCompleted": "Processing completed!","processingFailed": "Processing failed","recordingFinalized": "Recording uploaded for processing",+ "recordingMaxDurationApproaching": "Recording will stop automatically in about {{minutes}} minutes (maximum duration).","recordingMaxDurationReached": "Recording reached the maximum duration and was stopped automatically.","recordingResumeFound": "An in-progress recording from this browser was detected on the server. Resume?","recordingSizeSoftWarning": "Recording is {{size}}. Consider stopping when convenient.",diff --git a/static/locales/es.json b/static/locales/es.jsonindex 12f1bdcc..8328e3af 100644--- a/static/locales/es.json+++ b/static/locales/es.json@@ -1773,6 +1773,7 @@"processingCompleted": "¡Procesamiento completado!","processingFailed": "Error en el procesamiento","recordingFinalized": "Grabación subida para procesamiento",+ "recordingMaxDurationApproaching": "La grabación se detendrá automáticamente en unos {{minutes}} minutos (duración máxima).","recordingMaxDurationReached": "La grabación alcanzó la duración máxima y se detuvo automáticamente.","recordingResumeFound": "Se detectó una grabación en curso de este navegador en el servidor. ¿Reanudar?","recordingSizeSoftWarning": "La grabación ocupa {{size}}. Considere detenerla cuando le convenga.",diff --git a/static/locales/fr.json b/static/locales/fr.jsonindex 4e43b496..965ea3b8 100644--- a/static/locales/fr.json+++ b/static/locales/fr.json@@ -1773,6 +1773,7 @@"processingCompleted": "Traitement terminé !","processingFailed": "Échec du traitement","recordingFinalized": "Enregistrement envoyé pour traitement",+ "recordingMaxDurationApproaching": "L'enregistrement s'arrêtera automatiquement dans environ {{minutes}} minutes (durée maximale).","recordingMaxDurationReached": "L'enregistrement a atteint la durée maximale et s'est arrêté automatiquement.","recordingResumeFound": "Un enregistrement en cours dans ce navigateur a été détecté sur le serveur. Reprendre ?","recordingSizeSoftWarning": "L'enregistrement fait {{size}}. Pensez à l'arrêter quand vous pourrez.",diff --git a/static/locales/pt-BR.json b/static/locales/pt-BR.jsonindex 19c884ec..664370eb 100644--- a/static/locales/pt-BR.json+++ b/static/locales/pt-BR.json@@ -1773,6 +1773,7 @@"processingCompleted": "Processamento concluído!","processingFailed": "Falha no processamento","recordingFinalized": "Gravação enviada para processamento",+ "recordingMaxDurationApproaching": "A gravação será interrompida automaticamente em cerca de {{minutes}} minutos (duração máxima).","recordingMaxDurationReached": "A gravação atingiu a duração máxima e foi parada automaticamente.","recordingResumeFound": "Uma gravação em andamento deste navegador foi detectada no servidor. Retomar?","recordingSizeSoftWarning": "A gravação tem {{size}}. Considere parar quando for conveniente.",diff --git a/static/locales/ru.json b/static/locales/ru.jsonindex c1ca661b..3a01147c 100644--- a/static/locales/ru.json+++ b/static/locales/ru.json@@ -1773,6 +1773,7 @@"processingCompleted": "Обработка завершена!","processingFailed": "Обработка не удалась","recordingFinalized": "Запись отправлена на обработку",+ "recordingMaxDurationApproaching": "Запись будет автоматически остановлена примерно через {{minutes}} минут (максимальная длительность).","recordingMaxDurationReached": "Запись достигла максимальной длительности и была остановлена автоматически.","recordingResumeFound": "На сервере обнаружена незавершённая запись из этого браузера. Возобновить?","recordingSizeSoftWarning": "Размер записи {{size}}. Подумайте об остановке при удобном случае.",diff --git a/static/locales/zh.json b/static/locales/zh.jsonindex 2c32629d..c06636a0 100644--- a/static/locales/zh.json+++ b/static/locales/zh.json@@ -1773,6 +1773,7 @@"processingCompleted": "处理完成!","processingFailed": "处理失败","recordingFinalized": "录音已上传等待处理",+ "recordingMaxDurationApproaching": "录音将在约 {{minutes}} 分钟后自动停止(已接近最长时长)。","recordingMaxDurationReached": "录音已达到最长时长,已自动停止。","recordingResumeFound": "在服务器上检测到此浏览器的未完成录音。是否继续?","recordingSizeSoftWarning": "录音大小为 {{size}},可在方便时停止。",diff --git a/templates/components/recording-view.html b/templates/components/recording-view.htmlindex c2b9ac4b..a83dd647 100644--- a/templates/components/recording-view.html+++ b/templates/components/recording-view.html@@ -65,8 +65,11 @@(${Math.round(actualBitrate / 1000)}kbps)</span></p>- <!-- Size warning indicator -->- <div v-if="estimatedFileSize > (maxRecordingMB * 1024 * 1024 * 0.8)" class="mt-0.5">+ <!-- Size warning indicator. Only meaningful on the legacy+ in-RAM path: with server-side chunk streaming there is+ no size limit (only an hours ceiling), so showing an+ "approaching limit" banner would be wrong (#332). -->+ <div v-if="!isServerStreamedRecording && estimatedFileSize > (maxRecordingMB * 1024 * 1024 * 0.8)" class="mt-0.5"><div class="flex items-center text-xs text-amber-600 dark:text-amber-400"><i class="fas fa-exclamation-triangle mr-1"></i><span v-text="t('help.approachingLimit', { limit: maxRecordingMB })"></span>