Skip to content

The free and privacy-friendly screen recorder with no limits 🎥

WebCodecs reclaim recovery, faster finalize + editor open, TUS upload reliability

Alyssa X631d1c883276
diff --git a/package.json b/package.json
index 90a68a4..bb5767d 100755
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "screenity",
- "version": "4.4.9",
+ "version": "4.4.10",
"description": "The free and privacy-friendly screen recorder with no sign in needed.",
"scripts": {
"build": "cross-env NODE_ENV=production node utils/build.js",
@@ -30,7 +30,8 @@
"build:content-css": "sass src/pages/Content/styles/app.scss src/pages/Content/styles/app.css --no-source-map",
"check:i18n": "node scripts/check-i18n.mjs",
"verify:zip": "node scripts/verify-no-secrets.mjs",
- "release": "node scripts/release.mjs"
+ "release": "node scripts/release.mjs",
+ "test:unit": "node --test tests/unit/*.test.mjs"
},
"dependencies": {
"@babel/plugin-transform-react-jsx": "^7.27.1",
diff --git a/src/_locales/ca/messages.json b/src/_locales/ca/messages.json
index dd8153f..ccc52e4 100644
--- a/src/_locales/ca/messages.json
+++ b/src/_locales/ca/messages.json
@@ -1666,5 +1666,29 @@
},
"recordingCorruptToast": {
"message": "Aquesta gravació no es pot reproduir. El fitxer pot estar incomplet o malmès. Descarrega el fitxer original des del menú Desar."
+ },
+ "storageFullRecordingError": {
+ "message": "No hi ha prou espai d'emmagatzematge per enregistrar. Allibera espai al disc i torna-ho a provar.",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "L'emmagatzematge del teu navegador està gairebé ple. Allibera espai al disc per no perdre aquest enregistrament.",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "No s'ha pogut accedir a la pantalla. Torna a iniciar l'enregistrament.",
+ "description": "Shown when the screen capture stream is missing after the user picked a source"
+ },
+ "tabStreamUnavailableError": {
+ "message": "No s'ha pogut accedir al vídeo d'aquesta pestanya. Torna a carregar-la i torna-ho a provar.",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "L'enregistrament no s'ha iniciat a temps. Torna-ho a provar.",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "El teu navegador no admet els còdecs de vídeo necessaris. Actualitza Chrome i torna-ho a provar.",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
}
}
diff --git a/src/_locales/de/messages.json b/src/_locales/de/messages.json
index eaef8c7..6b322de 100644
--- a/src/_locales/de/messages.json
+++ b/src/_locales/de/messages.json
@@ -1666,5 +1666,29 @@
},
"recordingCorruptToast": {
"message": "Diese Aufnahme kann nicht abgespielt werden. Die Datei ist möglicherweise unvollständig oder beschädigt. Versuchen Sie, die Rohdatei über das Speichern-Menü herunterzuladen."
+ },
+ "storageFullRecordingError": {
+ "message": "Nicht genügend Speicher für die Aufnahme. Gib Speicherplatz frei und versuche es erneut.",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "Der Speicher deines Browsers ist fast voll. Gib Speicherplatz frei, damit diese Aufnahme nicht verloren geht.",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "Auf den Bildschirm konnte nicht zugegriffen werden. Starte die Aufnahme erneut.",
+ "description": "Shown when the screen capture stream is missing after the user picked a source"
+ },
+ "tabStreamUnavailableError": {
+ "message": "Auf das Video dieses Tabs konnte nicht zugegriffen werden. Lade den Tab neu und versuche es erneut.",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "Die Aufnahme konnte nicht rechtzeitig gestartet werden. Bitte versuche es erneut.",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "Dein Browser unterstützt die benötigten Video-Codecs nicht. Aktualisiere Chrome und versuche es erneut.",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
}
}
diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json
index 85f85b2..2c98490 100644
--- a/src/_locales/en/messages.json
+++ b/src/_locales/en/messages.json
@@ -1521,6 +1521,30 @@
"message": "Fast MP4 failed — off",
"description": "WebCodecs failure auto-disable toast"
},
+ "storageFullRecordingError": {
+ "message": "Not enough storage to record. Free up disk space and try again.",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "Your browser storage is almost full. Free up disk space to keep this recording safe.",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "Failed to access the screen stream. Try starting the recording again.",
+ "description": "Shown when the screen capture stream is missing or can't be accessed (no streamId returned, getDisplayMedia threw, etc.)"
+ },
+ "tabStreamUnavailableError": {
+ "message": "Couldn't access this tab's video. Reload the tab and try again.",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "Recording didn't start in time. Please try again.",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "Your browser doesn't support the required video codecs. Update Chrome and try again.",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
+ },
"proOnboardingWelcomeTitle": {
"message": "Welcome to the Screenity Pro extension",
"description": "Pro onboarding welcome step title"
diff --git a/src/_locales/es/messages.json b/src/_locales/es/messages.json
index f4f8d04..9817241 100644
--- a/src/_locales/es/messages.json
+++ b/src/_locales/es/messages.json
@@ -1666,5 +1666,29 @@
},
"recordingCorruptToast": {
"message": "Esta grabación no se puede reproducir. El archivo puede estar incompleto o dañado. Descarga el archivo original desde el menú Guardar."
+ },
+ "storageFullRecordingError": {
+ "message": "No hay suficiente espacio para grabar. Libera espacio en el disco e inténtalo de nuevo.",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "El almacenamiento de tu navegador está casi lleno. Libera espacio en el disco para no perder esta grabación.",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "No se pudo acceder a la pantalla. Vuelve a iniciar la grabación.",
+ "description": "Shown when the screen capture stream is missing after the user picked a source"
+ },
+ "tabStreamUnavailableError": {
+ "message": "No se pudo acceder al vídeo de esta pestaña. Recárgala e inténtalo de nuevo.",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "La grabación no se inició a tiempo. Inténtalo de nuevo.",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "Tu navegador no admite los códecs de vídeo necesarios. Actualiza Chrome e inténtalo de nuevo.",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
}
}
diff --git a/src/_locales/fr/messages.json b/src/_locales/fr/messages.json
index caf88c9..01283c6 100644
--- a/src/_locales/fr/messages.json
+++ b/src/_locales/fr/messages.json
@@ -1666,5 +1666,29 @@
},
"recordingCorruptToast": {
"message": "Cet enregistrement ne peut pas être lu. Le fichier est peut-être incomplet ou corrompu. Téléchargez le fichier brut depuis le menu Enregistrer."
+ },
+ "storageFullRecordingError": {
+ "message": "Espace de stockage insuffisant pour enregistrer. Libérez de l'espace disque et réessayez.",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "Le stockage de votre navigateur est presque plein. Libérez de l'espace disque pour ne pas perdre cet enregistrement.",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "Impossible d'accéder à l'écran. Relancez l'enregistrement.",
+ "description": "Shown when the screen capture stream is missing after the user picked a source"
+ },
+ "tabStreamUnavailableError": {
+ "message": "Impossible d'accéder à la vidéo de cet onglet. Rechargez l'onglet et réessayez.",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "L'enregistrement n'a pas démarré à temps. Veuillez réessayer.",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "Votre navigateur ne prend pas en charge les codecs vidéo requis. Mettez Chrome à jour et réessayez.",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
}
}
diff --git a/src/_locales/hi/messages.json b/src/_locales/hi/messages.json
index 49a9ed1..a63a99b 100644
--- a/src/_locales/hi/messages.json
+++ b/src/_locales/hi/messages.json
@@ -1666,5 +1666,29 @@
},
"recordingCorruptToast": {
"message": "यह रिकॉर्डिंग प्ले नहीं की जा सकती। फ़ाइल अधूरी या ख़राब हो सकती है। सेव मेनू से रॉ फ़ाइल डाउनलोड करने का प्रयास करें।"
+ },
+ "storageFullRecordingError": {
+ "message": "रिकॉर्ड करने के लिए पर्याप्त स्टोरेज नहीं है। डिस्क पर जगह खाली करें और फिर से कोशिश करें।",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "आपके ब्राउज़र का स्टोरेज लगभग भर गया है। इस रिकॉर्डिंग को सुरक्षित रखने के लिए डिस्क पर जगह खाली करें।",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "स्क्रीन तक पहुंचा नहीं जा सका। रिकॉर्डिंग फिर से शुरू करें।",
+ "description": "Shown when the screen capture stream is missing after the user picked a source"
+ },
+ "tabStreamUnavailableError": {
+ "message": "इस टैब के वीडियो तक पहुंचा नहीं जा सका। टैब को फिर से लोड करें और फिर से कोशिश करें।",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "रिकॉर्डिंग समय पर शुरू नहीं हुई। कृपया फिर से कोशिश करें।",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "आपका ब्राउज़र ज़रूरी वीडियो कोडेक्स का समर्थन नहीं करता। Chrome को अपडेट करें और फिर से कोशिश करें।",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
}
}
diff --git a/src/_locales/id/messages.json b/src/_locales/id/messages.json
index b3f53b6..0c7684a 100644
--- a/src/_locales/id/messages.json
+++ b/src/_locales/id/messages.json
@@ -1666,5 +1666,29 @@
},
"recordingCorruptToast": {
"message": "Rekaman ini tidak dapat diputar. File mungkin tidak lengkap atau rusak. Coba unduh file mentah dari menu Simpan."
+ },
+ "storageFullRecordingError": {
+ "message": "Penyimpanan tidak cukup untuk merekam. Kosongkan ruang disk lalu coba lagi.",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "Penyimpanan browser Anda hampir penuh. Kosongkan ruang disk agar rekaman ini tetap aman.",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "Tidak dapat mengakses layar. Mulai perekaman lagi.",
+ "description": "Shown when the screen capture stream is missing after the user picked a source"
+ },
+ "tabStreamUnavailableError": {
+ "message": "Tidak dapat mengakses video tab ini. Muat ulang tab lalu coba lagi.",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "Perekaman tidak dimulai tepat waktu. Silakan coba lagi.",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "Browser Anda tidak mendukung codec video yang diperlukan. Perbarui Chrome lalu coba lagi.",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
}
}
diff --git a/src/_locales/it/messages.json b/src/_locales/it/messages.json
index 8a9c94a..bfed528 100644
--- a/src/_locales/it/messages.json
+++ b/src/_locales/it/messages.json
@@ -1661,5 +1661,29 @@
},
"overLimitModalLearnMore": {
"message": "Scopri di più sull'elaborazione di video lunghi."
+ },
+ "storageFullRecordingError": {
+ "message": "Spazio di archiviazione insufficiente per registrare. Libera spazio sul disco e riprova.",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "L'archiviazione del tuo browser è quasi piena. Libera spazio sul disco per non perdere questa registrazione.",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "Impossibile accedere allo schermo. Avvia di nuovo la registrazione.",
+ "description": "Shown when the screen capture stream is missing after the user picked a source"
+ },
+ "tabStreamUnavailableError": {
+ "message": "Impossibile accedere al video di questa scheda. Ricarica la scheda e riprova.",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "La registrazione non è partita in tempo. Riprova.",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "Il tuo browser non supporta i codec video richiesti. Aggiorna Chrome e riprova.",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
}
}
diff --git a/src/_locales/ko/messages.json b/src/_locales/ko/messages.json
index f42bde2..e0a4c08 100644
--- a/src/_locales/ko/messages.json
+++ b/src/_locales/ko/messages.json
@@ -1666,5 +1666,29 @@
},
"recordingCorruptToast": {
"message": "이 녹화는 재생할 수 없습니다. 파일이 불완전하거나 손상되었을 수 있습니다. 저장 메뉴에서 원본 파일을 다운로드해 보세요."
+ },
+ "storageFullRecordingError": {
+ "message": "녹화할 저장 공간이 부족해요. 디스크 공간을 비우고 다시 시도해 주세요.",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "브라우저 저장 공간이 거의 가득 찼어요. 이 녹화를 안전하게 보관하려면 디스크 공간을 비워주세요.",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "화면에 접근하지 못했어요. 녹화를 다시 시작해 주세요.",
+ "description": "Shown when the screen capture stream is missing after the user picked a source"
+ },
+ "tabStreamUnavailableError": {
+ "message": "이 탭의 영상에 접근하지 못했어요. 탭을 새로고침하고 다시 시도해 주세요.",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "녹화가 제때 시작되지 않았어요. 다시 시도해 주세요.",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "브라우저가 필요한 비디오 코덱을 지원하지 않아요. Chrome을 업데이트하고 다시 시도해 주세요.",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
}
}
diff --git a/src/_locales/pl/messages.json b/src/_locales/pl/messages.json
index 02d7208..6d89c1d 100644
--- a/src/_locales/pl/messages.json
+++ b/src/_locales/pl/messages.json
@@ -1666,5 +1666,29 @@
},
"recordingCorruptToast": {
"message": "Tego nagrania nie można odtworzyć. Plik może być niekompletny lub uszkodzony. Spróbuj pobrać surowy plik z menu Zapisz."
+ },
+ "storageFullRecordingError": {
+ "message": "Za mało miejsca, aby nagrywać. Zwolnij miejsce na dysku i spróbuj ponownie.",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "Pamięć przeglądarki jest prawie pełna. Zwolnij miejsce na dysku, aby nie utracić tego nagrania.",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "Nie udało się uzyskać dostępu do ekranu. Spróbuj rozpocząć nagrywanie ponownie.",
+ "description": "Shown when the screen capture stream is missing after the user picked a source"
+ },
+ "tabStreamUnavailableError": {
+ "message": "Nie udało się uzyskać dostępu do wideo tej karty. Odśwież kartę i spróbuj ponownie.",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "Nagrywanie nie rozpoczęło się na czas. Spróbuj ponownie.",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "Twoja przeglądarka nie obsługuje wymaganych kodeków wideo. Zaktualizuj Chrome i spróbuj ponownie.",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
}
}
diff --git a/src/_locales/pt_BR/messages.json b/src/_locales/pt_BR/messages.json
index e7f00fd..169e36e 100644
--- a/src/_locales/pt_BR/messages.json
+++ b/src/_locales/pt_BR/messages.json
@@ -1666,5 +1666,29 @@
},
"recordingCorruptToast": {
"message": "Esta gravação não pode ser reproduzida. O arquivo pode estar incompleto ou corrompido. Baixe o arquivo original pelo menu Salvar."
+ },
+ "storageFullRecordingError": {
+ "message": "Não há espaço suficiente para gravar. Libere espaço no disco e tente novamente.",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "O armazenamento do seu navegador está quase cheio. Libere espaço no disco para não perder esta gravação.",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "Não foi possível acessar a tela. Inicie a gravação novamente.",
+ "description": "Shown when the screen capture stream is missing after the user picked a source"
+ },
+ "tabStreamUnavailableError": {
+ "message": "Não foi possível acessar o vídeo desta aba. Recarregue a aba e tente novamente.",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "A gravação não começou a tempo. Tente novamente.",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "Seu navegador não suporta os codecs de vídeo necessários. Atualize o Chrome e tente novamente.",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
}
}
diff --git a/src/_locales/pt_PT/messages.json b/src/_locales/pt_PT/messages.json
index 15b92d2..c79ad5d 100644
--- a/src/_locales/pt_PT/messages.json
+++ b/src/_locales/pt_PT/messages.json
@@ -1666,5 +1666,29 @@
},
"recordingCorruptToast": {
"message": "Esta gravação não pode ser reproduzida. O ficheiro pode estar incompleto ou corrompido. Transfere o ficheiro original a partir do menu Guardar."
+ },
+ "storageFullRecordingError": {
+ "message": "Não há espaço suficiente para gravar. Liberta espaço no disco e tenta novamente.",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "O armazenamento do teu navegador está quase cheio. Liberta espaço no disco para não perderes esta gravação.",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "Não foi possível aceder ao ecrã. Inicia a gravação novamente.",
+ "description": "Shown when the screen capture stream is missing after the user picked a source"
+ },
+ "tabStreamUnavailableError": {
+ "message": "Não foi possível aceder ao vídeo deste separador. Recarrega-o e tenta novamente.",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "A gravação não começou a tempo. Tenta novamente.",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "O teu navegador não suporta os codecs de vídeo necessários. Atualiza o Chrome e tenta novamente.",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
}
}
diff --git a/src/_locales/ru/messages.json b/src/_locales/ru/messages.json
index 0ca44ec..78d7346 100644
--- a/src/_locales/ru/messages.json
+++ b/src/_locales/ru/messages.json
@@ -1666,5 +1666,29 @@
},
"recordingCorruptToast": {
"message": "Эту запись невозможно воспроизвести. Возможно, файл повреждён или неполный. Попробуйте скачать исходный файл через меню Сохранить."
+ },
+ "storageFullRecordingError": {
+ "message": "Недостаточно места для записи. Освободите место на диске и попробуйте снова.",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "Хранилище браузера почти заполнено. Освободите место на диске, чтобы не потерять эту запись.",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "Не удалось получить доступ к экрану. Запустите запись снова.",
+ "description": "Shown when the screen capture stream is missing after the user picked a source"
+ },
+ "tabStreamUnavailableError": {
+ "message": "Не удалось получить доступ к видео этой вкладки. Перезагрузите вкладку и попробуйте снова.",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "Запись не началась вовремя. Попробуйте снова.",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "Ваш браузер не поддерживает необходимые видеокодеки. Обновите Chrome и попробуйте снова.",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
}
}
diff --git a/src/_locales/ta/messages.json b/src/_locales/ta/messages.json
index 6da60ec..d604a16 100644
--- a/src/_locales/ta/messages.json
+++ b/src/_locales/ta/messages.json
@@ -48,7 +48,7 @@
"description": "கேமரா / மைக்ரோஃபோன் அனுமதிகள் எச்சரிக்கை செய்தியின் தலைப்பு"
},
"permissionsModalDescription": {
- "message": "போன்று போன்று தேர்வு செய்வதற்கு உங்கள் கேமரா அல்லது மைக்ரோஃபோனுக்கு அணுகலை அனுமதிக்க முடியவில்லை. அணுகலை அனுமதிக்க அனுமதி அளிக்க அடியில் கேமரா ஐகானை கிளிக் செய்து அனுமதி அளிக்கவும்.",
+ "message": "Screenity உங்கள் கேமரா அல்லது மைக்ரோஃபோனை அணுக முடியவில்லை போல் தெரிகிறது. முகவரிப் பட்டியில் உள்ள கேமரா ஐகானைக் கிளிக் செய்து அணுகலை அனுமதியுங்கள்.",
"description": "கேமரா / மைக்ரோஃபோன் அனுமதிகள் எச்சரிக்கை செய்தியின் விளக்கம் விளக்கம்"
},
"permissionsModalDismiss": {
@@ -684,7 +684,7 @@
"description": "அனுமதி பட்டியல் தலைப்பு"
},
"chromePermissionsModalDescription": {
- "message": "திரை பதிவு செய்ய உங்கள் திரையை காட்சிப்படுத்த அனுமதி இயக்க வேண்டும். போக்கில் உங்கள் திரையை பட்டியல் தலைப்பில் அனுமதி இயக்கவும்.",
+ "message": "திரைப் பதிவை இயக்க, கேட்கப்படும்போது உங்கள் திரையைப் பிடிக்க Screenity-க்கு அனுமதி வழங்க வேண்டும்.",
"description": "அனுமதி பட்டியல் விளக்கம்"
},
"chromePermissionsModalAction": {
@@ -700,7 +700,7 @@
"description": "மைக்ரோஃபோன் அமைக்கப்பட்டுள்ள தலைப்பு"
},
"micMutedModalDescription": {
- "message": "உங்கள் பதிவுக்கு ஒலி சேர்க்க உங்கள் மைக்ரோஃபோன் அமைக்க வேண்டும். ஒலி இல்லாதிருந்தால் தொடர்வது விரும்புகின்றீர்களா?",
+ "message": "உங்கள் பதிவில் ஒலியைச் சேர்க்க, மைக்ரோஃபோனின் ஒலியடக்கத்தை நீக்க வேண்டும். ஒலி இல்லாமல் தொடர விரும்புகிறீர்களா?",
"description": "மைக்ரோஃபோன் அமைக்கப்பட்டுள்ள விளக்கம்"
},
"micMutedModalAction": {
@@ -816,7 +816,7 @@
"description": "ஸ்ட்ரீம் பிழை மாடல் தலைப்பு"
},
"streamErrorModalDescription": {
- "message": "பதிவு ஆரம்பிப்பதில் ஒரு பிழை ஏற்பட்டதேன் என்று பார்க்கின்றது. உங்கள் உலாவி மீளவும் முயலுக்காக மீளவும் முயலவும் முயலுக்கு மீள்வார்கள். சிந்தனை தொடர்ந்து உத்தரவு பெறுகின்றதில், தயவுசெய்து எங்களுடன் தொடர்க [email protected] என்ற முகவரிக்கு தொடர்பு கொள்ளவும்.",
+ "message": "பதிவில் ஏதோ பிழை ஏற்பட்டது போல் தெரிகிறது. உங்கள் உலாவியை மீண்டும் தொடங்கி, மீண்டும் முயற்சிக்கவும். சிக்கல் தொடர்ந்தால், தயவுசெய்து [email protected] முகவரியில் எங்களைத் தொடர்பு கொள்ளவும்.",
"description": "ஸ்ட்ரீம் பிழை மாடல் விளக்கம்"
},
"highestQuality": {
@@ -836,7 +836,7 @@
"description": "எடிட்டரில் பிரச்சினை படிக்கு தலைப்பு"
},
"havingIssuesModalDescription": {
- "message": "உங்கள் ரெக்கார்டிங் முடிந்துவிட்டது மற்றும் உங்கள் வீடியோவை காணாத அவகாச வீடியோ தரவை பெற்ற பிறகு, அது கிடைக்கின்றால் உங்கள் அசையப்பட்ட வீடியோ தரவை பதிவிறக்க முயற்சிக்கலாம். அந்த தரவு கிடைக்கின்றதில், பிழை அறிக்கை அனுப்பி அழைக்கலாம்.",
+ "message": "உங்கள் பதிவு முடிந்த பிறகும் வீடியோ காட்டப்படாமல் இந்தப் பக்கத்தைக் காணும்பட்சத்தில், மூல வீடியோ தரவு கிடைக்குமானால் அதைப் பதிவிறக்க முயற்சிக்கலாம். எங்களைத் தொடர்பு கொண்டு பிழை அறிக்கையையும் சமர்ப்பிக்கலாம்.",
"description": "எடிட்டரில் பிரச்சினை படிவம்"
},
"havingIssuesModalButton": {
@@ -856,7 +856,7 @@
"description": "நினைவர வரம்பு அடைந்துள்ளது தலைப்பு"
},
"memoryLimitDescription": {
- "message": "உங்கள் சாதனம் பதிவு செய்ய உள்ள நினைவரம் முழுவதும் அவசியமாக அடைந்துள்ளது, அதனால் பதிவு தானியக்கம் நிறுத்தப்பட்டுள்ளது. கூடுதல் காலம் பதிவு செய்ய விரும்பினால், வீடியோ தரம் குறைக்க அல்லது உங்கள் சாதனத்தில் சில இடம் வெளியிட முடியும் என்பதை முயற்சிக்கலாம்.",
+ "message": "உங்கள் சாதனத்தின் சேமிப்பகம் தீர்ந்துவிட்டதால், பதிவு தானாக நிறுத்தப்பட்டது. அதுவரையிலான உங்கள் பதிவு பாதுகாப்பாக உள்ளது; அதை எடிட்டரிலிருந்து பதிவிறக்கலாம். நீண்ட நேரம் பதிவு செய்ய, வீடியோ தரத்தைக் குறைக்கவும் அல்லது உங்கள் சாதனத்தில் இடத்தைக் காலி செய்யவும்.",
"description": "நினைவர வரம்பு அடைந்துள்ளது விளக்கம்"
},
"understoodButton": {
@@ -868,7 +868,7 @@
"description": "புதியவில் போக்கு இல்லை தலைப்பு"
},
"notEnoughSpaceDescription": {
- "message": "Screenity பதிவு செய்ய குண்டெய்க குண்டு முதல் 1 ஜிபி குளையிடம் தேவை. உங்கள் சாதனத்தில் இடம் வெளியிடும்போது, தயவுசெய்து இடம் வெளியிட்டு மீட்டெடுக்கவும்.",
+ "message": "பதிவு செய்ய Screenity-க்கு குறைந்தபட்சம் 1GB இலவச இடம் தேவை. தயவுசெய்து சிறிது இடத்தைக் காலி செய்து மீண்டும் முயற்சிக்கவும்.",
"description": "புதியவில் போக்கு இல்லை விளக்கம்"
},
"clearSpaceButton": {
@@ -900,7 +900,7 @@
"description": "மூல பதிவிறக்கம் மாடல் தலைப்பு"
},
"rawRecordingModalDescription": {
- "message": "மூல வீடியோ கோப்பு, ஸ்க்ரீனிட்டி மூலம் பதிக்கப்பட்ட உண்மை வீடியோ கோப்புக்கு அமைந்தது. இந்த வீடியோ செயலாக்கப்படாதது அல்லது திருத்தப்படாதது, அது மிக பெரியதாக இருக்கலாம் மற்றும் அனைத்து சாதனங்களிலும் புரட்டாததாக இருக்கலாம். உங்கள் செயலாக்க வீடியோவில் சிக்கல்கள் உள்ளதில், இந்த கோப்பை உங்கள் வீடியோவை மீட்டரியாக்க மற்றும் மேலும் திருத்த படுத்த முடியும்.",
+ "message": "மூல வீடியோ கோப்பு என்பது Screenity பதிவு செய்த அசல் வீடியோ கோப்பாகும். இது செயலாக்கப்படவோ திருத்தப்படவோ இல்லை, எனவே மிகப் பெரியதாகவும் எல்லாச் சாதனங்களிலும் இயக்க முடியாததாகவும் இருக்கலாம். செயலாக்கப்பட்ட வீடியோவில் சிக்கல்கள் ஏற்பட்டால், உங்கள் வீடியோவை மீட்டெடுக்க இந்தக் கோப்பைப் பயன்படுத்தலாம்.",
"description": "மூல பதிவிறக்கம் மாடல் விளக்கம்"
},
"rawRecordingModalButton": {
@@ -912,7 +912,7 @@
"description": "தகவலுக்கு உதவி மாடல் தலைப்பு"
},
"troubleshootModalDescription": {
- "message": "பதிவிறக்கும் பின், இந்த கோப்பை [email protected] க்கு அனுப்புங்கள் மற்றும் அதிக தொடர்பான தகவலுடன். நாங்கள் இந்த தரவை பயன்படுத்தி உங்கள் விளக்க பெறும் பிரச்சினைகளை தீர்க்க உதவுவோம் மற்றும் வாடிக்கைக்கு வரை உங்கள் வீடியோவை மீட்டரியாக்குவதில் முடியும் என்பதை நிச்சயமாக சொல்லுக.",
+ "message": "இது கணினித் தகவல்கள் மற்றும் சமீபத்திய பதிவு அமர்வுத் தரவுகளுடன் ஒரு கண்டறிதல் அறிக்கையைப் பதிவிறக்கும். உங்கள் சிக்கலை நாங்கள் தீர்க்க உதவ அதை [email protected]க்கு அனுப்புங்கள். எந்த வீடியோ அல்லது ஒலித் தரவும் இதில் சேர்க்கப்படவில்லை.",
"description": "தகவலுக்கு உதவி மாடல் விளக்கம்"
},
"troubleshootModalButton": {
@@ -924,7 +924,7 @@
"description": "5 நிமிட வாரந்தோற்ற உள்ளடக்கம் உடைய மாதிரி மோடல் தலைப்பு"
},
"overLimitModalDescription": {
- "message": "Screenity முழுவதும் தனியாக உழைந்து உழைக்கும் போது, உங்கள் சாதனத்தின் உபகரண வகைகளால் கட்டாயமாக வர்ம்வேர் செய்வது. இந்த நீளம் உள்ள விடியோவை செயல்படுத்துவது மிகவும் நேரம் எடுக்கும் மற்றும் மிகவும் வளர்ச்சியடையும். ஆனால் வேறு பரிமாற்றம் முடியும் என்று கவனிக்கவும், நீங்கள் இந்த அபரிசீலிதம் புரிந்திருந்தால்.",
+ "message": "Screenity முற்றிலும் தனிப்பட்டது மற்றும் உள்ளூரில் இயங்குவதால், உங்கள் சாதனத்தின் வன்பொருளால் வரையறுக்கப்படுகிறது. இவ்வளவு நீளமான வீடியோவைச் செயலாக்க அதிக நேரமும் வளங்களும் தேவைப்படும். கவலைப்பட வேண்டாம், WEBM கோப்பையோ மூலப் பதிவையோ இன்னும் பதிவிறக்கலாம், ஆனால் திருத்துதலும் MP4 ஏற்றுமதியும் கிடைக்காது. அபாயங்களைப் புரிந்திருந்தால், வீடியோவை எப்படியாயினும் செயலாக்க முயற்சிக்கலாம்.",
"description": "5 நிமிட வாரந்தோற்ற உள்ளடக்கம் மோடல் விளக்கம்"
},
"overLimitModalDescriptionFastPath": {
@@ -970,7 +970,7 @@
"description": "அட்டவணை ஆதரிக்கப்படாத நீக்கம் தலைப்பு"
},
"extensionNotSupportedDescription": {
- "message": "உங்கள் முந்தைய பக்கத்தில் Screenity ஆதரிக்கப்படவில்லை. இதையடுத்து, நீங்கள் இங்கே பதிவு ஆரம்பிக்கலாம், அப்போது மற்றொரு பக்கத்திற்கு செல்ல அநுமதிக்கப்படும், ஆனால் உங்கள் கேமரா மற்றும் கருவிப்பட்டி காணப்படாது.",
+ "message": "உங்கள் முந்தைய தாவலில் Screenity ஆதரிக்கப்படவில்லை. இங்கே பதிவைத் தொடங்கி அந்தத் தாவலுக்குத் திரும்பலாம், ஆனால் உங்கள் கேமராவும் கருவிப்பட்டியும் தெரியாது.",
"description": "அட்டவணை ஆதரிக்கப்படாத நீக்கம் விளக்கம்"
},
"backupsTitle": {
@@ -978,11 +978,11 @@
"description": "காப்பிடுதல் தலைப்பு"
},
"backupsDescription1": {
- "message": "நீங்கள் செய்த அனைத்து பதிவுகளின் ஒரு நகர்வு சொல்லியில் வைக்கவும். உங்கள் உள்ளூரை காப்பிடுவதில் தடுமாற்றம் அமையவில்லை, நீங்கள் அவை பதிவிறக்குவதை விரும்பும்போது மட்டும் பதிவு செய்யப்படும்.",
+ "message": "நீங்கள் எடுக்கும் அனைத்துப் பதிவுகளின் ஒரு நகலையும் வைத்திருங்கள். காப்புப் பிரதிகளை அமைக்கவில்லை எனில், நீங்கள் பதிவிறக்கத் தேர்வு செய்யும்போது மட்டுமே பதிவுகள் சேமிக்கப்படும்.",
"description": "காப்பிடுதல் விளக்கம்"
},
"backupsDescription2": {
- "message": "நீங்கள் பதிவு செய்ய விரும்பும்போது, 'பதிவுகள்' போன்ற அமைப்புகளில் பதிவு செய்ய முதல் புதிய கோப்பகத்தை உருவாக்க வேண்டும்.",
+ "message": "Downloads அல்லது வேறு கணினிக் கோப்பகங்களில் சேமிக்க முயற்சித்தால், முதலில் ஒரு புதிய கோப்பகத்தை உருவாக்க வேண்டியிருக்கலாம்.",
"description": "காப்பிடுதல் விளக்கம்"
},
"backupsSelectFolder": {
@@ -998,7 +998,7 @@
"description": "செயல்பாட்டு காப்புகள் தலைப்பு"
},
"backupsOnDescription": {
- "message": "பதிவிடும்போது ஒலி பதிவிறக்க விண்ணப்பங்களை கேட்டுக் கொள்கின்ற போது ஒலி பதிவிறக்க வேண்டாம், இந்த அட்டவணையை மூடவும் என்று பரிந்துரைக்கப்படுகின்றது.",
+ "message": "ஒவ்வொரு முறை பதிவு செய்யும்போதும் அனுமதிகள் கேட்கப்படுவதைத் தவிர்க்க, இந்தத் தாவலைத் திறந்தே வைத்திருக்கப் பரிந்துரைக்கிறோம்.",
"description": "செயல்பாட்டு காப்புகள் விளக்கம்"
},
"backupsClose": {
@@ -1014,7 +1014,7 @@
"description": "காப்பிடுதல் உறுதிப்படுத்துதல் தலைப்பு"
},
"backupsConfirmDescription": {
- "message": "மன்னிக்கவும், உங்கள் பதிவிகளின் உள்ளூர் நகர்வுக்கு உங்கள் அனுமதியை மீண்டும் சேமிக்க தேவை. அதிசயமாக, நீங்கள் இந்த அட்டவணையை எப்போதும் மூடுவது வேண்டும், அது உங்கள் உலாவியை மூடும் அல்லது உங்கள் கணினியை மீட்டரைக் கொண்டு மீண்டும் ஆரம்பிக்கலாம் என்று சொல்கின்றது.",
+ "message": "மன்னிக்கவும், உங்கள் பதிவுகளைத் தொடர்ந்து காப்புப் பிரதி எடுக்க உங்கள் அனுமதி மீண்டும் ஒருமுறை தேவைப்படுகிறது. துரதிர்ஷ்டவசமாக, இந்தத் தாவல் மூடப்படும் ஒவ்வொரு முறையும் கேட்க வேண்டியிருக்கும் — உலாவியை மூடினாலோ கணினியை மறுதொடக்கம் செய்தாலோ இது நிகழலாம்.",
"description": "காப்பிடுதல் உறுதிப்படுத்துதல் விளக்கம்"
},
"backupsConfirmAllow": {
@@ -1030,7 +1030,7 @@
"description": "காப்பிடுதல் அனுமதி தோல்வி தலைப்பு"
},
"backupPermissionFailDescription": {
- "message": "உங்கள் பதிவுகளின் உள்நிலை நகல் செய்ய ஒரு கோப்பகத்தை தேர்வு செய்தவில்லை. உங்கள் உலாவியம் அல்லது இயக்கம் பதிப்பின் பதிப்பிக்கு விருப்பம் கோரப்படும், நீங்கள் எப்போதும் பதிவுசெய்து அநுமதிக்க கேட்கப்படலாம். நீங்கள் அநுமதிகளை அனைத்தும் அவாரமாக வழிநடத்துவதை விரும்பின்றிதல் போன்றதான்.",
+ "message": "உங்கள் பதிவுகளுக்கான காப்புப் பிரதி கோப்பகத்தைத் தேர்வு செய்யவில்லை. உங்கள் உலாவியின் பதிப்பு அல்லது இயக்க முறைமையைப் பொறுத்து, ஒவ்வொரு முறை பதிவைத் தொடங்கும்போதும் கோப்பகத்தைத் தேர்வு செய்யக் கேட்கப்படலாம். மீண்டும் முயற்சிக்கலாம், அல்லது மீண்டும் மீண்டும் அனுமதி கொடுக்க விரும்பாவிட்டால் காப்புப் பிரதியை முற்றிலுமாக முடக்கலாம்.",
"description": "பூர்வமாக அனுமதி பிழை விளக்கம்"
},
"recordAudioWarningMacTitle": {
@@ -1038,7 +1038,7 @@
"description": "macOS க்கு ஒலியின் எச்சரிக்கை தலைப்பு"
},
"recordAudioWarningMacDescription": {
- "message": "macOS-ல், நீங்கள் வரிசைகளிலிருந்து ஒலியை மட்டும் பதிவுசெய்யலாம். 'Chrome வரிசை' விருப்பத்தை தேர்வு செய்து, 'வரிசை ஒலி குணம் பகிரவும்' என்பதை இயக்கின்றதை உறுதிப்படுத்துங்கள்.",
+ "message": "macOS-ல், தாவல் ஒலியை மட்டுமே பதிவு செய்ய முடியும். 'Chrome Tab' விருப்பத்தைத் தேர்வு செய்து, 'Also share tab audio' இயக்கப்பட்டிருப்பதை உறுதி செய்யுங்கள்.",
"description": "macOS க்கு ஒலியை பதிவுசெய்தல் விருப்பம் தலைப்பு"
},
"recordAudioWarningOtherTitle": {
@@ -1046,7 +1046,7 @@
"description": "பிற கணினி வடிவம் க்கு ஒலியின் எச்சரிக்கை தலைப்பு"
},
"recordAudioWarningOtherDescription": {
- "message": "கணினியிலிருந்து ஒலியை பதிவுசெய்ய விரும்பினதால், 'கணினி ஒலியை பகிர்க' விருப்பத்தை செயல்படுத்துக. இந்த விருப்பத்தை காணாதிருக்கின்றார் என்பதை பார்க்கின்றதால், Chrome ஐ புதுப்பிக்கவும் அல்லது வரிசை பதிவு விருப்பம் மாற்றுவதை முயற்சிக்கவும்.",
+ "message": "கணினி ஒலியைப் பதிவு செய்ய விரும்பினால், 'Share system audio' விருப்பத்தை இயக்க உறுதி செய்யுங்கள். இந்த விருப்பம் தெரியவில்லை எனில், Chrome-ஐப் புதுப்பிக்க முயற்சிக்கவும் அல்லது தாவல் பதிவுக்கு மாறவும்.",
"description": "பிற கணினி வடிவம் க்கு ஒலியின் எச்சரிக்கை தலைப்பு"
},
"maxResolutionLabel": {
@@ -1054,7 +1054,7 @@
"description": "அமைப்புகள் பட்டியலில் அதிசய கருவி குறியீட்டு"
},
"maxFPSLabel": {
- "message": "அதிசய கோட்டிகள் கோட்டிகள்",
+ "message": "அதிகபட்ச FPS",
"description": "அமைப்புகள் பட்டியலில் அதிசய கோட்டிகள் குறியீட்டு"
},
"notEnoughRAM": {
@@ -1450,7 +1450,7 @@
"description": "Pro onboarding toolbar step title"
},
"proOnboardingToolbarDescription": {
- "message": "இந்த கருவிப்பட்டையில் வரைதல், கர்சர் விளைவுகள், blur மற்றும் பதிவு கட்டுப்பாடுகளைப் பயன்படுத்தலாம்.<br/><br/><strong>இந்த கருவிப்பட்டை வீடியோவில் சேரும்</strong> மறைக்கவில்லை என்றால்.",
+ "message": "வரைதல், கர்சர் விளைவுகள், blur, மற்றும் பதிவுக் கட்டுப்பாடுகளுக்கு இந்தக் கருவிப்பட்டியைப் பயன்படுத்தவும்.<br/><br/><strong>மறைக்காவிட்டால் இந்தக் கருவிப்பட்டி வீடியோவில் சேர்க்கப்படும்.</strong>",
"description": "Pro onboarding toolbar step description"
},
"proOnboardingCameraTitle": {
@@ -1666,5 +1666,29 @@
},
"recordingCorruptToast": {
"message": "இந்தப் பதிவை இயக்க முடியாது. கோப்பு முழுமையடையாமல் அல்லது சேதமடைந்திருக்கலாம். சேமி மெனுவில் இருந்து மூலக் கோப்பைப் பதிவிறக்க முயற்சிக்கவும்."
+ },
+ "storageFullRecordingError": {
+ "message": "பதிவு செய்ய போதுமான சேமிப்பகம் இல்லை. வட்டில் இடம் காலி செய்து மீண்டும் முயற்சிக்கவும்.",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "உங்கள் உலாவியின் சேமிப்பகம் கிட்டத்தட்ட நிரம்பிவிட்டது. இந்தப் பதிவை இழக்காமல் இருக்க வட்டில் இடம் காலி செய்யவும்.",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "திரையை அணுக முடியவில்லை. பதிவை மீண்டும் தொடங்கவும்.",
+ "description": "Shown when the screen capture stream is missing after the user picked a source"
+ },
+ "tabStreamUnavailableError": {
+ "message": "இந்த தாவலின் வீடியோவை அணுக முடியவில்லை. தாவலை மீண்டும் ஏற்றி, மீண்டும் முயற்சிக்கவும்.",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "பதிவு சரியான நேரத்தில் தொடங்கவில்லை. தயவுசெய்து மீண்டும் முயற்சிக்கவும்.",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "உங்கள் உலாவி தேவையான வீடியோ கோடெக்குகளை ஆதரிக்கவில்லை. Chrome ஐ புதுப்பித்து மீண்டும் முயற்சிக்கவும்.",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
}
}
diff --git a/src/_locales/tr/messages.json b/src/_locales/tr/messages.json
index c060f34..d2b2431 100644
--- a/src/_locales/tr/messages.json
+++ b/src/_locales/tr/messages.json
@@ -1666,5 +1666,29 @@
},
"recordingCorruptToast": {
"message": "Bu kayıt oynatılamıyor. Dosya eksik veya bozuk olabilir. Kaydet menüsünden ham dosyayı indirmeyi deneyin."
+ },
+ "storageFullRecordingError": {
+ "message": "Kayıt için yeterli depolama alanı yok. Disk alanı boşaltıp tekrar deneyin.",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "Tarayıcı depolama alanınız neredeyse dolu. Bu kaydı kaybetmemek için disk alanı boşaltın.",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "Ekrana erişilemedi. Kaydı tekrar başlatın.",
+ "description": "Shown when the screen capture stream is missing after the user picked a source"
+ },
+ "tabStreamUnavailableError": {
+ "message": "Bu sekmenin videosuna erişilemedi. Sekmeyi yeniden yükleyip tekrar deneyin.",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "Kayıt zamanında başlamadı. Lütfen tekrar deneyin.",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "Tarayıcınız gerekli video codec'lerini desteklemiyor. Chrome'u güncelleyip tekrar deneyin.",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
}
}
diff --git a/src/_locales/uk/messages.json b/src/_locales/uk/messages.json
index 32c5529..a911bc5 100644
--- a/src/_locales/uk/messages.json
+++ b/src/_locales/uk/messages.json
@@ -1664,5 +1664,29 @@
},
"hostBannerDescription": {
"message": "Screenity створює один інді-розробник. Самостійний хостинг безкоштовний, але якщо програма вам корисна, підтримайте її через Pro ❤️"
+ },
+ "storageFullRecordingError": {
+ "message": "Недостатньо місця для запису. Звільніть місце на диску й спробуйте знову.",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "Сховище браузера майже заповнене. Звільніть місце на диску, щоб не втратити цей запис.",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "Не вдалося отримати доступ до екрана. Запустіть запис знову.",
+ "description": "Shown when the screen capture stream is missing after the user picked a source"
+ },
+ "tabStreamUnavailableError": {
+ "message": "Не вдалося отримати доступ до відео цієї вкладки. Перезавантажте вкладку й спробуйте знову.",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "Запис не почався вчасно. Спробуйте ще раз.",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "Ваш браузер не підтримує потрібні відеокодеки. Оновіть Chrome і спробуйте знову.",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
}
}
diff --git a/src/_locales/zh_CN/messages.json b/src/_locales/zh_CN/messages.json
index b428478..40ddef1 100644
--- a/src/_locales/zh_CN/messages.json
+++ b/src/_locales/zh_CN/messages.json
@@ -1665,5 +1665,29 @@
},
"stopRecording": {
"message": "停止录制"
+ },
+ "storageFullRecordingError": {
+ "message": "存储空间不足,无法录制。请释放磁盘空间后重试。",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "您的浏览器存储空间快满了。请释放磁盘空间,以免丢失此录制内容。",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "无法访问屏幕。请重新开始录制。",
+ "description": "Shown when the screen capture stream is missing after the user picked a source"
+ },
+ "tabStreamUnavailableError": {
+ "message": "无法访问此标签页的视频。请重新加载该标签页后重试。",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "录制未能及时开始。请重试。",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "您的浏览器不支持所需的视频编码器。请更新 Chrome 后重试。",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
}
}
diff --git a/src/_locales/zh_TW/messages.json b/src/_locales/zh_TW/messages.json
index 1676e85..4db4622 100644
--- a/src/_locales/zh_TW/messages.json
+++ b/src/_locales/zh_TW/messages.json
@@ -1666,5 +1666,29 @@
},
"recordingCorruptToast": {
"message": "此錄影無法播放。檔案可能不完整或已損毀。請從「儲存」選單下載原始檔案。"
+ },
+ "storageFullRecordingError": {
+ "message": "儲存空間不足,無法錄製。請釋放磁碟空間後再試一次。",
+ "description": "Shown when the browser can't allocate enough local storage to start a recording"
+ },
+ "storageLowRecordingWarning": {
+ "message": "您的瀏覽器儲存空間快滿了。請釋放磁碟空間,以免遺失此錄製內容。",
+ "description": "Shown when local storage is running low while a recording is in progress"
+ },
+ "screenStreamUnavailableError": {
+ "message": "無法存取畫面。請重新開始錄製。",
+ "description": "Shown when the screen capture stream is missing after the user picked a source"
+ },
+ "tabStreamUnavailableError": {
+ "message": "無法存取此分頁的影片。請重新載入分頁後再試一次。",
+ "description": "Shown when Chrome won't return a tab capture stream for the chosen tab"
+ },
+ "streamingDataTimeoutError": {
+ "message": "錄製未能及時開始。請再試一次。",
+ "description": "Shown when the recorder tab never received streaming-data from the background script"
+ },
+ "unsupportedVideoCodecError": {
+ "message": "您的瀏覽器不支援所需的視訊編解碼器。請更新 Chrome 後再試一次。",
+ "description": "Shown when no supported MediaRecorder mimeType is available"
}
}
diff --git a/src/manifest.json b/src/manifest.json
index 1867ba9..c1a0764 100755
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -3,7 +3,7 @@
"name": "__MSG_extName__",
"description": "__MSG_extDesc__",
"default_locale": "en",
- "version": "4.4.9",
+ "version": "4.4.10",
"background": {
"service_worker": "background.bundle.js"
},
diff --git a/src/media/fastRecorderGate.ts b/src/media/fastRecorderGate.ts
index 2279068..caf1362 100644
--- a/src/media/fastRecorderGate.ts
+++ b/src/media/fastRecorderGate.ts
@@ -79,15 +79,37 @@ const safeMseSupport = (mime: string) => {
}
};
+// Expire sticky disables so a one-off failure (codec reclaim, HW slot
+// contention, sleep) doesn't permanently downgrade users now that the
+// WebCodecs recorder self-heals via salvage paths.
+const STICKY_DISABLE_TTL_MS = 14 * 24 * 60 * 60 * 1000;
+
export const getFastRecorderStickyState = async (): Promise<FastRecorderStickyState> => {
try {
const result = await chrome.storage.local.get([
STORAGE_KEYS.stickyDisabled,
STORAGE_KEYS.stickyReason,
STORAGE_KEYS.stickyDetails,
+ STORAGE_KEYS.lastFailureAt,
]);
+ const disabledRaw = Boolean(result[STORAGE_KEYS.stickyDisabled]);
+ const lastFailureAt = Number(result[STORAGE_KEYS.lastFailureAt]) || 0;
+ // Report stale disables as cleared. Don't wipe other keys here to
+ // avoid racing concurrent setters; next failure overwrites anyway.
+ const expired =
+ disabledRaw &&
+ lastFailureAt > 0 &&
+ Date.now() - lastFailureAt > STICKY_DISABLE_TTL_MS;
+ if (expired) {
+ try {
+ await chrome.storage.local.set({
+ [STORAGE_KEYS.stickyDisabled]: false,
+ });
+ } catch {}
+ return { disabled: false };
+ }
return {
- disabled: Boolean(result[STORAGE_KEYS.stickyDisabled]),
+ disabled: disabledRaw,
reason: result[STORAGE_KEYS.stickyReason] || null,
details: result[STORAGE_KEYS.stickyDetails] || null,
};
@@ -118,13 +140,35 @@ export const isTransientFastRecorderError = (errorString: string) => {
};
const isTransientError = isTransientFastRecorderError;
+// firstChunkSeen=false means no output ever landed: cancel or contention,
+// not an encoder defect (real breakage emits at least one chunk first).
+export const isFastRecorderFailureTransient = (
+ reasonCode: string,
+ errorString: string,
+ detail: any
+): boolean => {
+ if (isTransientFastRecorderError(errorString)) return true;
+ if (
+ reasonCode === "webcodecs-zero-frames-at-stop" &&
+ detail &&
+ detail.firstChunkSeen === false
+ ) {
+ return true;
+ }
+ return false;
+};
+
export const markFastRecorderFailure = async (
reasonCode: string,
details: Record<string, any> = {}
) => {
try {
const errStr = typeof details?.error === "string" ? details.error : "";
- if (isTransientError(errStr)) {
+ const detail =
+ details && typeof details === "object" && details.detail
+ ? details.detail
+ : null;
+ if (isFastRecorderFailureTransient(reasonCode, errStr, detail)) {
await chrome.storage.local.set({
[STORAGE_KEYS.lastFailureAt]: Date.now(),
fastRecorderTransientFailure: {
@@ -146,12 +190,8 @@ export const markFastRecorderFailure = async (
}
};
-// Round-trip 4 synthetic frames through a real VideoEncoder to
-// confirm it emits chunks. isConfigSupported() only validates shape
-// and misses the "28-byte ftyp" failure. 30 frames would also catch
-// first-keyframe-only bugs, but ~900ms/frame under pressure = 27s of
-// blocking; runtime watchdogs handle that. 1.5s flush cap: any chunk
-// landed = healthy-but-slow, zero chunks = no-output.
+// Push 4 synthetic frames through a real VideoEncoder to catch the
+// "28-byte ftyp" zero-output failure isConfigSupported misses.
const PROBE_FRAME_COUNT = 4;
const PROBE_WALL_CLOCK_CAP_MS = 1500;
const verifyEncoderProducesOutput = async (
@@ -201,10 +241,8 @@ const verifyEncoderProducesOutput = async (
frames.push(frame);
encoder.encode(frame, { keyFrame: i === 0 });
}
- // Wall-clock-bounded flush. A slow but healthy encoder can drain
- // for tens of seconds under system memory/GPU pressure; we don't
- // make the user wait. If timeout hits, the chunks counter has
- // whatever the encoder produced; we'll classify below.
+ // Wall-clock cap: a stressed encoder can drain for tens of seconds.
+ // Classify on whatever landed.
let flushTimedOut = false;
let flushTimer: ReturnType<typeof setTimeout> | null = null;
try {
@@ -241,20 +279,13 @@ const verifyEncoderProducesOutput = async (
}
const ms = Date.now() - started;
if (encoderError) return { ok: false, reason: "error", chunks, ms };
- // The only firm fail signal is zero output. With the small frame
- // count + bounded flush, "too-few-chunks" heuristics produce false
- // negatives (a slow but healthy encoder might only land 1 chunk
- // within the cap). Runtime watchdogs in WebCodecsRecorder catch
- // the rest.
+ // Only zero-output is a firm fail; runtime watchdogs handle slow encoders.
if (chunks === 0) return { ok: false, reason: "no-output", chunks, ms };
return { ok: true, chunks, ms };
};
-// Round-trip 1s of synthetic audio through a real AudioEncoder. Same
-// purpose as the video probe: isConfigSupported says "yes" but the
-// encoder might still fail at first encode under platform-specific
-// constraints (Opus 48k internal mismatch, AAC channel layout issues,
-// etc). Cheap; ~10 AudioData inputs at 4800 samples each.
+// Audio equivalent of the video probe: catches first-encode failures that
+// isConfigSupported misses (Opus 48k mismatch, AAC channel layout, etc).
const verifyAudioEncoderProducesOutput = async (
config: AudioEncoderConfig
): Promise<{ ok: boolean; reason?: string; chunks: number; ms: number }> => {
@@ -312,9 +343,7 @@ const verifyAudioEncoderProducesOutput = async (
return { ok: true, chunks, ms };
};
-// Probe cache TTL. Probe is 250-350ms warm, seconds cold; re-running
-// every start showed up as countdown-to-record delay. Key is
-// { userAgent + GATE_VERSION }. ok=false isn't cached so a driver
+// Cache key: userAgent + GATE_VERSION. ok=false isn't cached so a driver
// recovery re-probes immediately.
const PROBE_CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
// Short window for failed probes: coalesces back-to-back calls during
@@ -624,17 +653,11 @@ const _probeFastRecorderSupportUncached = async (): Promise<FastRecorderProbeRes
if (containerKind === "mp4") details.containerKind = "mp4";
- // Verify the selected encoder actually produces output, not just
- // that the config is "supported". This is the proactive guard:
- // a machine whose encoder emits zero frames is caught here and
- // routed to MediaRecorder, instead of the user losing a recording.
+ // Verify the encoder emits chunks; otherwise route to MediaRecorder.
if (details.selectedVideoConfig) {
- // Retry once on transient encoder errors. VTDecoderXPCService
- // (macOS), NVIDIA driver hand-offs (Windows), intel-VAAPI
- // (Linux) all reject the first configure() right after another
- // encoder ran, then succeed on the retry. Without this, a one-
- // off "error" reason stickied MediaRecorder for the session.
- // "no-output" is a real HW bug and does NOT retry.
+ // Retry once on transient errors (VTDecoderXPC, NVIDIA, VAAPI all
+ // reject the first configure() after another encoder ran). "no-output"
+ // is a real HW bug and does NOT retry.
let encodeCheck = await verifyEncoderProducesOutput(
details.selectedVideoConfig as VideoEncoderConfig
);
@@ -670,10 +693,8 @@ const _probeFastRecorderSupportUncached = async (): Promise<FastRecorderProbeRes
let ok = reasons.length === 0;
const at = Date.now();
- // Optimistic override: if the only failures are transient encode
- // errors and a clean probe ran in the last 7 days, trust it.
- // In-session swap to MediaRecorder is wired up; the cost of a
- // false-negative IDB recording is higher than a WebCodecs retry.
+ // Trust a clean probe from the last 7 days when only transient errors
+ // failed: in-session MediaRecorder swap covers the WebCodecs miss.
if (!ok) {
const onlyTransientReasons = reasons.every((r) =>
r === "video-encode-error" || r === "audio-encode-error"
@@ -709,11 +730,8 @@ const _probeFastRecorderSupportUncached = async (): Promise<FastRecorderProbeRes
[STORAGE_KEYS.probe]: { ok, reasons, details, at },
});
} else {
- // Don't overwrite a known-good cached probe with a failure
- // (one bad VTDecoder run shouldn't wipe a week of confidence).
- // But also persist the failure separately so the next start
- // can short-circuit a re-probe for the in-memory TTL window
- // even if the SW restarted between recordings.
+ // Keep the good cached probe; record the failure separately so the
+ // next start short-circuits even after SW restart.
await chrome.storage.local.set({
fastRecorderProbeLastFailure: { reasons, details, at },
});
diff --git a/src/pages/Background/auth/loginWithWebsite.js b/src/pages/Background/auth/loginWithWebsite.js
index 11852f7..c9b6c45 100644
--- a/src/pages/Background/auth/loginWithWebsite.js
+++ b/src/pages/Background/auth/loginWithWebsite.js
@@ -37,8 +37,8 @@ const recordSubscriptionLoss = async (reason, extra = {}) => {
} catch {}
};
-// force=true bypasses stayLoggedOut and the prior-signals gate, so
-// user-initiated paths can recover via cookie refresh after explicit logout.
+// force=true bypasses the prior-signals gate for cookie-refresh recovery.
+// It does NOT override stayLoggedOut: explicit logout stays sticky.
export const loginWithWebsite = async (arg = {}) => {
const _depth = typeof arg === "number" ? arg : Number(arg._depth) || 0;
const force = typeof arg === "object" && arg !== null ? Boolean(arg.force) : false;
@@ -68,7 +68,9 @@ export const loginWithWebsite = async (arg = {}) => {
"screenityUser",
]);
- if (stayLoggedOut && !force) {
+ // Only AUTH_SUCCESS from the website clears stayLoggedOut. Implicit paths
+ // (record click, popup, tab update, action click) must not revive auth.
+ if (stayLoggedOut) {
return { authenticated: false, instantMode: false };
}
@@ -88,10 +90,7 @@ export const loginWithWebsite = async (arg = {}) => {
if (refreshRes.ok) {
const { token: newToken } = await refreshRes.json();
if (newToken) {
- // also clear stayLoggedOut on force so non-force calls work next time.
- const writes = { screenityToken: newToken };
- if (force) writes.stayLoggedOut = false;
- await chrome.storage.local.set(writes);
+ await chrome.storage.local.set({ screenityToken: newToken });
return await loginWithWebsite({ _depth: _depth + 1, force });
}
}
@@ -244,9 +243,7 @@ export const loginWithWebsite = async (arg = {}) => {
);
if (refreshRes.ok) {
const { token: newToken } = await refreshRes.json();
- const writes = { screenityToken: newToken };
- if (force) writes.stayLoggedOut = false;
- await chrome.storage.local.set(writes);
+ await chrome.storage.local.set({ screenityToken: newToken });
return await loginWithWebsite({ _depth: _depth + 1, force });
}
} catch (refreshErr) {
diff --git a/src/pages/Background/messaging/handlers.js b/src/pages/Background/messaging/handlers.js
index 41d0b12..7330e9c 100644
--- a/src/pages/Background/messaging/handlers.js
+++ b/src/pages/Background/messaging/handlers.js
@@ -1,5 +1,6 @@
import JSZip from "jszip";
import { registerMessage } from "../../../messaging/messageRouter";
+import { appendUploadTelemetryEventSerialized } from "../utils/serializedTelemetryStore";
import { perfMark, perfSpan } from "../../utils/perfMarks";
import {
focusTab,
@@ -584,6 +585,9 @@ export const handleFinishMultiRecording = async () => {
}
}
+ // Safety net for the !recordingToScene branch, which doesn't clear
+ // these inline. The else branch's bulk set already covers them, so
+ // this is a harmless redundant write on that path.
await chrome.storage.local.set({
multiMode: false,
multiSceneCount: 0,
@@ -958,10 +962,8 @@ export const setupHandlers = () => {
return { ok: false, error: lastErr || "tabs-sendMessage-failed" };
});
- // Bearer-auth API call routed through the SW so it survives the calling
- // tab's teardown (e.g. cloud recorder closing post-stop). Restricted to the
- // configured Screenity API base. Kept for non-cloud-recorder callers; the
- // cloud recorder uses the port-based path above instead.
+ // Bearer-auth fetch via SW so it survives caller teardown. Non-cloud-recorder
+ // callers only; the cloud recorder uses the port-based path above.
registerMessage("pro-api-fetch", async (message) => {
// Heartbeat resets the SW idle timer for the duration of the fetch,
// helpful when the originating tab tears down right after dispatch.
@@ -2733,26 +2735,11 @@ export const setupHandlers = () => {
// Receive perf entries from page contexts at pagehide; routed via
// BG so the storage IPC completes (a dying page racing storage.set
// drops the last few marks). Cloud upload telemetry routes here too.
- const UPLOAD_TELEMETRY_KEY = "cloudUploadTelemetryEvents";
- const MAX_UPLOAD_TELEMETRY_EVENTS = 200;
registerMessage("cloud-telemetry-event", async (message) => {
- try {
- const event = message?.event;
- if (!event || typeof event !== "object") return { ok: false };
- const existing = await chrome.storage.local.get([UPLOAD_TELEMETRY_KEY]);
- const current = Array.isArray(existing?.[UPLOAD_TELEMETRY_KEY])
- ? existing[UPLOAD_TELEMETRY_KEY]
- : [];
- const next = [...current, event].slice(-MAX_UPLOAD_TELEMETRY_EVENTS);
- await chrome.storage.local.set({
- [UPLOAD_TELEMETRY_KEY]: next,
- lastUploadTelemetryEvent: event,
- });
- return { ok: true };
- } catch (err) {
- // Best-effort: telemetry isn't user-facing functionality.
- return { ok: false, error: String(err?.message || err).slice(0, 200) };
- }
+ const event = message?.event;
+ if (!event || typeof event !== "object") return { ok: false };
+ const ok = await appendUploadTelemetryEventSerialized(event);
+ return { ok };
});
registerMessage("perf-forward", async (message) => {
diff --git a/src/pages/Background/recording/countdownFallback.js b/src/pages/Background/recording/countdownFallback.js
index 194b32a..11e784a 100644
--- a/src/pages/Background/recording/countdownFallback.js
+++ b/src/pages/Background/recording/countdownFallback.js
@@ -1,12 +1,6 @@
-// Watchdog for the countdown → start-recording bridge. The countdown UI
-// lives in the content script tab, so a navigation/unload during countdown
-// kills it and the "countdown-finished" message never lands, leaving the
-// recorder tab orphaned. Arm on diag-countdown-started, fire a fallback
-// startAfterCountdown if recording hasn't begun in time.
-//
-// Don't arm on pendingRecording: custom region setup runs 5-6s before
-// countdown begins, so the timer fires while the iframe isn't ready and
-// we get spurious "failed to start" modals.
+// Fallback if the content-script countdown unloads before "countdown-finished"
+// lands. Arm on diag-countdown-started, not pendingRecording (region setup
+// runs 5-6s pre-countdown and would trigger spurious "failed to start").
import { startAfterCountdown } from "./startRecording";
// 3s countdown + 1s END_HOLD_MS + POST_HIDE_START_DELAY_MS + slack
@@ -56,9 +50,51 @@ const scheduleFallback = (delayMs = FALLBACK_AFTER_COUNTDOWN_STARTED_MS) => {
// sends diag-countdown-started). This is the only trigger for the
// fallback timer.
export const noteCountdownStarted = () => {
+ // Timestamp so startRecording can distinguish a fresh countdown from
+ // a stale dispatch.
+ try {
+ chrome.storage.local.set({ countdownStartedAt: Date.now() });
+ } catch {}
scheduleFallback();
};
+// SW-death recovery. setTimeout dies with the service worker and
+// chrome.alarms clamps to ~30s, so on BG startup we re-fire the
+// fallback dispatch synchronously if the deadline already passed.
+export const recoverPendingCountdownOnStartup = async () => {
+ try {
+ const { pendingRecording, recording, restarting, countdownStartedAt } =
+ await chrome.storage.local.get([
+ "pendingRecording",
+ "recording",
+ "restarting",
+ "countdownStartedAt",
+ ]);
+ if (!pendingRecording || recording || restarting) return;
+ const startedAt = Number(countdownStartedAt) || 0;
+ if (!startedAt) return;
+ const elapsed = Date.now() - startedAt;
+ if (elapsed < FALLBACK_AFTER_COUNTDOWN_STARTED_MS) return;
+ console.info(
+ "[Screenity][BG] recoverPendingCountdownOnStartup: SW restarted past countdown deadline, dispatching",
+ { elapsedMs: elapsed },
+ );
+ try {
+ startAfterCountdown("countdownFallback-sw-restart");
+ } catch (err) {
+ console.error(
+ "[Screenity][BG] recoverPendingCountdownOnStartup startAfterCountdown failed",
+ err,
+ );
+ }
+ } catch (err) {
+ console.error(
+ "[Screenity][BG] recoverPendingCountdownOnStartup storage read failed",
+ err,
+ );
+ }
+};
+
export const initCountdownFallback = () => {
chrome.storage.onChanged.addListener((changes, area) => {
if (area !== "local") return;
@@ -75,4 +111,5 @@ export const initCountdownFallback = () => {
clearFallback();
}
});
+ void recoverPendingCountdownOnStartup();
};
diff --git a/src/pages/Background/recording/discardRecording.js b/src/pages/Background/recording/discardRecording.js
index 9500fe3..00c4f82 100644
--- a/src/pages/Background/recording/discardRecording.js
+++ b/src/pages/Background/recording/discardRecording.js
@@ -26,7 +26,11 @@ export const discardRecording = async ({
} catch {}
}
- sendMessageRecord({ type: "dismiss-recording", reason, projectId });
+ // Swallow rejection: if the recorder tab is already dead, the promise
+ // rejects and MV3 treats unhandled rejections as SW health signals.
+ sendMessageRecord({ type: "dismiss-recording", reason, projectId }).catch(
+ () => {},
+ );
chrome.action.setIcon({ path: "assets/icon-34.png" });
// await teardown before recording:false; otherwise handleAlarm fires against torn-down offscreen
diff --git a/src/pages/Background/recording/recordingHelpers.js b/src/pages/Background/recording/recordingHelpers.js
index dcbc294..41c8ed1 100644
--- a/src/pages/Background/recording/recordingHelpers.js
+++ b/src/pages/Background/recording/recordingHelpers.js
@@ -18,27 +18,14 @@ import { sweepRecorderTabs } from "./sweepRecorderTabs";
// Mirrors CloudRecorder.appendUploadTelemetryEvent so BG-side projectId mutations
// land in the same `cloudUploadTelemetryEvents` storage key surfaced by
// buildDiagnosticZip → upload-telemetry.json. Diagnostic-only; best-effort.
-const BG_UPLOAD_TELEMETRY_KEY = "cloudUploadTelemetryEvents";
-const BG_UPLOAD_TELEMETRY_MAX = 300;
+import { appendUploadTelemetryEventSerialized } from "../utils/serializedTelemetryStore";
+
const appendBgUploadTelemetryEvent = async (payload) => {
- try {
- const existing = await chrome.storage.local.get([BG_UPLOAD_TELEMETRY_KEY]);
- const current = Array.isArray(existing?.[BG_UPLOAD_TELEMETRY_KEY])
- ? existing[BG_UPLOAD_TELEMETRY_KEY]
- : [];
- const eventPayload = {
- ts: Date.now(),
- uploaderType: "bg_recording",
- ...payload,
- };
- const next = [...current, eventPayload].slice(-BG_UPLOAD_TELEMETRY_MAX);
- await chrome.storage.local.set({
- [BG_UPLOAD_TELEMETRY_KEY]: next,
- lastUploadTelemetryEvent: eventPayload,
- });
- } catch {
- // best-effort; telemetry must never break recording
- }
+ await appendUploadTelemetryEventSerialized({
+ ts: Date.now(),
+ uploaderType: "bg_recording",
+ ...payload,
+ });
};
export const checkCapturePermissions = async ({ isLoggedIn, isSubscribed }) => {
@@ -184,12 +171,8 @@ export const handleRecordingError = async (request) => {
]);
const preserveMultiProject =
Boolean(multiMode) && Number(multiSceneCount) > 0;
- // Clear sceneId/sceneIdStatus/pendingSceneIndex when projectId
- // clears; a retry inheriting a stale sceneId reaches the
- // cloudrecorder with projectId=null and sceneIdStatus="recording".
- // pendingSceneIndex must clear to `[]`, not null: it's consumed
- // via destructuring defaults that don't fire for null, and a null
- // value crashes the next .includes() in CloudRecorder.
+ // Clear scene state when projectId clears so retries don't inherit it.
+ // pendingSceneIndex must be [], not null (defaults don't fire on null).
const multiState = preserveMultiProject
? {}
: {
diff --git a/src/pages/Background/recording/startRecording.js b/src/pages/Background/recording/startRecording.js
index 0a648a3..d047fd0 100644
--- a/src/pages/Background/recording/startRecording.js
+++ b/src/pages/Background/recording/startRecording.js
@@ -81,22 +81,37 @@ const _startRecordingInner = async (caller) => {
const recordingAttemptId = makeRecordingAttemptId();
// only gate countdown-finished; direct/fallback/restart don't share it.
try {
- const { recordingStoppedAt, recording, restarting } =
- await chrome.storage.local.get([
- "recordingStoppedAt",
- "recording",
- "restarting",
- ]);
+ const {
+ recordingStoppedAt,
+ recording,
+ restarting,
+ countdownStartedAt,
+ countdownFinishedAt,
+ } = await chrome.storage.local.get([
+ "recordingStoppedAt",
+ "recording",
+ "restarting",
+ "countdownStartedAt",
+ "countdownFinishedAt",
+ ]);
const sinceStopMs =
typeof recordingStoppedAt === "number"
? Date.now() - recordingStoppedAt
: null;
+ // Countdown after prior stop = fresh back-to-back, not stale dispatch.
+ const countdownIsFresh =
+ typeof recordingStoppedAt === "number" &&
+ ((typeof countdownStartedAt === "number" &&
+ countdownStartedAt > recordingStoppedAt) ||
+ (typeof countdownFinishedAt === "number" &&
+ countdownFinishedAt > recordingStoppedAt));
if (
caller === "countdown-finished" &&
sinceStopMs !== null &&
sinceStopMs < STALE_START_WINDOW_MS &&
!recording &&
- !restarting
+ !restarting &&
+ !countdownIsFresh
) {
console.warn(
"[Screenity][BG] startRecording aborted: prior recording stopped",
@@ -179,12 +194,8 @@ const _startRecordingInner = async (caller) => {
"recordingType",
]);
- // Close every prior editor tab. OPFS wipes the previous recording
- // when a new one starts, so a stale editor on old backing data is
- // worse than closing it. URL-based sweep (not cached `sandboxTab`)
- // because sandboxTab only tracks the LAST editor; consecutive
- // recordings would orphan earlier ones. recordingStartingAt above
- // keeps the cascading close from sweeping the new recorder tab.
+ // Close every prior editor tab by URL (sandboxTab only tracks the last).
+ // OPFS wipes on new recording, so a stale editor would read missing data.
try {
const editorUrls = [
chrome.runtime.getURL("editor.html"),
@@ -243,12 +254,8 @@ const _startRecordingInner = async (caller) => {
lastStartRecordingCaller: { caller, stack, ts: Date.now() },
});
- // Clear leaked sceneId from a prior standalone recording; the
- // cloudrecorder reads storage at start and a stale value tags the
- // new recording's telemetry. Only clear sceneId/sceneIdStatus, NOT
- // pendingSceneIndex: it's an array with a `= []` destructuring
- // default that only covers `undefined`; setting it null makes
- // `.includes()` throw. Its own upsert/remove lifecycle owns it.
+ // Clear leaked sceneId so cloudrecorder doesn't tag new telemetry with it.
+ // pendingSceneIndex owns its own lifecycle; null would crash its .includes().
const {
recordingToScene,
multiMode,
diff --git a/src/pages/Background/recording/stopRecording.js b/src/pages/Background/recording/stopRecording.js
index 1ef7f86..8804006 100644
--- a/src/pages/Background/recording/stopRecording.js
+++ b/src/pages/Background/recording/stopRecording.js
@@ -391,11 +391,9 @@ export const stopRecording = async () => {
chrome.runtime.sendMessage({ type: "turn-off-pip" });
}
- // Hold the diag session open until editorReadyAt lands or 90s passes
- // so sandbox-side events from the editor load make it into the zip.
- // Closing here used to drop everything past stop+~17ms.
- // never clear recordingTab here; cleanup runs in handleRecordingComplete /
- // onTabRemoved / openRecorderTab safety net
+ // Hold the diag session open until editorReadyAt or 90s, so sandbox-side
+ // events from the editor load make it into the zip. Don't clear
+ // recordingTab here; cleanup runs in handleRecordingComplete / onTabRemoved.
(async () => {
const SESSION_DEFER_TIMEOUT_MS = 90_000;
const POLL_INTERVAL_MS = 500;
@@ -571,24 +569,39 @@ export const handleStopRecordingTab = async (request) => {
return;
}
let settled = false;
- const safetyTimer = setTimeout(() => {
- if (!settled) {
- settled = true;
- console.warn("[Screenity][BG] Editor tab load timed out; releasing lock");
- diagEvent("editor-open-timeout", { tabId: tab.id, type: "editorwebcodecs" });
- releasePostStopEditorLock();
- markEditorStartFailed(
- tab.id,
- "EDITOR_TAB_LOAD_TIMEOUT",
- "editor tab never reached status=complete within 15s",
- );
- }
- }, 15000);
- chrome.tabs.onUpdated.addListener(function _(
- tabId,
- changeInfo,
- updatedTab,
- ) {
+ let onUpdatedListener = null;
+ // 45s tolerates slow OPFS/editor mounts (saw 24s in prod); on fire
+ // we re-check tab.status to avoid a phantom fail over a loaded tab.
+ const safetyTimer = setTimeout(async () => {
+ if (settled) return;
+ try {
+ const cur = await chrome.tabs.get(tab.id);
+ if (cur?.status === "complete") {
+ // 'complete' fired between the check and listener removal.
+ if (onUpdatedListener) {
+ chrome.tabs.onUpdated.removeListener(onUpdatedListener);
+ }
+ if (settled) return;
+ settled = true;
+ chrome.storage.local.set({ sandboxTab: tab.id });
+ releasePostStopEditorLock();
+ sendMessageTab(tab.id, { type: "fallback-recording" }).catch(
+ () => {},
+ );
+ return;
+ }
+ } catch {}
+ settled = true;
+ console.warn("[Screenity][BG] Editor tab load timed out; releasing lock");
+ diagEvent("editor-open-timeout", { tabId: tab.id, type: "editorwebcodecs" });
+ releasePostStopEditorLock();
+ markEditorStartFailed(
+ tab.id,
+ "EDITOR_TAB_LOAD_TIMEOUT",
+ "editor tab never reached status=complete within 45s",
+ );
+ }, 45000);
+ onUpdatedListener = function _(tabId, changeInfo, updatedTab) {
if (tabId === tab.id && changeInfo.status === "complete") {
chrome.tabs.onUpdated.removeListener(_);
if (settled) return;
@@ -610,7 +623,8 @@ export const handleStopRecordingTab = async (request) => {
},
);
}
- });
+ };
+ chrome.tabs.onUpdated.addListener(onUpdatedListener);
},
);
} else {
@@ -630,24 +644,38 @@ export const handleStopRecordingTab = async (request) => {
}
perfMark("BG.stopRecording editor-tab-create.done", { tabId: tab.id });
let settled = false;
- const safetyTimer = setTimeout(() => {
- if (!settled) {
- settled = true;
- console.warn("[Screenity][BG] Editor tab load timed out; releasing lock");
- diagEvent("editor-open-timeout", { tabId: tab.id, type: editorUrl });
- releasePostStopEditorLock({ postStopRecordingId: null });
- markEditorStartFailed(
- tab.id,
- "EDITOR_TAB_LOAD_TIMEOUT",
- "editor tab never reached status=complete within 15s",
- );
- }
- }, 15000);
- chrome.tabs.onUpdated.addListener(function _(
- tabId,
- changeInfo,
- updatedTab,
- ) {
+ let onUpdatedListener = null;
+ // See matching block above for rationale (45s + final-check).
+ const safetyTimer = setTimeout(async () => {
+ if (settled) return;
+ try {
+ const cur = await chrome.tabs.get(tab.id);
+ if (cur?.status === "complete") {
+ if (onUpdatedListener) {
+ chrome.tabs.onUpdated.removeListener(onUpdatedListener);
+ }
+ if (settled) return;
+ settled = true;
+ endTabLoad({ result: "loaded-late" });
+ chrome.storage.local.set({
+ sandboxTab: tab.id,
+ postStopRecordingId: null,
+ });
+ releasePostStopEditorLock({ postStopRecordingId: null });
+ return;
+ }
+ } catch {}
+ settled = true;
+ console.warn("[Screenity][BG] Editor tab load timed out; releasing lock");
+ diagEvent("editor-open-timeout", { tabId: tab.id, type: editorUrl });
+ releasePostStopEditorLock({ postStopRecordingId: null });
+ markEditorStartFailed(
+ tab.id,
+ "EDITOR_TAB_LOAD_TIMEOUT",
+ "editor tab never reached status=complete within 45s",
+ );
+ }, 45000);
+ onUpdatedListener = function _(tabId, changeInfo, updatedTab) {
if (tabId === tab.id && changeInfo.status === "complete") {
chrome.tabs.onUpdated.removeListener(_);
if (settled) return;
@@ -757,7 +785,8 @@ export const handleStopRecordingTab = async (request) => {
})();
}
}
- });
+ };
+ chrome.tabs.onUpdated.addListener(onUpdatedListener);
});
}
}
diff --git a/src/pages/Background/utils/serializedTelemetryStore.js b/src/pages/Background/utils/serializedTelemetryStore.js
new file mode 100644
index 0000000..65bd57c
--- /dev/null
+++ b/src/pages/Background/utils/serializedTelemetryStore.js
@@ -0,0 +1,33 @@
+const STORAGE_KEY = "cloudUploadTelemetryEvents";
+const MAX_EVENTS = 300;
+
+let writeChain = Promise.resolve();
+
+export const appendUploadTelemetryEventSerialized = async (event) => {
+ if (!event || typeof event !== "object") return false;
+ const job = writeChain.then(async () => {
+ const existing = await chrome.storage.local.get([STORAGE_KEY]);
+ const current = Array.isArray(existing?.[STORAGE_KEY])
+ ? existing[STORAGE_KEY]
+ : [];
+ const next = [...current, event].slice(-MAX_EVENTS);
+ await chrome.storage.local.set({
+ [STORAGE_KEY]: next,
+ lastUploadTelemetryEvent: event,
+ });
+ });
+ writeChain = job.catch(() => {});
+ try {
+ await job;
+ return true;
+ } catch (err) {
+ // Don't throw (telemetry can't break recording), but log loudly: silent
+ // event loss is the bug this serializer was added to fix.
+ console.warn(
+ "[serializedTelemetryStore] write failed; event lost:",
+ err?.message || err,
+ { eventType: event?.event || event?.type || null },
+ );
+ return false;
+ }
+};
diff --git a/src/pages/Backup/Backup.jsx b/src/pages/Backup/Backup.jsx
index a12c5a9..119aac0 100644
--- a/src/pages/Backup/Backup.jsx
+++ b/src/pages/Backup/Backup.jsx
@@ -1,4 +1,5 @@
import React, { useState, useEffect, useRef } from "react";
+import GradientBackground from "../Components/GradientBackground";
import localforage from "localforage";
@@ -328,6 +329,7 @@ const Backup = () => {
return (
<div className="setupBackground">
+ <GradientBackground />
{!setupComplete && !backupAgain && (
<div className="setupContainer">
<div className="setupImage">
@@ -449,12 +451,6 @@ const Backup = () => {
padding: 0;
min-height: 100%;
background-color: #F6F7FB!important;
- background: url('` +
- chrome.runtime.getURL("assets/helper/pattern-svg.svg") +
- `') repeat;
- background-size: 62px 23.5px;
- animation: moveBackground 138s linear infinite;
- transform: rotate(0deg);
}
.button-strong {
@@ -541,15 +537,6 @@ const Backup = () => {
text-decoration: none!important;
color: #4C7DE2;
}
-
- @keyframes moveBackground {
- 0% {
- background-position: 0 0;
- }
- 100% {
- background-position: 100% 0;
- }
- }
.setupActions {
margin-top: 28px;
@@ -615,6 +602,7 @@ const Backup = () => {
display: flex;
justify-content: center;
align-items: center;
+ isolation: isolate;
}
.setupContainer {
diff --git a/src/pages/Camera/Camera.jsx b/src/pages/Camera/Camera.jsx
index 7ee085e..2669ace 100644
--- a/src/pages/Camera/Camera.jsx
+++ b/src/pages/Camera/Camera.jsx
@@ -102,8 +102,15 @@ const Camera = () => {
return () => clearTimeout(id);
}, [loadingStates.modelLoading]);
+ // Re-entry guard. Toggling camera off while getUserMedia is still
+ // in-flight made stopCameraStream operate on a half-built stream, so
+ // the device lock stayed and the LED stayed on.
+ const isAcquiringRef = useRef(false);
+
const acquireStream = () => {
if (!videoRef.current || streamRef.current?.active) return;
+ if (isAcquiringRef.current) return;
+ isAcquiringRef.current = true;
updateLoadingState("videoElement", true);
chrome.storage.local.get(["defaultVideoInput"], (result) => {
const constraints =
@@ -119,7 +126,10 @@ const Camera = () => {
offScreenCanvasContextRef,
{
onStart: () => updateLoadingState("videoElement", true),
- onFinish: () => updateLoadingState("videoElement", false),
+ onFinish: () => {
+ updateLoadingState("videoElement", false);
+ isAcquiringRef.current = false;
+ },
}
);
});
diff --git a/src/pages/CloudRecorder/CloudRecorder.jsx b/src/pages/CloudRecorder/CloudRecorder.jsx
index b72f137..0da568c 100644
--- a/src/pages/CloudRecorder/CloudRecorder.jsx
+++ b/src/pages/CloudRecorder/CloudRecorder.jsx
@@ -9,6 +9,7 @@ import BunnyTusUploader from "./bunnyTusUploader";
import localforage from "localforage";
import { createVideoProject } from "./createVideoProject";
import { getUserMediaWithFallback } from "../utils/mediaDeviceFallback";
+import { shouldAcquireMicAtStart } from "../utils/micAcquisitionPolicy";
import { traceStep } from "../utils/startFlowTrace";
import { IS_OFFSCREEN_HOST } from "../utils/recordingHost";
import { startPrewarm, stopPrewarm } from "../Recorder/streamWarmup";
@@ -163,6 +164,10 @@ const CloudRecorder = () => {
const isRestarting = useRef(false);
const isFinishing = useRef(false);
+ // Re-entry guard for setMic()'s lazy acquire branch (see Recorder.jsx).
+ const isLazyAcquiringMic = useRef(false);
+ // Latest mic-toggle intent so a mid-acquire toggle-off is honored.
+ const pendingMicIntent = useRef(null);
const sentLast = useRef(false);
const lastTimecode = useRef(0);
const hasChunks = useRef(false);
@@ -1214,6 +1219,45 @@ const CloudRecorder = () => {
startScreenTrackMonitor();
};
+ // Camera-track lifecycle listener. Unlike bindScreenTrack, a camera
+ // unplug doesn't tear down the recording: screen + audio are still
+ // healthy, so we only log diag and surface a non-fatal toast.
+ const bindCameraTrack = (track) => {
+ if (!track) return;
+ try {
+ track.onended = () => {
+ const diag = {
+ reason: "camera-track-ended",
+ label: track?.label || null,
+ readyState: track?.readyState || null,
+ ts: Date.now(),
+ hasChunks: hasChunks.current,
+ recorderState: cameraRecorder.current?.state || null,
+ };
+ console.warn(
+ "🔴 Camera track ended unexpectedly (e.g. USB unplug)",
+ diag,
+ );
+ try {
+ chrome.runtime.sendMessage({
+ type: "diag-forward",
+ event: "cloudrecorder-camera-track-ended",
+ data: diag,
+ });
+ } catch {}
+ };
+ track.onmute = () => {
+ try {
+ chrome.runtime.sendMessage({
+ type: "diag-forward",
+ event: "cloudrecorder-camera-track-muted",
+ data: { label: track?.label || null },
+ });
+ } catch {}
+ };
+ } catch {}
+ };
+
const startScreenTrackMonitor = () => {
if (screenTrackMonitor.current) clearInterval(screenTrackMonitor.current);
screenTrackMonitor.current = setInterval(() => {
@@ -2496,6 +2540,7 @@ const CloudRecorder = () => {
};
const setMic = async (result) => {
+ pendingMicIntent.current = Boolean(result.active);
if (micStream.current && audioInputGain.current) {
audioInputGain.current.gain.value = result.active ? 1 : 0;
@@ -2504,6 +2549,51 @@ const CloudRecorder = () => {
track.enabled = result.active;
});
}
+ return;
+ }
+
+ // Cold-start path: mic was off at recording start; acquire now and
+ // wire into the existing graph.
+ if (
+ result.active &&
+ !rawMicStream.current &&
+ aCtx.current &&
+ destination.current
+ ) {
+ if (isLazyAcquiringMic.current) return;
+ isLazyAcquiringMic.current = true;
+ try {
+ const deviceId =
+ result.defaultAudioInput ||
+ (await chrome.storage.local.get(["defaultAudioInput"])).defaultAudioInput;
+ const acquired = await startAudioStream(deviceId);
+ const acquireFailed =
+ !acquired || !acquired.getAudioTracks().length;
+ const tornDown =
+ !aCtx.current || !destination.current || isFinishing.current;
+ const userCanceled = pendingMicIntent.current === false;
+ if (acquireFailed || tornDown || userCanceled) {
+ try {
+ acquired?.getTracks?.().forEach((t) => t.stop());
+ } catch {}
+ // See Recorder.jsx setMic for rationale.
+ if (acquireFailed && !tornDown && !userCanceled) {
+ try {
+ chrome.storage.local.set({ micActive: false });
+ } catch {}
+ }
+ return;
+ }
+ rawMicStream.current = acquired;
+ audioInputGain.current = aCtx.current.createGain();
+ const micSource = aCtx.current.createMediaStreamSource(acquired);
+ micSource.connect(audioInputGain.current).connect(destination.current);
+ // Point micStream.current at the mixed destination, matching the
+ // eager path.
+ micStream.current = destination.current.stream;
+ } finally {
+ isLazyAcquiringMic.current = false;
+ }
}
};
@@ -3207,7 +3297,38 @@ const CloudRecorder = () => {
const createMediaRecorder = (stream, options, onDataAvailable) => {
try {
- const recorder = new MediaRecorder(stream, options);
+ // Pro hardcodes one mimeType per track. On Linux with some GPU
+ // drivers + WebCodecs sticky-disabled, construct throws with no
+ // user fallback, so probe Free's MIME_TYPES list first.
+ let effectiveOptions = options;
+ const requested = options?.mimeType;
+ if (
+ requested &&
+ typeof MediaRecorder.isTypeSupported === "function" &&
+ !MediaRecorder.isTypeSupported(requested)
+ ) {
+ const candidates = [
+ "video/webm;codecs=vp9,opus",
+ "video/webm;codecs=vp8,opus",
+ "video/webm;codecs=h264,opus",
+ "video/webm;codecs=avc1,opus",
+ "video/webm",
+ requested.startsWith("audio/") ? "audio/webm" : null,
+ ].filter(Boolean);
+ const fallback = candidates.find((m) =>
+ MediaRecorder.isTypeSupported(m),
+ );
+ if (fallback) {
+ console.warn(
+ "[CloudRecorder] requested mimeType unsupported, falling back",
+ { requested, fallback },
+ );
+ effectiveOptions = { ...options, mimeType: fallback };
+ }
+ // No fallback either: fall through and let construct throw so
+ // the outer catch surfaces the real error.
+ }
+ const recorder = new MediaRecorder(stream, effectiveOptions);
// Track in-flight write() promises so stopAllRecorders can
// drain them before finalize(); a late ondataavailable would
// otherwise race finalize and silently truncate the upload.
@@ -3232,6 +3353,22 @@ const CloudRecorder = () => {
};
recorder.onerror = (event) => {
+ const errName = event?.error?.name || "";
+ const errMsg = String(event?.error?.message || "").toLowerCase();
+ // InvalidStateError / "not in recording state" / "already
+ // inactive" are harmless stop()-after-teardown races. Mirrors
+ // the Free/Region filter; real errors still hit sendRecordingError.
+ const isTransient =
+ errName === "InvalidStateError" ||
+ errMsg.includes("not in recording state") ||
+ errMsg.includes("already inactive");
+ if (isTransient) {
+ console.warn("[CloudRecorder] transient MR error ignored", {
+ name: errName,
+ message: event?.error?.message,
+ });
+ return;
+ }
console.error("MediaRecorder error:", event.error);
sendRecordingError("Recording error: " + event.error?.message);
};
@@ -3284,7 +3421,7 @@ const CloudRecorder = () => {
headroom,
});
sendRecordingError(
- "Not enough browser storage available to record. Free up disk space and try again.",
+ chrome.i18n.getMessage("storageFullRecordingError"),
);
logStartFlow("recording_error", {
reason: "preflight-low-quota",
@@ -3301,7 +3438,7 @@ const CloudRecorder = () => {
headroom,
});
sendRecordingError(
- "Your browser is almost out of storage. Free up space and try again to avoid losing the recording.",
+ chrome.i18n.getMessage("storageLowRecordingWarning"),
);
logStartFlow("recording_error", {
reason: "preflight-critical-headroom",
@@ -4083,9 +4220,23 @@ const CloudRecorder = () => {
]);
if (stopStreams) {
+ // Null the refs or Chrome keeps the tab-capture binding.
[screenStream, cameraStream, micStream, rawMicStream].forEach((ref) => {
ref.current?.getTracks().forEach((track) => track.stop());
+ ref.current = null;
});
+ tabID.current = null;
+ // Close the AudioContext: without this the audio thread keeps
+ // ticking and back-to-back Pro multi recordings stack contexts.
+ if (aCtx.current) {
+ try {
+ await aCtx.current.close();
+ } catch {}
+ aCtx.current = null;
+ }
+ destination.current = null;
+ audioInputGain.current = null;
+ audioOutputGain.current = null;
}
};
@@ -4858,6 +5009,13 @@ const CloudRecorder = () => {
});
}
}
+ pausedStateRef.current = false;
+ stopAllIntervals();
+
+ // Drain recorders before clearing `recording` so the next start
+ // gets a free tab-capture binding.
+ await stopAllRecorders();
+ stopFlowRef.current?.tick?.("recorders-drained");
await setRecordingTimingState({
recording: false,
paused: false,
@@ -4865,11 +5023,6 @@ const CloudRecorder = () => {
pausedAt: null,
totalPausedMs: 0,
});
- pausedStateRef.current = false;
- stopAllIntervals();
-
- await stopAllRecorders();
- stopFlowRef.current?.tick?.("recorders-drained");
const { sceneId } = await chrome.storage.local.get(["sceneId"]);
const uploadMeta = {
@@ -4917,6 +5070,24 @@ const CloudRecorder = () => {
await flushPendingChunks();
let finalizeError = null;
+ const finalizeSkipped = [];
+ if (uploadMeta.screen && !screenUploader.current) {
+ finalizeSkipped.push("screen");
+ }
+ if (uploadMeta.camera && !cameraUploader.current) {
+ finalizeSkipped.push("camera");
+ }
+ if (finalizeSkipped.length > 0) {
+ console.error(
+ "[CloudRecorder] finalize skipped: uploader went null before finalize",
+ { tracks: finalizeSkipped, reason },
+ );
+ void emitUploadTelemetry("upload_finalize_skipped", {
+ tracks: finalizeSkipped,
+ reason,
+ uploaderType: "cloud_recorder",
+ });
+ }
const finalizeCalls = [
screenUploader.current?.finalize?.(),
cameraUploader.current?.finalize?.(),
@@ -5391,6 +5562,22 @@ const CloudRecorder = () => {
);
};
+ // Camera is acquired before screen on the dual-track path, so a
+ // screen failure leaves the camera LED on until GC. Call before any
+ // early-return-after-screen-fail. Free acquires screen first.
+ const stopCameraStreamIfAlive = () => {
+ const cs = cameraStream.current;
+ if (!cs) return;
+ try {
+ cs.getTracks().forEach((t) => {
+ try {
+ t.stop();
+ } catch {}
+ });
+ } catch {}
+ cameraStream.current = null;
+ };
+
const startStream = async (data, id, permissions, permissions2, streamOpts = {}) => {
const canCaptureSourceAudio =
streamOpts.canRequestAudioTrack !== false;
@@ -5434,6 +5621,7 @@ const CloudRecorder = () => {
cameraStream.current = await navigator.mediaDevices.getUserMedia(
constraints,
);
+ bindCameraTrack(cameraStream.current?.getVideoTracks?.()[0]);
} catch (err) {
console.warn("⚠️ Failed to access camera stream:", err);
cameraStream.current = null;
@@ -5504,6 +5692,7 @@ const CloudRecorder = () => {
cameraConstraints,
defaultVideoInput,
);
+ bindCameraTrack(cameraStream.current?.getVideoTracks?.()[0]);
} catch (err) {
console.warn(
"⚠️ Camera permission denied; continuing without camera:",
@@ -5684,7 +5873,7 @@ const CloudRecorder = () => {
})
.catch(() => {});
sendRecordingError(
- "No screen stream id available [gUM-no-streamId]",
+ chrome.i18n.getMessage("screenStreamUnavailableError"),
);
return;
}
@@ -5828,12 +6017,16 @@ const CloudRecorder = () => {
},
}).catch(() => {});
// Offscreen tab-mode: pre-acquired streamId failed; retry with getDisplayMedia.
+ // NotReadableError ("device busy", e.g. Zoom/OBS or HW slot
+ // contention) is worth a retry, same as Abort/NotAllowed.
if (
IS_OFFSCREEN_HOST &&
isTab.current &&
id &&
!useDisplayMedia &&
- (err?.name === "AbortError" || err?.name === "NotAllowedError")
+ (err?.name === "AbortError" ||
+ err?.name === "NotAllowedError" ||
+ err?.name === "NotReadableError")
) {
console.warn(
"[CloudRecorder] tab streamId consumption failed - falling back to getDisplayMedia",
@@ -5855,6 +6048,8 @@ const CloudRecorder = () => {
);
bindScreenTrack(screenStream.current.getVideoTracks()[0]);
} catch (fallbackErr) {
+ // Stop the pre-acquired camera so the LED doesn't stay on.
+ stopCameraStreamIfAlive();
if (isUserCaptureCancel(fallbackErr)) {
sendRecordingError(
`User cancelled stream selection [offscreen-tab gDM fallback ${fallbackErr?.name || "?"}]`,
@@ -5863,18 +6058,22 @@ const CloudRecorder = () => {
return;
}
sendRecordingError(
- "Failed to access screen stream: " + fallbackErr.message,
+ chrome.i18n.getMessage("screenStreamUnavailableError"),
);
return;
}
} else if (isUserCaptureCancel(err)) {
+ stopCameraStreamIfAlive();
sendRecordingError(
`User cancelled stream selection [tab-streamId-consume ${err?.name || "?"}]`,
true,
);
return;
} else {
- sendRecordingError("Failed to access screen stream: " + err.message);
+ stopCameraStreamIfAlive();
+ sendRecordingError(
+ chrome.i18n.getMessage("screenStreamUnavailableError"),
+ );
return;
}
}
@@ -5901,6 +6100,7 @@ const CloudRecorder = () => {
cameraConstraints,
defaultVideoInput,
);
+ bindCameraTrack(cameraStream.current?.getVideoTracks?.()[0]);
} catch (err) {
console.warn(
"⚠️ Camera permission denied; continuing without camera:",
@@ -5922,8 +6122,15 @@ const CloudRecorder = () => {
setInitProject(true);
- micStream.current = await startAudioStream(data.defaultAudioInput);
- rawMicStream.current = micStream.current;
+ // If the user disabled the mic, skip getUserMedia: gain-muting still
+ // wakes iPhone Continuity etc. Toggle-on mid-recording goes via setMic().
+ if (shouldAcquireMicAtStart(data)) {
+ micStream.current = await startAudioStream(data.defaultAudioInput);
+ rawMicStream.current = micStream.current;
+ } else {
+ micStream.current = null;
+ rawMicStream.current = null;
+ }
// Mic track death mid-recording (unplug, OS revoke, BT disconnect): toast only,
// since Pro recordings often have system audio worth keeping.
@@ -5931,13 +6138,22 @@ const CloudRecorder = () => {
const rawTrack = rawMicStream.current?.getAudioTracks?.()[0];
if (rawTrack) {
rawTrack.addEventListener("ended", () => {
+ const startMs = screenTimer.current?.start || null;
+ const dur = startMs ? Date.now() - startMs : null;
+ const SALVAGE_THRESHOLD_MS = 30000;
+ const isShort = !dur || dur < SALVAGE_THRESHOLD_MS;
+ const trackLabel = String(rawTrack?.label || "");
+ const isLikelyContinuityMic = /\biphone\b/i.test(trackLabel);
try {
chrome.runtime.sendMessage({
type: "diag-forward",
event: "cloudrecorder-mic-track-ended",
data: {
- trackLabel: String(rawTrack?.label || "").slice(0, 80),
+ trackLabel: trackLabel.slice(0, 80),
readyState: rawTrack?.readyState || null,
+ recordingDuration: dur,
+ isLikelyContinuityMic,
+ salvageOffered: !isShort,
},
});
} catch {}
@@ -5945,7 +6161,11 @@ const CloudRecorder = () => {
chrome.runtime.sendMessage({
type: "recording-error",
error: "stream-ended",
- why: chrome.i18n.getMessage("audioTrackEndedToast"),
+ why: chrome.i18n.getMessage(
+ isShort
+ ? "streamErrorModalDescription"
+ : "audioTrackEndedToast",
+ ),
});
} catch {}
});
@@ -6453,6 +6673,11 @@ const CloudRecorder = () => {
) {
audioRecorder.current.pause();
}
+ // Suspend the audio graph: WebAudio keeps the audio thread
+ // ticking otherwise. Paired with resume below.
+ if (aCtx.current && aCtx.current.state === "running") {
+ aCtx.current.suspend().catch(() => {});
+ }
const now = Date.now();
if (!screenTimer.current.paused && screenTimer.current.start) {
@@ -6485,6 +6710,10 @@ const CloudRecorder = () => {
if (audioRecorder.current && audioRecorder.current.state === "paused") {
audioRecorder.current.resume();
}
+ // Resume the audio graph (paired with suspend in pause).
+ if (aCtx.current && aCtx.current.state === "suspended") {
+ aCtx.current.resume().catch(() => {});
+ }
const now = Date.now();
if (screenTimer.current.paused) {
diff --git a/src/pages/CloudRecorder/RecorderUI.jsx b/src/pages/CloudRecorder/RecorderUI.jsx
index b702ebb..6c08e35 100644
--- a/src/pages/CloudRecorder/RecorderUI.jsx
+++ b/src/pages/CloudRecorder/RecorderUI.jsx
@@ -1,5 +1,6 @@
import React from "react";
import Warning from "./warning/Warning";
+import GradientBackground from "../Components/GradientBackground";
const RecorderUI = ({
started,
@@ -57,7 +58,7 @@ const RecorderUI = ({
{!isTab && !started && <Warning />}
- <div className="setupBackgroundSVG"></div>
+ <GradientBackground subtle />
<style>
{`
@@ -78,27 +79,6 @@ const RecorderUI = ({
margin-right: auto;
z-index: 999999;
}
- .setupBackgroundSVG {
- position: absolute;
- top: 0px;
- left: 0px;
- width: 100%;
- height:100%;
- background: url('${chrome.runtime.getURL(
- "assets/helper/pattern-svg.svg",
- )}') repeat;
- background-size: 62px 23.5px;
- animation: moveBackground 138s linear infinite;
- transform: rotate(0deg);
- }
- @keyframes moveBackground {
- 0% {
- background-position: 0 0;
- }
- 100% {
- background-position: 100% 0;
- }
- }
.logo {
position: absolute;
bottom: 30px;
@@ -114,6 +94,7 @@ const RecorderUI = ({
width: 100%;
height: 100%;
background-color: #F6F7FB;
+ isolation: isolate;
}
.middle-area {
display: flex;
diff --git a/src/pages/CloudRecorder/bunnyTusUploader.js b/src/pages/CloudRecorder/bunnyTusUploader.js
index 5530bfc..ec9ae00 100644
--- a/src/pages/CloudRecorder/bunnyTusUploader.js
+++ b/src/pages/CloudRecorder/bunnyTusUploader.js
@@ -1089,7 +1089,11 @@ export default class BunnyTusUploader {
}
async uploadChunk(chunk) {
if (this.isFinalizing) return;
- const data = new Uint8Array(await chunk.arrayBuffer());
+ let data = new Uint8Array(await chunk.arrayBuffer());
+ const chunkStartOffset = this.offset;
+ // One-shot 401 refresh per chunk. Re-armed each chunk so a token
+ // expiring across many chunks keeps recovering.
+ let didAuth401Refresh = false;
for (let attempt = 0; attempt <= this.MAX_RETRIES; attempt++) {
try {
@@ -1159,6 +1163,29 @@ export default class BunnyTusUploader {
} else {
const errorText = await res.text();
+ // 401 mid-flight: token expired between checkAuthExpiration
+ // and the server's check. Refresh once and retry; a second
+ // 401 falls through as non-transient.
+ if (res.status === 401 && !didAuth401Refresh) {
+ didAuth401Refresh = true;
+ console.warn(
+ "[bunnyTusUploader] 401 mid-PATCH; refreshing TUS auth + retrying once",
+ );
+ this.emitTelemetry("upload_auth_refresh_after_401", {
+ attempt,
+ });
+ try {
+ await this.refreshTusAuth();
+ continue;
+ } catch (refreshErr) {
+ console.error(
+ "[bunnyTusUploader] refreshTusAuth after 401 failed:",
+ refreshErr,
+ );
+ // Fall through to the generic error throw.
+ }
+ }
+
// Session invalidated; fatal so callers can fall back.
if (res.status === 404) {
this.status = "error";
@@ -1210,13 +1237,33 @@ export default class BunnyTusUploader {
}
this.lastServerOffset = serverOffset;
this.offset = serverOffset;
- this.totalBytes = Math.max(this.totalBytes || 0, serverOffset);
this.emitTelemetry("upload_resumed", {
resumedOffset: serverOffset,
reason: "offset-conflict",
});
this.scheduleJournalPersist({ force: true });
+ const chunkEnd = chunkStartOffset + data.length;
+ if (serverOffset >= chunkEnd) {
+ this.emitTelemetry("upload_chunk_skipped_after_resync", {
+ chunkStartOffset,
+ chunkLength: data.length,
+ serverOffset,
+ });
+ this.recordProgress(0);
+ return;
+ }
+ if (serverOffset > chunkStartOffset) {
+ const trimmedBytes = serverOffset - chunkStartOffset;
+ data = data.subarray(trimmedBytes);
+ this.emitTelemetry("upload_chunk_trimmed_after_resync", {
+ chunkStartOffset,
+ chunkLength: data.length + trimmedBytes,
+ trimmedBytes,
+ serverOffset,
+ });
+ }
+
continue;
}
// serverOffset null/NaN: HEAD response unparseable.
@@ -1510,7 +1557,10 @@ export default class BunnyTusUploader {
},
});
- if (!res.ok && res.status !== 204) {
+ // 410 = Bunny reports the upload is already finalized. Treat as
+ // success; server is the truth, retrying would just loop.
+ const alreadyFinalized = res.status === 410;
+ if (!res.ok && res.status !== 204 && !alreadyFinalized) {
this.setUploaderError("finalize-patch-failed");
throw new Error("Finalization failed");
}
@@ -1518,6 +1568,7 @@ export default class BunnyTusUploader {
this.finalizedAt = Date.now();
this.emitTelemetry("upload_finalize_completed", {
finalizedBytes: this.totalBytes,
+ alreadyFinalized: alreadyFinalized || undefined,
});
this.emitTelemetry("upload_complete_client", {
finalizedBytes: this.totalBytes,
@@ -1633,11 +1684,8 @@ export default class BunnyTusUploader {
this.stallRecoveryInFlight = false;
this.heartbeatTimer = setInterval(() => {
const now = Date.now();
- // Sleep/wake: timers don't fire while asleep, but on wake fire
- // missed ticks back-to-back. Skip ticks whose wall-clock gap is
- // much shorter than HEARTBEAT_INTERVAL_MS, otherwise an 8hr sleep
- // stacks ~2880 ticks and each runs stall recovery, flooding
- // the network on wake.
+ // Skip wake-burst ticks: an 8hr sleep stacks ~2880 missed ticks and
+ // each would run stall recovery, flooding the network on wake.
const sinceLastTick = now - (this.lastHeartbeatTickAt || 0);
this.lastHeartbeatTickAt = now;
if (sinceLastTick < Math.floor(this.HEARTBEAT_INTERVAL_MS * 0.5)) {
@@ -1719,6 +1767,7 @@ export default class BunnyTusUploader {
stallMs,
serverOffset,
});
+ this.maybeAutoFinalize();
}
}
}
@@ -1730,6 +1779,28 @@ export default class BunnyTusUploader {
}
}
+ maybeAutoFinalize() {
+ if (this.isFinalizing) return;
+ if (this.status === "completed" || this.status === "aborted") return;
+ if (this.totalBytes <= 0) return;
+ // Trigger when offset >= totalBytes (used to be strict equality,
+ // which deadlocked when 409 resync set offset past totalBytes from
+ // a prior session's unjournaled bytes).
+ if (this.offset < this.totalBytes) return;
+ if (this.chunkQueue.length > 0) return;
+ if (this.pendingUploads.length > 0) return;
+ const sinceLastWrite = Date.now() - (this.lastChunkQueuedAt || 0);
+ if (this.lastChunkQueuedAt && sinceLastWrite < this.HEARTBEAT_LAG_MS) return;
+ this.emitTelemetry("upload_auto_finalize_triggered", {
+ sinceLastWriteMs: sinceLastWrite,
+ offset: this.offset,
+ totalBytes: this.totalBytes,
+ });
+ this.finalize().catch((err) => {
+ console.warn("[bunnyTusUploader] auto-finalize failed:", err?.message || err);
+ });
+ }
+
stopHeartbeat() {
if (this.heartbeatTimer) clearInterval(this.heartbeatTimer);
this.heartbeatTimer = null;
diff --git a/src/pages/CloudRecorder/encoder/WebCodecsTrackRecorder.js b/src/pages/CloudRecorder/encoder/WebCodecsTrackRecorder.js
index 0cd9f3a..67ad48a 100644
--- a/src/pages/CloudRecorder/encoder/WebCodecsTrackRecorder.js
+++ b/src/pages/CloudRecorder/encoder/WebCodecsTrackRecorder.js
@@ -25,6 +25,8 @@ export class WebCodecsTrackRecorder {
// Used by cloud's camera path on macOS to force a software h264
// encoder, sidestepping VideoToolbox's per-process HW-slot serialization.
this.preferSoftware = Boolean(options.preferSoftware);
+ // Namespaces the decoderConfig sidecar so dual-track keys don't collide.
+ this.trackKind = options.trackKind || "default";
// MediaRecorder-shape fields used by callers.
this._state = "inactive";
this.ondataavailable = null;
@@ -57,10 +59,7 @@ export class WebCodecsTrackRecorder {
}
start(_timeslice) {
- // The timeslice arg is a no-op here; Mp4MuxerWrapper emits fragments
- // on its own ~1s cadence, which is comparable to the 2000ms timeslice
- // cloud uses with MediaRecorder. Timing differs slightly but the
- // chunk-write contract (Blob events) is the same.
+ // timeslice is a no-op: Mp4MuxerWrapper emits on its own ~1s cadence.
if (this._state !== "inactive") {
throw new Error(
`WebCodecsTrackRecorder: cannot start in state ${this._state}`,
@@ -99,14 +98,47 @@ export class WebCodecsTrackRecorder {
const handleError = (err) => {
// Sticky-disable handling for non-transient WebCodecs failures lives
// outside this class (see chooseEncoder.js + CloudRecorder.jsx).
- // Surface to the caller via the MediaRecorder-shape onerror.
+ // Preserves err.finalized so callers can skip sticky-disable on salvage.
dispatchError(this.onerror, err);
};
+ // Per-track sidecar (screen/camera/audio) so a future orphan-recovery
+ // path can rebuild moov from chunks. No reader exists yet; mediabunny's
+ // fragmented fastStart writes moov upfront, so this is reserved.
+ const handleDecoderConfig = (cfg) => {
+ try {
+ const desc = cfg?.description;
+ let descBase64 = null;
+ if (desc instanceof Uint8Array || desc instanceof ArrayBuffer) {
+ const u8 = desc instanceof ArrayBuffer ? new Uint8Array(desc) : desc;
+ let binary = "";
+ for (let i = 0; i < u8.length; i++) {
+ binary += String.fromCharCode(u8[i]);
+ }
+ descBase64 = btoa(binary);
+ }
+ chrome.storage.local.get(["cloudRecorderDecoderConfig"]).then((r) => {
+ const merged = {
+ ...(r?.cloudRecorderDecoderConfig || {}),
+ [this.trackKind]: {
+ codec: cfg?.codec || null,
+ container: cfg?.container || null,
+ width: cfg?.width || null,
+ height: cfg?.height || null,
+ description: descBase64,
+ at: Date.now(),
+ },
+ };
+ chrome.storage.local.set({ cloudRecorderDecoderConfig: merged });
+ });
+ } catch {}
+ };
+
this._recorder = new WebCodecsRecorder(this.stream, {
onChunk: handleChunk,
onFinalized: handleFinalized,
onError: handleError,
+ onDecoderConfig: handleDecoderConfig,
enableAudio: this.enableAudio,
videoBitrate: this.videoBitsPerSecond,
audioBitrate: this.audioBitsPerSecond,
@@ -119,11 +151,8 @@ export class WebCodecsTrackRecorder {
});
this._state = "recording";
- // underlying recorder.start() is async; dispatch and don't block,
- // since MediaRecorder.start() is sync to the caller and startup
- // errors flow through onerror.
- // release the synthetic prewarm encoder's HW slot before the real one
- // opens, otherwise VideoToolbox contends for the first ~30 frames.
+ // MediaRecorder.start() is sync to callers; dispatch and route errors
+ // via onerror. Release the prewarm HW slot first or VideoToolbox contends.
Promise.resolve()
.then(() => closeActiveEncoderPrewarm().catch(() => {}))
.then(() => this._recorder.start())
@@ -152,10 +181,7 @@ export class WebCodecsTrackRecorder {
this._state = "recording";
}
- // MediaRecorder.stop() is sync and queues a finalize that fires onstop
- // on completion. mirror that shape: return undefined, callers await
- // onstop. WebCodecsRecorder.stop() is async and resolves after finalize;
- // we hook onFinalized to fire onstop at the right time.
+ // Mirror MediaRecorder.stop(): return undefined; callers await onstop.
stop() {
if (this._state === "inactive") return;
this._state = "inactive";
@@ -166,10 +192,8 @@ export class WebCodecsTrackRecorder {
} catch (err) {
dispatchError(this.onerror, err);
}
- // if onFinalized never fires (rare: muxer hung past internal
- // timeout), force the stop callback so the caller's drain doesn't
- // deadlock. WebCodecsRecorder already has a 5s finalize timeout +
- // flushPending fallback that emits chunks.
+ // Force the stop callback if onFinalized never fires, so the caller's
+ // drain doesn't deadlock on a hung muxer.
if (!this._finalizedResolved) {
this._finalizedResolved = true;
this._onFinalizedResolve?.();
diff --git a/src/pages/CloudRecorder/encoder/chooseEncoder.js b/src/pages/CloudRecorder/encoder/chooseEncoder.js
index 285a3d7..8500019 100644
--- a/src/pages/CloudRecorder/encoder/chooseEncoder.js
+++ b/src/pages/CloudRecorder/encoder/chooseEncoder.js
@@ -11,10 +11,8 @@ import {
import { WebCodecsTrackRecorder } from "./WebCodecsTrackRecorder";
import { probeHwSlots } from "./hwSlotProbe";
-// Mirrors WebCodecsRecorder's resize-canvas math. Cloud uploaders
-// and scene.{screen,camera} need encoded dims, not the source
-// track's native (retina-scale on macOS while encode caps at 1080p).
-// MediaRecorder records native, so callers skip this for it.
+// Encoded dims (capped at 1080p), not source-native. WebCodecs only;
+// MediaRecorder records native, so it skips this.
export const WEBCODECS_CAP_WIDTH = 1920;
export const WEBCODECS_CAP_HEIGHT = 1080;
const HARD_CAP = 3840;
@@ -162,6 +160,7 @@ export const chooseTrackEncoder = async ({
audioBitsPerSecond,
enableAudio,
preferSoftware: Boolean(plan.cameraPreferSoftware),
+ trackKind: track,
});
recorder.ondataavailable = (event) => {
if (event.data && event.data.size > 0) {
@@ -181,12 +180,16 @@ export const chooseTrackEncoder = async ({
};
recorder.onerror = (event) => {
const err = event?.error;
+ // Salvage stop() already ran; don't sticky-disable or double-report.
+ if (err && err.finalized === true) {
+ return;
+ }
console.error(
`[chooseEncoder] WebCodecs ${track} runtime error:`,
err,
);
- // Sticky-disable on hard failures, leave transient ones alone. The
- // gate's marker function distinguishes via its own pattern list.
+ // Pro marks failures per-session (in-memory) instead of persisting
+ // useWebCodecsRecorder=false; fresh HW probes run each session.
void markFastRecorderFailure(`cloud-${track}-runtime`, {
error: String(err?.message || err),
detail: err?.detail || null,
diff --git a/src/pages/Components/GradientBackground.jsx b/src/pages/Components/GradientBackground.jsx
new file mode 100644
index 0000000..57417a8
--- /dev/null
+++ b/src/pages/Components/GradientBackground.jsx
@@ -0,0 +1,54 @@
+import React from "react";
+
+const GradientBackground = ({ subtle = false }) => {
+ const waveMask =
+ "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><path d='M 0 0 L 100 0 L 100 84 C 92 77 68 77 50 84 C 32 91 8 91 0 84 Z' fill='black'/></svg>\")";
+ return (
+ <div
+ className={
+ "screenity-wave-bg" + (subtle ? " screenity-wave-bg--subtle" : "")
+ }
+ aria-hidden="true"
+ >
+ <style>
+ {`
+ .screenity-wave-bg {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+ pointer-events: none;
+ z-index: -1;
+ background-color: #FAFBFE;
+ }
+ .screenity-wave-bg::before {
+ content: "";
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ height: 98vh;
+ pointer-events: none;
+ opacity: 0.55;
+ background:
+ radial-gradient(ellipse 220% 200% at 30% -120%, transparent 72%, rgba(43, 174, 248, 0.16) 88%, transparent 100%),
+ radial-gradient(ellipse 220% 200% at 70% -120%, transparent 72%, rgba(47, 125, 240, 0.2) 88%, transparent 100%);
+ -webkit-mask-image: ${waveMask};
+ mask-image: ${waveMask};
+ -webkit-mask-size: 100% 100%;
+ mask-size: 100% 100%;
+ -webkit-mask-repeat: no-repeat;
+ mask-repeat: no-repeat;
+ }
+ .screenity-wave-bg--subtle::before {
+ opacity: 0.28;
+ }
+ `}
+ </style>
+ </div>
+ );
+};
+
+export default GradientBackground;
diff --git a/src/pages/Content/context/messaging/handlers.js b/src/pages/Content/context/messaging/handlers.js
index 09a0534..feb78e4 100644
--- a/src/pages/Content/context/messaging/handlers.js
+++ b/src/pages/Content/context/messaging/handlers.js
@@ -433,16 +433,19 @@ export const setupHandlers = () => {
});
registerMessage("toggle-popup", async () => {
- // Reconcile stale recording-flow state against storage before
- // showing the popup. The tab may have been suspended during a
- // recording handoff and missed the storage events that clear
- // finalizingRecording / pendingRecording locally; without this,
- // the post-stop loader briefly renders on reopen.
+ // Reconcile from storage: a suspended tab may have missed the events
+ // that clear finalizing/pending or sync multi-mode across tabs.
let storageReconcile = null;
+ let multiReconcile = null;
try {
const snap = await chrome.storage.local.get([
"recording",
"restarting",
+ "multiMode",
+ "multiSceneCount",
+ "multiProjectId",
+ "multiLastSceneId",
+ "projectId",
]);
if (!snap.recording && !snap.restarting) {
storageReconcile = {
@@ -454,6 +457,12 @@ export const setupHandlers = () => {
};
chrome.storage.local.set({ pendingRecording: false }).catch(() => {});
}
+ multiReconcile = {
+ multiMode: Boolean(snap.multiMode),
+ multiSceneCount: Number(snap.multiSceneCount) || 0,
+ multiProjectId: snap.multiProjectId || null,
+ multiLastSceneId: snap.multiLastSceneId || null,
+ };
} catch {}
setContentState((prev) => ({
...prev,
@@ -461,6 +470,7 @@ export const setupHandlers = () => {
hasOpenedBefore: true,
showPopup: true,
...(storageReconcile || {}),
+ ...(multiReconcile || {}),
}));
setTimer(0);
updateFromStorage();
@@ -493,11 +503,8 @@ export const setupHandlers = () => {
countdownActive: true,
isCountdownVisible: true,
countdownCancelled: false,
- // Latching gate: once the countdown is up, the pre-countdown
- // loader can never re-show in this session (even during the
- // brief countdown-end → recording=true storage flip window).
- // Otherwise the loader bleeds into the captured frame for
- // region/desktop captures where the stream is already live.
+ // Latch: the pre-countdown loader must never re-show, or it bleeds
+ // into the captured frame for region/desktop (stream already live).
countdownEverShown: true,
}));
chrome.runtime.sendMessage({ type: "diag-countdown-started" }).catch(() => {});
@@ -513,6 +520,8 @@ export const setupHandlers = () => {
state.stopRecording();
});
+ // Used to nest a second registerMessage call inside the handler,
+ // which added a listener per fire and made the toggle fire N+1 times.
registerMessage("toggle-drawing-mode", () => {
const now = Date.now();
if (now - lastToggleDrawingAt < TOGGLE_DRAWING_COOLDOWN_MS) {
@@ -529,26 +538,9 @@ export const setupHandlers = () => {
drawingMode: nextDrawingMode,
blurMode: nextDrawingMode ? false : prev.blurMode,
}));
-
- registerMessage("toggle-drawing-mode", () => {
- const now = Date.now();
- if (now - lastToggleDrawingAt < TOGGLE_DRAWING_COOLDOWN_MS) return;
- lastToggleDrawingAt = now;
- if (document.hidden || !document.hasFocus()) return;
- if (contentStateRef.current.recordingType === "camera") return;
-
- const nextDrawingMode = !contentStateRef.current.drawingMode;
-
- setContentState((prev) => ({
- ...prev,
- drawingMode: nextDrawingMode,
- blurMode: nextDrawingMode ? false : prev.blurMode,
- }));
-
- chrome.storage.local.set({
- drawingMode: nextDrawingMode,
- ...(nextDrawingMode ? { blurMode: false } : {}),
- });
+ chrome.storage.local.set({
+ drawingMode: nextDrawingMode,
+ ...(nextDrawingMode ? { blurMode: false } : {}),
});
});
@@ -1014,12 +1006,8 @@ export const setupHandlers = () => {
});
registerMessage("reopen-popup-multi", async (message) => {
- // Read multi-state from storage before setContentState so the
- // popup renders with multiMode/multiSceneCount correct on first
- // paint. The old fire-and-forget updateFromStorage() ran AFTER
- // setContentState, which raced and could leave the popup
- // showing the "Multi recording" switch instead of "Done" (stale
- // for hundreds of ms, or persistent across tabs).
+ // Read multi-state from storage before setContentState so the popup's
+ // first paint is correct (a fire-and-forget read would race the render).
let storedMulti = {};
try {
storedMulti = await chrome.storage.local.get([
@@ -1030,12 +1018,8 @@ export const setupHandlers = () => {
"projectId",
]);
} catch {}
- // Multi-scene stop choreography. Scene-create is already done
- // server-side by now. Order: clear loader + recording state
- // (including finalizingRecording, or the loader sticks until the
- // 30s watchdog), toast immediately, popup ~700ms later so the
- // toast settles first. Read multi state from storage; contentState
- // can be stale on a tab that didn't run the recording.
+ // Order: clear all recording state (incl. finalizingRecording, or the
+ // loader sticks for 30s), toast, then popup ~700ms later so toast settles.
const isMulti = Boolean(storedMulti.multiMode);
setContentState((prev) => ({
...prev,
diff --git a/src/pages/Playground/Setup.jsx b/src/pages/Playground/Setup.jsx
index 817adb9..fc93848 100644
--- a/src/pages/Playground/Setup.jsx
+++ b/src/pages/Playground/Setup.jsx
@@ -1,4 +1,5 @@
import React, { useEffect, useState } from "react";
+import GradientBackground from "../Components/GradientBackground";
const Setup = () => {
useEffect(() => {
@@ -28,7 +29,7 @@ const Setup = () => {
src={chrome.runtime.getURL("assets/logo-text.svg")}
className="setupLogo"
/>
- <div className="setupBackgroundSVG"></div>
+ <GradientBackground />
<style>
{`
body {
@@ -43,30 +44,6 @@ const Setup = () => {
text-decoration: none!important;
color: #4C7DE2;
}
- .setupBackgroundSVG {
- position: absolute;
- top: 0px;
- left: 0px;
-
- width: 100%;
- height: 100%;
- background: url('` +
- chrome.runtime.getURL("assets/helper/pattern-svg.svg") +
- `') repeat;
- background-size: 62px 23.5px;
- animation: moveBackground 138s linear infinite;
- }
-
- @keyframes moveBackground {
- 0% {
- background-position: 0 0;
- }
- 100% {
- background-position: 100% 0;
- }
- }
-
-
.setupLogo {
position: absolute;
bottom: 30px;
@@ -84,6 +61,7 @@ const Setup = () => {
display: flex;
justify-content: center;
align-items: center;
+ isolation: isolate;
}
.setupContainer {
diff --git a/src/pages/Recorder/Recorder.jsx b/src/pages/Recorder/Recorder.jsx
index 29cb521..5677b88 100644
--- a/src/pages/Recorder/Recorder.jsx
+++ b/src/pages/Recorder/Recorder.jsx
@@ -14,6 +14,7 @@ import {
closeActiveEncoderPrewarm,
} from "./encoderPrewarm";
import { getUserMediaWithFallback } from "../utils/mediaDeviceFallback";
+import { shouldAcquireMicAtStart } from "../utils/micAcquisitionPolicy";
import { IS_OFFSCREEN_HOST } from "../utils/recordingHost";
import { chooseWriter } from "./recorderStorage/chooseWriter";
import { chooseReader } from "./recorderStorage/chooseReader";
@@ -32,6 +33,7 @@ import {
markFastRecorderFailure,
validateFastRecorderOutputBlob,
isTransientFastRecorderError,
+ isFastRecorderFailureTransient,
} from "../../media/fastRecorderGate";
localforage.config({
@@ -348,6 +350,12 @@ const Recorder = () => {
const audioOutputSource = useRef(null);
const audioInputGain = useRef(null);
const audioOutputGain = useRef(null);
+ // Re-entry guard: the ~400ms startAudioStream await would otherwise let
+ // a second toggle-on acquire a duplicate stream and orphan the first.
+ const isLazyAcquiringMic = useRef(false);
+ // Latest mic-toggle intent. The lazy-acquire path reads this after its
+ // await to honor a toggle-off that landed mid-acquire.
+ const pendingMicIntent = useRef(null);
const recorder = useRef(null);
const useWebCodecs = useRef(false);
@@ -613,6 +621,31 @@ const Recorder = () => {
try { navigator.mediaSession.setActionHandler("pause", null); } catch {}
keepAliveMediaSessionActive.current = false;
}
+ // Tear down the keepalive loopback PC + tick. Tab usually closes after
+ // stop, but persists in multi-mode / slow editor / error paths.
+ try {
+ const KA =
+ typeof window !== "undefined" ? window.__SCREENITY_KEEPALIVE : null;
+ if (KA) {
+ if (KA.priorityTick) {
+ try { clearInterval(KA.priorityTick); } catch {}
+ KA.priorityTick = null;
+ }
+ if (KA.priorityTrack) {
+ try { KA.priorityTrack.stop(); } catch {}
+ KA.priorityTrack = null;
+ }
+ if (KA.priorityPc1) {
+ try { KA.priorityPc1.close(); } catch {}
+ KA.priorityPc1 = null;
+ }
+ if (KA.priorityPc2) {
+ try { KA.priorityPc2.close(); } catch {}
+ KA.priorityPc2 = null;
+ }
+ KA.priorityCanvas = null;
+ }
+ } catch {}
chrome.runtime
.sendMessage({ type: "stop-recorder-keepalive-alarm" })
.catch(() => {});
@@ -655,6 +688,17 @@ const Recorder = () => {
// WebCodecs muxer only emits at finalize, so drive the stall
// watchdog heartbeat from here (lastChunkAt every 10s).
let firstHeartbeat = true;
+ // Resolution drift mid-recording corrupts the MR-fallback WebM
+ // (dims baked into the header). Snapshot now and diag if it shifts.
+ let initialDisplayDims = null;
+ try {
+ const vt = liveStream.current?.getVideoTracks?.()[0];
+ const s = vt?.getSettings?.();
+ if (s && Number.isFinite(s.width) && Number.isFinite(s.height)) {
+ initialDisplayDims = { width: s.width, height: s.height };
+ }
+ } catch {}
+ let resolutionDriftReported = false;
const tick = () => {
if (!isRecording.current) return;
persistSessionState("recording");
@@ -667,6 +711,32 @@ const Recorder = () => {
}
chrome.storage.local.set(update).catch(() => {});
}
+ // Report once; the WebM is already corrupt after first drift.
+ if (!resolutionDriftReported && initialDisplayDims) {
+ try {
+ const vt = liveStream.current?.getVideoTracks?.()[0];
+ const s = vt?.getSettings?.();
+ if (
+ s &&
+ Number.isFinite(s.width) &&
+ Number.isFinite(s.height) &&
+ (s.width !== initialDisplayDims.width ||
+ s.height !== initialDisplayDims.height)
+ ) {
+ resolutionDriftReported = true;
+ chrome.runtime.sendMessage({
+ type: "diag-forward",
+ event: "recorder-resolution-changed-mid-recording",
+ data: {
+ from: initialDisplayDims,
+ to: { width: s.width, height: s.height },
+ useWebCodecs: useWebCodecs.current,
+ savedChunks: savedCount.current,
+ },
+ }).catch(() => {});
+ }
+ } catch {}
+ }
};
tick(); // first heartbeat must land before the 30s stall window
sessionHeartbeat.current = setInterval(tick, 10000);
@@ -730,6 +800,12 @@ const Recorder = () => {
async function saveChunk(e, i) {
const ts = e.timecode ?? 0;
+ // MediaRecorder occasionally fires zero-byte dataavailable
+ // (w3c/mediacapture-record#153); drop before it hits OPFS.
+ if (!e.data || e.data.size === 0) {
+ return;
+ }
+
if (!(await canFitChunk(e.data.size))) {
debugWarn("Low storage, aborting recording");
if (!lowStorageAbort.current) {
@@ -1120,15 +1196,8 @@ const Recorder = () => {
slLog("start-gate-timeout", diagInfo);
chrome.storage.local.set({ lastStreamCheckFail: diagInfo });
resetGateState();
- if (streamingDataReceivedAt.current == null) {
- sendRecordingError(
- "Recording not ready: streaming-data never arrived from background (SW→tab handoff failed)",
- );
- } else {
- sendRecordingError(
- "Recording not ready: screen stream is missing (tab may have been suspended)",
- );
- }
+ // Handoff vs. suspension is logged above; both get the same user copy.
+ sendRecordingError(chrome.i18n.getMessage("streamingDataTimeoutError"));
}, START_GATE_TIMEOUT_MS);
}
@@ -1230,11 +1299,8 @@ const Recorder = () => {
startTabKeepAlive();
- // Fire-and-forget. Awaiting leaves a no-reader gap on the track,
- // which macOS reads as "no demand" and puts capture to sleep
- // (5s re-spin under load, frozen first frame). Not awaiting lets
- // WebCodecsRecorder.start() open its processor while the prewarm
- // reader releases, so the OS sees continuous demand.
+ // Fire-and-forget: awaiting leaves a reader gap that macOS reads as
+ // "no demand" and puts capture to sleep (5s re-spin, frozen first frame).
endPrewarm({ keepClear: true, keepWriter: true });
recordingStartTime.current = Date.now();
@@ -1849,6 +1915,37 @@ const Recorder = () => {
videoEncoderConfig: selectedVideoConfig,
containerKind,
debug: DEBUG_RECORDER,
+ // Sidecar the decoderConfig for a future orphan-recovery path.
+ // Reserved: mediabunny's fragmented fastStart writes moov upfront,
+ // so this isn't read anywhere yet.
+ onDecoderConfig: (cfg) => {
+ try {
+ const desc = cfg?.description;
+ let descBase64 = null;
+ if (desc instanceof Uint8Array || desc instanceof ArrayBuffer) {
+ const u8 = desc instanceof ArrayBuffer
+ ? new Uint8Array(desc)
+ : desc;
+ let binary = "";
+ for (let i = 0; i < u8.length; i++) {
+ binary += String.fromCharCode(u8[i]);
+ }
+ descBase64 = btoa(binary);
+ }
+ chrome.storage.local.set({
+ lastRecorderDecoderConfig: {
+ codec: cfg?.codec || null,
+ container: cfg?.container || null,
+ width: cfg?.width || null,
+ height: cfg?.height || null,
+ description: descBase64,
+ at: Date.now(),
+ },
+ });
+ } catch (err) {
+ debugError("onDecoderConfig persistence failed", err);
+ }
+ },
onFinalized: async (payload) => {
perfMark("Recorder.onFinalized.enter");
debug("WebCodecsRecorder onFinalized()", payload);
@@ -1904,84 +2001,8 @@ const Recorder = () => {
// Fire-and-forget; Chrome throttles storage IPC on bg
// tabs (~10s) and this is just the finalize progress bar.
void updateFreeFinalizeStatus("chunks_ready", 95);
- let validation = null;
- const endValidate = perfSpan("Recorder.onFinalized.validate");
- try {
- const endRebuild = perfSpan("Recorder.onFinalized.rebuildBlob");
- const blob = await rebuildBlobFromChunks();
- endRebuild({ bytes: blob?.size ?? 0 });
- validation = await validateFastRecorderOutputBlob(blob, {
- minBytes: 64 * 1024,
- // Multi-GB demuxer scans on slow disks need ~15s.
- timeoutMs: 15000,
- videoCodec: recorder.current?.selectedVideoCodec || undefined,
- audioCodec: hasAudioTrack ? "mp4a.40.2" : null,
- recordingId,
- });
- debugRecordingEvent(recdbgSessionRef, "fast-recorder-validate", {
- validation,
- });
- } catch (err) {
- validation = {
- ok: false,
- hardFail: true,
- reasons: ["validation-exception"],
- details: { error: String(err) },
- };
- }
- endValidate({ ok: !!(validation && validation.ok) });
-
- if (validation && !validation.ok) {
- await markFastRecorderFailure("validation-failed", validation);
- await chrome.storage.local.set({
- useWebCodecsRecorder: false,
- lastWebCodecsFailureAt: Date.now(),
- lastWebCodecsFailureCode: "validation-failed",
- // Survives subsequent starts (which clear fastRecorderValidation).
- lastFailedValidation: {
- at: Date.now(),
- recordingId,
- validation,
- },
- });
- const hardFail = Boolean(validation.hardFail);
- await chrome.storage.local.set({
- fastRecorderValidationFailed: hardFail,
- fastRecorderValidation: validation,
- });
- void updateFreeFinalizeStatus(
- "failed",
- 100,
- validation.reasons || "validation-failed",
- );
- chrome.runtime.sendMessage({
- type: "show-toast",
- message: chrome.i18n.getMessage("webcodecsFailedOffToast"),
- });
- if (hardFail) {
- // Clear backendRef: prevents the sandbox from reading a stale OPFS file.
- await chrome.storage.local.remove([
- "lastRecordingBackendRef",
- ]);
- chrome.runtime.sendMessage({
- type: "fast-recorder-hard-fail",
- recordingId,
- });
- if (!sentLast.current) {
- sentLast.current = true;
- isFinishing.current = false;
- chrome.runtime.sendMessage({ type: "video-ready" });
- }
- return;
- }
- } else {
- await chrome.storage.local.set({
- fastRecorderValidationFailed: false,
- fastRecorderValidation: validation,
- });
- }
- // Fire-and-forget; editor reads this seconds after tab
- // boot, awaiting hit Chrome's bg-tab IPC throttle (~10s).
+ // Open the editor first (foreground demux is ~100x faster than
+ // this throttled tab); run validation off the critical path.
chrome.storage.local.set({
lastRecordingBackendRef: chunkBackendRef.current || {
backend: "idb",
@@ -1993,6 +2014,55 @@ const Recorder = () => {
isFinishing.current = false;
chrome.runtime.sendMessage({ type: "video-ready" });
}
+ (async () => {
+ let validation = null;
+ const endValidate = perfSpan("Recorder.onFinalized.validate");
+ try {
+ const endRebuild = perfSpan("Recorder.onFinalized.rebuildBlob");
+ const blob = await rebuildBlobFromChunks();
+ endRebuild({ bytes: blob?.size ?? 0 });
+ validation = await validateFastRecorderOutputBlob(blob, {
+ minBytes: 64 * 1024,
+ timeoutMs: 15000,
+ videoCodec: recorder.current?.selectedVideoCodec || undefined,
+ audioCodec: hasAudioTrack ? "mp4a.40.2" : null,
+ recordingId,
+ });
+ debugRecordingEvent(recdbgSessionRef, "fast-recorder-validate", {
+ validation,
+ });
+ } catch (err) {
+ validation = {
+ ok: false,
+ hardFail: true,
+ reasons: ["validation-exception"],
+ details: { error: String(err) },
+ };
+ }
+ endValidate({ ok: !!(validation && validation.ok) });
+ if (validation && !validation.ok) {
+ await markFastRecorderFailure("validation-failed", validation);
+ await chrome.storage.local.set({
+ useWebCodecsRecorder: false,
+ lastWebCodecsFailureAt: Date.now(),
+ lastWebCodecsFailureCode: "validation-failed",
+ lastFailedValidation: {
+ at: Date.now(),
+ recordingId,
+ validation,
+ },
+ fastRecorderValidationFailed: Boolean(validation.hardFail),
+ fastRecorderValidation: validation,
+ });
+ // Sandbox is already loading; skip the toast/hard-fail
+ // broadcast so it doesn't race the sandbox's own load result.
+ } else {
+ await chrome.storage.local.set({
+ fastRecorderValidationFailed: false,
+ fastRecorderValidation: validation,
+ });
+ }
+ })();
},
onChunk: (chunkData, timestampUs) => {
const blob = new Blob([chunkData], { type: "video/mp4" });
@@ -2013,7 +2083,6 @@ const Recorder = () => {
onError: (err) => {
debugError("WebCodecsRecorder error", err);
const errStr = String(err);
- const transient = isTransientFastRecorderError(errStr);
// Prefer the recorder's structured failure code (e.g.
// webcodecs-zero-frames, webcodecs-no-first-chunk) so the
// sticky-disable reason and diagnostics name the real cause
@@ -2022,9 +2091,19 @@ const Recorder = () => {
typeof err?.code === "string" && err.code
? err.code
: "webcodecs-error";
+ // Shared with markFastRecorderFailure so the sticky-disable
+ // and the user-setting flip use the same heuristic.
+ const transient = isFastRecorderFailureTransient(
+ failureCode,
+ errStr,
+ err?.detail || null,
+ );
+ // err.finalized: salvage stop already ran, skip sticky-disable.
+ const fatalFinalized = err?.finalized === true;
markFastRecorderFailure(failureCode, {
error: errStr,
detail: err?.detail || null,
+ finalized: fatalFinalized || undefined,
});
// Transient stream errors don't disable WebCodecs.
const persisted = {
@@ -2036,6 +2115,7 @@ const Recorder = () => {
};
if (!transient) persisted.useWebCodecsRecorder = false;
chrome.storage.local.set(persisted);
+ if (fatalFinalized) return;
updateFreeFinalizeStatus("failed", 100, errStr);
// Same-session fallback: if WebCodecs blew up before any chunk
@@ -2483,15 +2563,25 @@ const Recorder = () => {
};
track.onended = () => {
if (isFinishing.current || !isRecording.current) return;
+ const recordingDuration = recordingStartTime.current
+ ? Date.now() - recordingStartTime.current
+ : null;
+ // Below 30s the salvage prompt would over-promise (Continuity Mic
+ // often drops 10-20s in); reuse the generic stream-error copy.
+ const SALVAGE_THRESHOLD_MS = 30000;
+ const isShort =
+ !recordingDuration || recordingDuration < SALVAGE_THRESHOLD_MS;
+ const trackLabel = String(track?.label || "");
+ const isLikelyContinuityMic = /\biphone\b/i.test(trackLabel);
const diagnosticInfo = {
reason: "audio-track-ended",
savedChunks: savedCount.current,
lastTimecode: lastTimecode.current,
- recordingDuration: recordingStartTime.current
- ? Date.now() - recordingStartTime.current
- : null,
+ recordingDuration,
trackLabel: track?.label || null,
trackReadyState: track?.readyState || null,
+ isLikelyContinuityMic,
+ salvageOffered: !isShort,
};
console.warn(
"[Recorder] Audio track ended unexpectedly",
@@ -2500,7 +2590,11 @@ const Recorder = () => {
chrome.runtime.sendMessage({
type: "recording-error",
error: "stream-ended",
- why: chrome.i18n.getMessage("audioTrackEndedToast"),
+ why: chrome.i18n.getMessage(
+ isShort
+ ? "streamErrorModalDescription"
+ : "audioTrackEndedToast",
+ ),
}).catch(() => {});
chrome.storage.local.set({
recording: false,
@@ -2937,6 +3031,16 @@ const Recorder = () => {
liveStream.current = null;
helperVideoStream.current = null;
helperAudioStream.current = null;
+
+ // Close the audio graph or it keeps ticking the audio thread if
+ // the tab is reused for another recording.
+ if (aCtx.current) {
+ try {
+ await aCtx.current.close();
+ } catch {}
+ aCtx.current = null;
+ }
+ destination.current = null;
}
// Detach devicechange + silence watchdog: otherwise they keep firing for
// subsequent recordings in the same tab with stale state.
@@ -3195,12 +3299,57 @@ const Recorder = () => {
const setMic = async (result) => {
debug("setMic()", result);
+ // Record intent before any early-return so the lazy path can honor a
+ // mid-acquire toggle-off after its await.
+ pendingMicIntent.current = Boolean(result.active);
+
if (helperAudioStream.current != null) {
if (result.active) {
setAudioInputVolume(1);
} else {
setAudioInputVolume(0);
}
+ return;
+ }
+
+ // Cold-start path: mic was off at recording start; acquire now and
+ // splice into the audio graph.
+ if (!result.active || !aCtx.current || !destination.current) return;
+ if (isLazyAcquiringMic.current) return;
+ isLazyAcquiringMic.current = true;
+ try {
+ const deviceId =
+ result.defaultAudioInput ||
+ (await chrome.storage.local.get(["defaultAudioInput"]))
+ .defaultAudioInput;
+ const acquired = await startAudioStream(deviceId);
+ const acquireFailed =
+ !acquired || !acquired.getAudioTracks().length;
+ const tornDown =
+ !aCtx.current || !destination.current || isFinishing.current;
+ const userCanceled = pendingMicIntent.current === false;
+ // Stop tracks immediately so iPhone Continuity releases the device.
+ if (acquireFailed || tornDown || userCanceled) {
+ try {
+ acquired?.getTracks?.().forEach((t) => t.stop());
+ } catch {}
+ // Hidden-tab acquire failure is invisible to the user; flip the
+ // toolbar toggle back to OFF so they see it didn't take effect.
+ if (acquireFailed && !tornDown && !userCanceled) {
+ try {
+ chrome.storage.local.set({ micActive: false });
+ } catch {}
+ }
+ return;
+ }
+ helperAudioStream.current = acquired;
+ const micSource = aCtx.current.createMediaStreamSource(
+ new MediaStream([acquired.getAudioTracks()[0]]),
+ );
+ audioInputGain.current = aCtx.current.createGain();
+ micSource.connect(audioInputGain.current).connect(destination.current);
+ } finally {
+ isLazyAcquiringMic.current = false;
}
};
@@ -3285,11 +3434,13 @@ const Recorder = () => {
});
// Mic acquisition runs in parallel: startAudioStream() ~400ms; await later.
+ // If the user disabled the mic, skip getUserMedia: gain-muting still
+ // wakes iPhone Continuity etc. Toggle-on mid-recording goes via setMic().
const endMicPar = perfSpan("Recorder startAudioStream(mic).parallel", {
hasDevice: Boolean(data?.defaultAudioInput && data.defaultAudioInput !== "none"),
});
const micPromise =
- permissions2?.state === "denied"
+ permissions2?.state === "denied" || !shouldAcquireMicAtStart(data)
? Promise.resolve(null)
: startAudioStream(data.defaultAudioInput).catch((err) => {
debugWarn("startAudioStream parallel kickoff failed", err);
@@ -3881,11 +4032,9 @@ const Recorder = () => {
debug("Streaming with pre-resolved tabID", tabStreamId);
if (!tabStreamId) {
resetGateState();
- const underlying = tabIDError.current
- ? `: ${tabIDError.current}`
- : "";
+ // tabIDError is already logged; keep the user-facing copy generic.
sendRecordingError(
- `Unable to resolve tab stream id${underlying}`,
+ chrome.i18n.getMessage("tabStreamUnavailableError"),
false,
);
return;
@@ -4376,7 +4525,7 @@ const Recorder = () => {
msSinceMount: Date.now() - loadedAt.current,
});
sendRecordingError(
- "Recording not ready: streaming-data never arrived from background",
+ chrome.i18n.getMessage("streamingDataTimeoutError"),
);
}, 15000);
return () => {
diff --git a/src/pages/Recorder/RecorderUI.jsx b/src/pages/Recorder/RecorderUI.jsx
index 04ae6f2..5b7b6f1 100644
--- a/src/pages/Recorder/RecorderUI.jsx
+++ b/src/pages/Recorder/RecorderUI.jsx
@@ -1,6 +1,7 @@
// RecorderUI.jsx
import React from "react";
import Warning from "./warning/Warning";
+import GradientBackground from "../Components/GradientBackground";
const isTabFromUrl = new URLSearchParams(window.location.search).has("tab");
@@ -31,7 +32,7 @@ const RecorderUI = ({ started, isTab }) => {
{!isTab && !started && <Warning />}
- <div className="setupBackgroundSVG"></div>
+ <GradientBackground subtle />
<style>
{`
@@ -52,27 +53,6 @@ const RecorderUI = ({ started, isTab }) => {
margin-right: auto;
z-index: 999999;
}
- .setupBackgroundSVG {
- position: absolute;
- top: 0px;
- left: 0px;
- width: 100%;
- height:100%;
- background: url('${chrome.runtime.getURL(
- "assets/helper/pattern-svg.svg"
- )}') repeat;
- background-size: 62px 23.5px;
- animation: moveBackground 138s linear infinite;
- transform: rotate(0deg);
- }
- @keyframes moveBackground {
- 0% {
- background-position: 0 0;
- }
- 100% {
- background-position: 100% 0;
- }
- }
.logo {
position: absolute;
bottom: 30px;
@@ -88,6 +68,7 @@ const RecorderUI = ({ started, isTab }) => {
width: 100%;
height: 100%;
background-color: #F6F7FB;
+ isolation: isolate;
}
.middle-area {
display: flex;
diff --git a/src/pages/Recorder/recorderConfig.js b/src/pages/Recorder/recorderConfig.js
index bf682cf..1e10f4e 100644
--- a/src/pages/Recorder/recorderConfig.js
+++ b/src/pages/Recorder/recorderConfig.js
@@ -1,10 +1,12 @@
+// Pair video + audio codec explicitly (w3c/mediacapture-record#194):
+// Chrome mis-tags blob.type for unqualified codecs string variants.
export const MIME_TYPES = [
"video/webm;codecs=vp9,opus",
"video/webm;codecs=vp8,opus",
- "video/webm;codecs=h264",
+ "video/webm;codecs=h264,opus",
+ "video/webm;codecs=avc1,opus",
"video/webm",
"video/mp4",
- "video/webm;codecs=avc1",
];
export function getBitrates(quality) {
diff --git a/src/pages/Recorder/recorderKeepalive.js b/src/pages/Recorder/recorderKeepalive.js
index b7f9ccc..56313d1 100644
--- a/src/pages/Recorder/recorderKeepalive.js
+++ b/src/pages/Recorder/recorderKeepalive.js
@@ -1,9 +1,5 @@
-// Keep-alive bootstrap. Loaded from recorder.html before the main
-// bundle. Region recordings open the tab with active:false so Chrome
-// throttles JS within ~1s and bundle parse stretches from 300ms to
-// 3-4.5s. Audio oscillator + navigator.locks + mediaSession make the
-// tab look active before throttling. Handles on window.__SCREENITY_KEEPALIVE
-// so React's startTabKeepAlive() reuses them.
+// Keep-alive bootstrap. Loads pre-bundle to dodge Chrome's background-tab
+// throttle on region recordings. Handles hang off window.__SCREENITY_KEEPALIVE.
(function () {
try {
var KA = (window.__SCREENITY_KEEPALIVE =
@@ -54,6 +50,69 @@
}
} catch (e) {}
+ // Loopback PC with a live video track marks the tab "in a call" so
+ // Chrome keeps the renderer at foreground priority. Host-only ICE.
+ try {
+ if (typeof RTCPeerConnection === "function" && !KA.priorityPc1) {
+ var bcanvas = document.createElement("canvas");
+ bcanvas.width = 2;
+ bcanvas.height = 2;
+ var bctx = bcanvas.getContext("2d");
+ if (bctx) bctx.fillRect(0, 0, 2, 2);
+ // captureStream(0) → no automatic frames; we tick manually so
+ // the track stays "live" without burning CPU on capture.
+ var bstream = bcanvas.captureStream
+ ? bcanvas.captureStream(0)
+ : null;
+ var btrack = bstream ? bstream.getVideoTracks()[0] : null;
+ if (btrack) {
+ var pc1 = new RTCPeerConnection();
+ var pc2 = new RTCPeerConnection();
+ KA.priorityPc1 = pc1;
+ KA.priorityPc2 = pc2;
+ KA.priorityCanvas = bcanvas;
+ KA.priorityTrack = btrack;
+ pc1.onicecandidate = function (e) {
+ if (e.candidate) pc2.addIceCandidate(e.candidate).catch(function () {});
+ };
+ pc2.onicecandidate = function (e) {
+ if (e.candidate) pc1.addIceCandidate(e.candidate).catch(function () {});
+ };
+ pc1.addTrack(btrack, bstream);
+ pc1
+ .createOffer()
+ .then(function (offer) {
+ return pc1.setLocalDescription(offer).then(function () {
+ return pc2.setRemoteDescription(offer);
+ });
+ })
+ .then(function () {
+ return pc2.createAnswer();
+ })
+ .then(function (answer) {
+ return pc2.setLocalDescription(answer).then(function () {
+ return pc1.setRemoteDescription(answer);
+ });
+ })
+ .catch(function () {});
+ // Periodic 1×1 redraw keeps the captureStream track from
+ // being marked ended after the first frame is consumed.
+ KA.priorityTick = setInterval(function () {
+ try {
+ if (bctx) {
+ bctx.fillStyle = bctx.fillStyle === "#000" ? "#001" : "#000";
+ bctx.fillRect(0, 0, 2, 2);
+ }
+ if (bstream && typeof bstream.getVideoTracks === "function") {
+ var t = bstream.getVideoTracks()[0];
+ if (t && typeof t.requestFrame === "function") t.requestFrame();
+ }
+ } catch (e) {}
+ }, 2000);
+ }
+ }
+ } catch (e) {}
+
try {
if (navigator.mediaSession && !KA.mediaSession) {
if (typeof window.MediaMetadata === "function") {
diff --git a/src/pages/Recorder/webcodecs/WebCodecsRecorder.js b/src/pages/Recorder/webcodecs/WebCodecsRecorder.js
index cf3779b..5c5ea6f 100644
--- a/src/pages/Recorder/webcodecs/WebCodecsRecorder.js
+++ b/src/pages/Recorder/webcodecs/WebCodecsRecorder.js
@@ -11,6 +11,18 @@
*/
import { perfMark, perfSpan } from "../../utils/perfMarks";
import { diagForward } from "../../utils/diagForward";
+import {
+ AAC_SUPPORTED_RATES,
+ AVC_MAX_PIXELS,
+ VIDEO_DIM_HARD_CAP,
+ computeAvcCappedDimensions,
+ isAacRateInSpec,
+ isReclaimErrorMessage,
+ shouldFailZeroChunksAtStop,
+ shouldResetReclaimCounter,
+ shouldThrottleReclaimRebuild,
+ shouldTriggerSleepRecovery,
+} from "./recorderLogic";
// Lazy-load Mp4MuxerWrapper so its ~3MB mediabunny static import doesn't
// drag into recorder.bundle.js cold start (dominates click-record latency).
let _mp4MuxerWrapperPromise = null;
@@ -115,9 +127,17 @@ export class WebCodecsRecorder {
this._videoLoopError = null;
this._firstChunkSeen = false;
this._firstChunkWatchdog = null;
+ // 12s covers NVENC / VideoToolbox cold-start (5-7s on first encode).
+ // Shorter values false-fired into the MediaRecorder fallback.
this._firstChunkWatchdogMs = Number.isFinite(options.firstChunkWatchdogMs)
? options.firstChunkWatchdogMs
- : 8000;
+ : Number.isFinite(
+ /** @type {any} */ (globalThis)
+ .__screenityFirstChunkWatchdogMsForTests,
+ )
+ ? /** @type {any} */ (globalThis)
+ .__screenityFirstChunkWatchdogMsForTests
+ : 12000;
// Mid-stream watchdog: encoder goes silent after producing chunks
// (HW reclaim, hang). Triggers graceful finalize on the partial.
@@ -153,12 +173,59 @@ export class WebCodecsRecorder {
this._peakAudioEncodeQueueSize = 0;
// Encoder reclaim recovery. Chrome reclaims idle HW slots; we
- // rebuild with the same config. Capped to surface real failures.
+ // rebuild with the same config. Cap 5 plus throttle is ~10s of retries.
this._maxEncoderReclaims = Number.isFinite(options.maxEncoderReclaims)
? options.maxEncoderReclaims
- : 3;
+ : 5;
+ // Throttle so the encode loop can't burn the cap on every frame
+ // while the HW slot is still held by another app.
+ this._reclaimRebuildThrottleMs = Number.isFinite(
+ options.reclaimRebuildThrottleMs,
+ )
+ ? options.reclaimRebuildThrottleMs
+ : Number.isFinite(
+ /** @type {any} */ (globalThis)
+ .__screenityReclaimRebuildThrottleMsForTests,
+ )
+ ? /** @type {any} */ (globalThis)
+ .__screenityReclaimRebuildThrottleMsForTests
+ : 2000;
+ this._lastVideoReclaimRebuildAt = null;
+ this._lastAudioReclaimRebuildAt = null;
this._encoderReclaimCount = 0;
this._audioEncoderReclaimCount = 0;
+ // Reset the per-encoder reclaim counter after a healthy stretch.
+ this._lastVideoReclaimAt = null;
+ this._lastAudioReclaimAt = null;
+ this._reclaimResetAfterMs = Number.isFinite(options.reclaimResetAfterMs)
+ ? options.reclaimResetAfterMs
+ : Number.isFinite(
+ /** @type {any} */ (globalThis)
+ .__screenityReclaimResetAfterMsForTests,
+ )
+ ? /** @type {any} */ (globalThis).__screenityReclaimResetAfterMsForTests
+ : 30000;
+ // Pause closes encoders to release the HW slot before Chrome's
+ // inactivity-reclaim fires. Flag swallows the racing reclaim error.
+ this._encodersClosedForPause = false;
+ // Serialize pause/resume so a rapid toggle doesn't race close/rebuild.
+ this._pauseResumeChain = Promise.resolve();
+ // Rebuild AudioEncoder when the mic sample rate changes mid-
+ // recording (BT unplug, default device switch). Capped to catch flaps.
+ this._audioDeviceChangePending = false;
+ this._audioSampleRateMismatchRebuilds = 0;
+ this._maxAudioSampleRateRebuilds = Number.isFinite(
+ options.maxAudioSampleRateRebuilds,
+ )
+ ? options.maxAudioSampleRateRebuilds
+ : 3;
+ // Sleep / wake: a long frame-arrival gap means lid-close or OS
+ // preemption. Force a keyframe and reset the stall watchdog.
+ this._lastFrameArrivalAt = null;
+ this._postSleepRecoveries = 0;
+ this._sleepGapMs = Number.isFinite(options.sleepGapMs)
+ ? options.sleepGapMs
+ : 5000;
// Active configs preserved for rebuild after reclaim. Updated when
// a SW fallback rebuilds the encoder so the next reclaim uses the
// config that actually worked, not the originally-attempted HW one.
@@ -193,6 +260,23 @@ export class WebCodecsRecorder {
}
async _probeRealResolution() {
+ // E2E hook: synthetic probe dims so tests can drive the AVC
+ // pixel-area cap without a real 4K source.
+ const _g = /** @type {any} */ (globalThis);
+ if (
+ _g.__screenityForceProbeResolution &&
+ typeof _g.__screenityForceProbeResolution === "object"
+ ) {
+ const { width, height } = _g.__screenityForceProbeResolution;
+ if (Number.isFinite(width) && Number.isFinite(height)) {
+ this.log("[WCR] Resolution from test override:", width, "x", height);
+ if (this.options) {
+ this.options.width = undefined;
+ this.options.height = undefined;
+ }
+ return { width, height };
+ }
+ }
// Prefer track settings: on macOS getDisplayMedia, the first frame from
// MediaStreamTrackProcessor can be delayed several seconds by VideoToolbox
// capture cold-start, which would block start() and freeze the toolbar.
@@ -243,6 +327,18 @@ export class WebCodecsRecorder {
this._peakAudioEncodeQueueSize = 0;
this._encoderReclaimCount = 0;
this._audioEncoderReclaimCount = 0;
+ this._lastVideoReclaimAt = null;
+ this._lastAudioReclaimAt = null;
+ this._lastVideoReclaimRebuildAt = null;
+ this._lastAudioReclaimRebuildAt = null;
+ this._encodersClosedForPause = false;
+ this._finalizeOnFatalRan = false;
+ this._finalizingFromFatal = false;
+ this._audioDeviceChangePending = false;
+ this._audioSampleRateMismatchRebuilds = 0;
+ this._audioRebuildUnsupportedRates = null;
+ this._lastFrameArrivalAt = null;
+ this._postSleepRecoveries = 0;
this._activeVideoConfig = null;
this._activeVideoCodecLabel = null;
this._activeAudioConfig = null;
@@ -307,29 +403,24 @@ export class WebCodecsRecorder {
this.actualWidth = width;
this.actualHeight = height;
- // User quality (options.width/height) caps target; never upscale
- // beyond capture. 3840 hard cap stops pathological inputs.
- const HARD_CAP = 3840;
- const userMaxWidth = Number.isFinite(this.options?.width)
- ? this.options.width
- : HARD_CAP;
- const userMaxHeight = Number.isFinite(this.options?.height)
- ? this.options.height
- : HARD_CAP;
- const effectiveCapWidth = Math.min(userMaxWidth, HARD_CAP);
- const effectiveCapHeight = Math.min(userMaxHeight, HARD_CAP);
-
- let targetWidth = Math.min(width, effectiveCapWidth);
- let targetHeight = Math.round((height / width) * targetWidth);
- if (targetHeight > effectiveCapHeight) {
- targetHeight = effectiveCapHeight;
- targetWidth = Math.round((width / height) * targetHeight);
+ // Apply user/hard cap, even-rounding, and AVC pixel-area cap.
+ const dimResult = computeAvcCappedDimensions({
+ sourceWidth: width,
+ sourceHeight: height,
+ userMaxWidth: this.options?.width,
+ userMaxHeight: this.options?.height,
+ });
+ if (dimResult.capped.area) {
+ this.warn("[WCR] target clamped to AVC max pixel area", {
+ sourceWidth: width,
+ sourceHeight: height,
+ toWidth: dimResult.width,
+ toHeight: dimResult.height,
+ avcMaxPixels: AVC_MAX_PIXELS,
+ });
}
- // H.264/HEVC require even dimensions; min 32 for tiny regions.
- targetWidth = Math.max(32, targetWidth - (targetWidth % 2));
- targetHeight = Math.max(32, targetHeight - (targetHeight % 2));
- this.targetWidth = targetWidth;
- this.targetHeight = targetHeight;
+ this.targetWidth = dimResult.width;
+ this.targetHeight = dimResult.height;
this.log("[WCR] Target:", this.targetWidth, "x", this.targetHeight);
@@ -666,11 +757,16 @@ export class WebCodecsRecorder {
timestamp: tsUs,
duration: this._frameDurationUs,
});
- this.videoEncoder.encode(hold, {
- timestamp: tsUs,
- keyFrame: false,
- });
- hold.close();
+ // try/finally so an encode() throw doesn't leak the
+ // VideoFrame's GPU buffer.
+ try {
+ this.videoEncoder.encode(hold, {
+ timestamp: tsUs,
+ keyFrame: false,
+ });
+ } finally {
+ hold.close();
+ }
this._videoFrameIndex += 1;
}
// 5s cap on trailing-hold flush; some Windows drivers never
@@ -699,11 +795,30 @@ export class WebCodecsRecorder {
}
}
+ // Zero chunks: don't ship a header-only file. Skips muxer.finalize
+ // below and the err is NOT tagged finalized (nothing to salvage).
+ if (shouldFailZeroChunksAtStop(this._firstChunkSeen, this.frameCount)) {
+ this.warn("[WCR] stop() reached finalize with zero chunks", {
+ firstChunkSeen: this._firstChunkSeen,
+ frameCount: this.frameCount,
+ });
+ if (!this._failureReported) {
+ const zeroChunkErr =
+ this._videoLoopError ||
+ new Error(
+ "WebCodecs encoder produced zero chunks before stop; flush succeeded without output",
+ );
+ // Callers gate the salvage branch on err.finalized === true.
+ zeroChunkErr.finalized = false;
+ this._reportFailure("webcodecs-zero-frames-at-stop", zeroChunkErr);
+ }
+ }
+
// Hard timeout on finalize: abrupt stream end can hang it. Most
// of the file is already in chunksStore (fragmented MP4);
// flushPending() preserves the rest.
let muxerFinalizeOk = false;
- if (this.muxer) {
+ if (this.muxer && !this._failureReported) {
const endFinalize = perfSpan("WCR.stop.muxer.finalize");
try {
await Promise.race([
@@ -776,17 +891,59 @@ export class WebCodecsRecorder {
}
pause() {
- if (!this.running || this.paused) return;
+ this._pauseResumeChain = this._pauseResumeChain
+ .catch(() => {})
+ .then(() => this._pauseImpl());
+ return this._pauseResumeChain;
+ }
+
+ resume() {
+ this._pauseResumeChain = this._pauseResumeChain
+ .catch(() => {})
+ .then(() => this._resumeImpl());
+ return this._pauseResumeChain;
+ }
+
+ async _pauseImpl() {
+ // Bail if stop() landed while we were queued. Closing on a stopped
+ // recorder leaks encoder instances.
+ if (!this.running || this._stopping || this.paused) return;
this.paused = true;
this.pauseStartUs = performance.now() * 1000;
+
+ // Release the HW slot up front so long pauses don't burn the
+ // reclaim cap. Chrome reclaims at ~60s, w3c/webcodecs#363.
+ this._encodersClosedForPause = true;
+ try {
+ this.videoEncoder?.close();
+ } catch {}
+ try {
+ this.audioEncoder?.close();
+ } catch {}
}
- resume() {
- if (!this.running || !this.paused) return;
+ async _resumeImpl() {
+ // Same stop-race bail as _pauseImpl.
+ if (!this.running || this._stopping || !this.paused) return;
const nowUs = performance.now() * 1000;
this.totalPausedDurationUs += nowUs - this.pauseStartUs;
+ // Rebuild encoders pause() closed; loop surfaces any failure.
+ if (this._encodersClosedForPause) {
+ // Clear before rebuild so a fresh reclaim on the new encoder
+ // isn't swallowed by the pause guard.
+ this._encodersClosedForPause = false;
+ if (this._activeVideoConfig) {
+ this._rebuildVideoEncoder(this._activeVideoConfig);
+ }
+ if (this._activeAudioConfig) {
+ this._rebuildAudioEncoder(this._activeAudioConfig);
+ }
+ // Force a keyframe so the decoder doesn't reference pre-pause frames.
+ this._forceNextKeyframe = true;
+ }
+
this.paused = false;
this.justResumed = true;
this.muxer?.setPausedOffset(this.totalPausedDurationUs);
@@ -990,6 +1147,8 @@ export class WebCodecsRecorder {
this._deviceChangeListener = () => {
this._deviceChangeCount += 1;
this._lastDeviceChangeAt = Date.now();
+ // Diag-only flag; audio loop checks per-frame.
+ this._audioDeviceChangePending = true;
this.log("[WCR] devicechange", { count: this._deviceChangeCount });
};
try {
@@ -1119,6 +1278,16 @@ export class WebCodecsRecorder {
// Extract output/error callbacks so the prefer-software retry below
// can rebuild the VideoEncoder with the same handlers.
const videoEncoderOutput = (chunk, meta) => {
+ // E2E hook: drop the first N chunks to drive the no-first-chunk
+ // watchdog in tests.
+ const _g = /** @type {any} */ (globalThis);
+ if (
+ typeof _g.__screenitySuppressFirstChunks === "number" &&
+ _g.__screenitySuppressFirstChunks > 0
+ ) {
+ _g.__screenitySuppressFirstChunks -= 1;
+ return;
+ }
// First encoded video chunk: the recording is producing real
// bytes, so disarm the no-first-chunk watchdog and arm the
// mid-stream stall watchdog instead.
@@ -1130,6 +1299,18 @@ export class WebCodecsRecorder {
// Refresh the mid-stream watchdog's timestamp on every chunk so
// it only fires when output genuinely stops.
this._lastChunkAt = performance.now();
+ // Reset the reclaim counter after a healthy stretch.
+ if (
+ shouldResetReclaimCounter(
+ this._lastChunkAt,
+ this._lastVideoReclaimAt,
+ this._reclaimResetAfterMs,
+ this._encoderReclaimCount,
+ )
+ ) {
+ this._encoderReclaimCount = 0;
+ this._lastVideoReclaimAt = null;
+ }
// decoderConfig.codec can overstate level vs SPS; parse from
// avcC ([1]=profile, [2]=compat, [3]=level) when possible.
if (!this.actualVideoCodec) {
@@ -1210,8 +1391,52 @@ export class WebCodecsRecorder {
this._handleVideoEncoderError(err);
};
this._videoEncoderOutputHandler = videoEncoderOutput;
+ // Raw handler kept for the test hook and per-instance rebuild.
this._videoEncoderErrorHandler = videoEncoderError;
this._activeVideoCodecLabel = codecLabel;
+
+ // E2E hook: fire a synthetic reclaim error so tests can drive the
+ // recovery + finalize-on-fatal paths without the 60s real timer.
+ if (typeof globalThis !== "undefined") {
+ const g = /** @type {any} */ (globalThis);
+ g.__screenityFireVideoEncoderError = (customMsg) => {
+ const synthetic = new Error(
+ customMsg || "Codec reclaimed due to inactivity",
+ );
+ synthetic.name = "QuotaExceededError";
+ try {
+ videoEncoderError(synthetic);
+ } catch (e) {
+ this.err("[WCR] __screenityFireVideoEncoderError threw:", e);
+ return false;
+ }
+ return true;
+ };
+ g.__screenityGetReclaimSnapshot = () => ({
+ video: this._encoderReclaimCount,
+ audio: this._audioEncoderReclaimCount,
+ firstChunkSeen: this._firstChunkSeen,
+ encodersClosedForPause: this._encodersClosedForPause,
+ running: this.running,
+ paused: this.paused,
+ stopping: this._stopping,
+ audioSampleRate: this.audioSampleRate,
+ audioSampleRateMismatchRebuilds:
+ this._audioSampleRateMismatchRebuilds,
+ audioDeviceChangePending: this._audioDeviceChangePending,
+ postSleepRecoveries: this._postSleepRecoveries,
+ firstChunkWatchdogMs: this._firstChunkWatchdogMs,
+ maxEncoderReclaims: this._maxEncoderReclaims,
+ reclaimRebuildThrottleMs: this._reclaimRebuildThrottleMs,
+ targetWidth: this.targetWidth,
+ targetHeight: this.targetHeight,
+ actualWidth: this.actualWidth,
+ actualHeight: this.actualHeight,
+ audioRebuildUnsupportedRates: this._audioRebuildUnsupportedRates
+ ? Array.from(this._audioRebuildUnsupportedRates)
+ : [],
+ });
+ }
this.videoEncoder = new VideoEncoder({
output: videoEncoderOutput,
error: videoEncoderError,
@@ -1396,6 +1621,18 @@ export class WebCodecsRecorder {
// Synthesize a correct 2-byte ASC when invalid.
const fixed = this._maybeFixAacDescription(meta);
this.muxer.addAudioChunk(chunk, fixed || meta);
+ // Reset audio reclaim counter after a healthy stretch.
+ if (
+ shouldResetReclaimCounter(
+ performance.now(),
+ this._lastAudioReclaimAt,
+ this._reclaimResetAfterMs,
+ this._audioEncoderReclaimCount,
+ )
+ ) {
+ this._audioEncoderReclaimCount = 0;
+ this._lastAudioReclaimAt = null;
+ }
};
const audioEncoderError = (err) => {
this._handleAudioEncoderError(err);
@@ -1497,8 +1734,20 @@ export class WebCodecsRecorder {
// async errors. Otherwise surface to onError.
_handleVideoEncoderError(err) {
const msg = String(err?.message || err || "");
- const isReclaim =
- /codec\s+reclaimed|reclaimed\s+due\s+to\s+inactivity/i.test(msg);
+ const isReclaim = isReclaimErrorMessage(msg);
+
+ // Re-entry guard: stop()'s flush during _finalizeOnFatal can fire
+ // a second error from the same encoder.
+ if (this._finalizingFromFatal) {
+ return;
+ }
+
+ // Pause closed the encoder. Swallow the racing reclaim error;
+ // resume() rebuilds from _activeVideoConfig.
+ if (this._encodersClosedForPause && isReclaim) {
+ return;
+ }
+
const canRecover =
this.running &&
!this._stopping &&
@@ -1511,7 +1760,21 @@ export class WebCodecsRecorder {
canRecover &&
this._encoderReclaimCount < this._maxEncoderReclaims
) {
+ // Throttle: while the HW slot is held, encoder.error fires every
+ // frame and would burn the cap in ms.
+ const nowMs = performance.now();
+ if (
+ shouldThrottleReclaimRebuild(
+ nowMs,
+ this._lastVideoReclaimRebuildAt,
+ this._reclaimRebuildThrottleMs,
+ )
+ ) {
+ return;
+ }
this._encoderReclaimCount += 1;
+ this._lastVideoReclaimAt = nowMs;
+ this._lastVideoReclaimRebuildAt = nowMs;
this.warn("[WCR] VideoEncoder reclaimed, rebuilding", {
attempt: this._encoderReclaimCount,
max: this._maxEncoderReclaims,
@@ -1547,17 +1810,54 @@ export class WebCodecsRecorder {
}
this.err("[WCR] VideoEncoder error:", err);
+
+ // Fatal mid-recording with chunks on disk. Run stop() so the muxer
+ // writes moov, then surface the error tagged finalized for salvage.
+ if (
+ this._firstChunkSeen &&
+ this.running &&
+ !this._stopping &&
+ !this._finalizeOnFatalRan
+ ) {
+ this._finalizeOnFatalRan = true;
+ try {
+ err.finalized = true;
+ } catch {}
+ this._finalizeOnFatal(err);
+ return;
+ }
+
this.options.onError?.(err);
}
+ // Runs stop() then re-fires the original error so the caller takes
+ // the salvage branch. Flag blocks re-entry during stop()'s flush.
+ async _finalizeOnFatal(originalErr) {
+ this._finalizingFromFatal = true;
+ try {
+ await this.stop();
+ } catch (stopErr) {
+ this.err("[WCR] _finalizeOnFatal stop() threw:", stopErr);
+ }
+ try {
+ this.options.onError?.(originalErr);
+ } catch (cbErr) {
+ this.err("[WCR] _finalizeOnFatal onError callback threw:", cbErr);
+ }
+ }
+
// Audio reclaim recovery. Less critical than video (audio glitches are
// usually preferable to losing the recording) but the same pattern
// applies; Chrome can reclaim the AudioEncoder slot too. No keyframe
// concept for audio; rebuild and continue.
_handleAudioEncoderError(err) {
+ // Same reentry guard as the video handler: encoder.flush() during
+ // _finalizeOnFatal can fire audio errors too.
+ if (this._finalizingFromFatal) {
+ return;
+ }
const msg = String(err?.message || err || "");
- const isReclaim =
- /codec\s+reclaimed|reclaimed\s+due\s+to\s+inactivity/i.test(msg);
+ const isReclaim = isReclaimErrorMessage(msg);
if (
isReclaim &&
this.running &&
@@ -1567,7 +1867,19 @@ export class WebCodecsRecorder {
this._audioEncoderErrorHandler &&
this._audioEncoderReclaimCount < this._maxEncoderReclaims
) {
+ const nowMs = performance.now();
+ if (
+ shouldThrottleReclaimRebuild(
+ nowMs,
+ this._lastAudioReclaimRebuildAt,
+ this._reclaimRebuildThrottleMs,
+ )
+ ) {
+ return;
+ }
this._audioEncoderReclaimCount += 1;
+ this._lastAudioReclaimAt = nowMs;
+ this._lastAudioReclaimRebuildAt = nowMs;
this.warn("[WCR] AudioEncoder reclaimed, rebuilding", {
attempt: this._audioEncoderReclaimCount,
max: this._maxEncoderReclaims,
@@ -1582,18 +1894,23 @@ export class WebCodecsRecorder {
this.options.onError?.(err);
}
- // Best-effort close + fresh construct/configure with the same
- // handlers. The video loop re-reads this.videoEncoder each tick.
+ // Fresh construct/configure with the same handlers. Error handler is
+ // wrapped per-instance to drop late errors from the closed predecessor.
_rebuildVideoEncoder(config) {
try {
this.videoEncoder?.close();
} catch {}
try {
- this.videoEncoder = new VideoEncoder({
+ let nextEncoder = null;
+ nextEncoder = new VideoEncoder({
output: this._videoEncoderOutputHandler,
- error: this._videoEncoderErrorHandler,
+ error: (err) => {
+ if (this.videoEncoder !== nextEncoder) return;
+ this._videoEncoderErrorHandler(err);
+ },
});
- this.videoEncoder.configure(config);
+ nextEncoder.configure(config);
+ this.videoEncoder = nextEncoder;
this._activeVideoConfig = config;
return true;
} catch (rebuildErr) {
@@ -1603,19 +1920,49 @@ export class WebCodecsRecorder {
}
_rebuildAudioEncoder(config) {
+ // Snapshot the prior config so we can restore it if configure()
+ // fails (BT switching to HFP narrowband is the usual cause).
+ const priorConfig = this._activeAudioConfig;
try {
this.audioEncoder?.close();
} catch {}
try {
- this.audioEncoder = new AudioEncoder({
+ let nextEncoder = null;
+ nextEncoder = new AudioEncoder({
output: this._audioEncoderOutputHandler,
- error: this._audioEncoderErrorHandler,
+ error: (err) => {
+ if (this.audioEncoder !== nextEncoder) return;
+ this._audioEncoderErrorHandler(err);
+ },
});
- this.audioEncoder.configure(config);
+ nextEncoder.configure(config);
+ this.audioEncoder = nextEncoder;
this._activeAudioConfig = config;
return true;
} catch (rebuildErr) {
this.err("[WCR] AudioEncoder rebuild failed:", rebuildErr);
+ // Restore the prior encoder so audio keeps flowing at the old
+ // rate. A small pitch shift beats a dead audio path.
+ if (priorConfig) {
+ try {
+ let restoreEncoder = null;
+ restoreEncoder = new AudioEncoder({
+ output: this._audioEncoderOutputHandler,
+ error: (err) => {
+ if (this.audioEncoder !== restoreEncoder) return;
+ this._audioEncoderErrorHandler(err);
+ },
+ });
+ restoreEncoder.configure(priorConfig);
+ this.audioEncoder = restoreEncoder;
+ this._activeAudioConfig = priorConfig;
+ } catch (restoreErr) {
+ this.err(
+ "[WCR] AudioEncoder restore after failed rebuild also failed:",
+ restoreErr,
+ );
+ }
+ }
return false;
}
}
@@ -1715,9 +2062,17 @@ export class WebCodecsRecorder {
for (const c of candidates) {
const config = { ...base, codec: c.codec, hardwareAcceleration: c.hw };
+ // Use the normalized config from isConfigSupported so a clamp
+ // Chrome would have applied doesn't trigger a SW fallback later.
+ let supported = null;
+ try {
+ supported = await VideoEncoder.isConfigSupported(config);
+ } catch {}
+ const resolvedConfig =
+ supported?.supported && supported.config ? supported.config : config;
const test = new VideoEncoder({ output() {}, error() {} });
try {
- test.configure(config);
+ test.configure(resolvedConfig);
this.log("[WCR] Selected encoder:", c.codec, c.hw);
try {
chrome.storage.local.set({
@@ -1734,7 +2089,7 @@ export class WebCodecsRecorder {
});
} catch {}
return {
- config,
+ config: resolvedConfig,
codec: c.codec,
containerCodec: c.containerCodec,
};
@@ -1767,10 +2122,50 @@ export class WebCodecsRecorder {
if (globalThis.__screenityForceZeroFrames) break;
if (this.paused) {
+ // Long pause isn't sleep. Reset so resume skips recovery.
+ this._lastFrameArrivalAt = null;
await new Promise((r) => setTimeout(r, 10));
continue;
}
+ // Sleep / wake recovery: a long inter-frame gap means lid-close
+ // or OS preemption. Reset the watchdog and force a keyframe.
+ const _nowLoopTick = performance.now();
+ const g = /** @type {any} */ (globalThis);
+ const forcedGap =
+ typeof g.__screenityForceSleepGapMs === "number"
+ ? g.__screenityForceSleepGapMs
+ : 0;
+ if (forcedGap > 0) {
+ g.__screenityForceSleepGapMs = 0;
+ this._lastFrameArrivalAt = _nowLoopTick - forcedGap;
+ }
+ if (
+ shouldTriggerSleepRecovery(
+ _nowLoopTick,
+ this._lastFrameArrivalAt,
+ this._sleepGapMs,
+ this._firstChunkSeen,
+ this.running,
+ this._stopping,
+ )
+ ) {
+ this._postSleepRecoveries += 1;
+ this.warn("[WCR] post-sleep gap detected; resetting watchdog", {
+ gapMs: Math.round(_nowLoopTick - this._lastFrameArrivalAt),
+ recoveries: this._postSleepRecoveries,
+ });
+ this._lastChunkAt = _nowLoopTick;
+ this._forceNextKeyframe = true;
+ try {
+ diagForward("recorder-sleep-detected", {
+ gapMs: Math.round(_nowLoopTick - this._lastFrameArrivalAt),
+ recoveries: this._postSleepRecoveries,
+ });
+ } catch {}
+ this._lastFrameArrivalAt = _nowLoopTick;
+ }
+
// Static-frame fallback. macOS ScreenCaptureKit throttles to
// frames-on-change on a static screen, so the track stops
// emitting and the stall watchdog would misfire. Reuse the
@@ -1810,6 +2205,8 @@ export class WebCodecsRecorder {
} else {
if (readResult.done || !readResult.value) break;
frame = readResult.value;
+ // Drives the sleep-gap detection above.
+ this._lastFrameArrivalAt = performance.now();
if (frame.codedWidth === 0 || frame.codedHeight === 0) {
// A zero-size frame can't be drawn or encoded. Skip it
@@ -1872,7 +2269,13 @@ export class WebCodecsRecorder {
// Track the peak observed queue depth as a leading indicator
//; useful for tuning the threshold from real telemetry.
- const vQueueSize = this.videoEncoder.encodeQueueSize;
+ // Closed-encoder pause race: treat as drained.
+ let vQueueSize = 0;
+ try {
+ vQueueSize = this.videoEncoder?.encodeQueueSize ?? 0;
+ } catch {
+ vQueueSize = 0;
+ }
if (vQueueSize > this._peakVideoEncodeQueueSize) {
this._peakVideoEncodeQueueSize = vQueueSize;
}
@@ -1905,31 +2308,65 @@ export class WebCodecsRecorder {
this.justResumed = false;
}
- this.videoEncoder.encode(resized, {
- timestamp: tsUs,
- keyFrame,
- });
- if (this.debug && (this.frameCount < 5 || this.frameCount % 300 === 0)) {
- this.log("[WCR] video pts", {
- frame: this.frameCount,
- tsUs,
- durUs: frameDurationUs,
- targetIndex,
- });
+ // pause() can close the encoder between the top-of-loop check
+ // and here. Drop the frame instead of bubbling a sync throw.
+ if (
+ this.paused ||
+ !this.videoEncoder ||
+ this.videoEncoder.state === "closed"
+ ) {
+ resized.close();
+ this._videoFrameIndex = i + 1;
+ this._forceNextKeyframe = true;
+ continue;
}
- // Diag snapshot every 30 frames. encodeQueueSize > 10 means
- // the encoder can't keep up (the "first seconds sluggish"
- // signature).
- if (this.frameCount > 0 && this.frameCount % 30 === 0) {
- perfMark("WCR.frame.progress", {
- frame: this.frameCount,
- videoQ: this.videoEncoder?.encodeQueueSize ?? -1,
- audioQ: this.audioEncoder?.encodeQueueSize ?? -1,
- });
+ // try/finally so resized's GPU buffer closes on every exit
+ // (pause-race continue, rethrown encoder error, success).
+ try {
+ try {
+ this.videoEncoder.encode(resized, {
+ timestamp: tsUs,
+ keyFrame,
+ });
+ } catch (encErr) {
+ // Same race after the check. Only swallow when paused
+ // so real encoder errors still surface.
+ if (
+ this.paused ||
+ this.videoEncoder?.state === "closed"
+ ) {
+ this.warn("[WCR] encode() race during pause; dropping frame");
+ this._videoFrameIndex = i + 1;
+ this._forceNextKeyframe = true;
+ continue;
+ }
+ throw encErr;
+ }
+ if (
+ this.debug &&
+ (this.frameCount < 5 || this.frameCount % 300 === 0)
+ ) {
+ this.log("[WCR] video pts", {
+ frame: this.frameCount,
+ tsUs,
+ durUs: frameDurationUs,
+ targetIndex,
+ });
+ }
+ // Diag snapshot every 30 frames. encodeQueueSize > 10 means
+ // the encoder can't keep up.
+ if (this.frameCount > 0 && this.frameCount % 30 === 0) {
+ perfMark("WCR.frame.progress", {
+ frame: this.frameCount,
+ videoQ: this.videoEncoder?.encodeQueueSize ?? -1,
+ audioQ: this.audioEncoder?.encodeQueueSize ?? -1,
+ });
+ }
+ this.frameCount++;
+ this._videoFrameIndex = i + 1;
+ } finally {
+ resized.close();
}
- this.frameCount++;
- this._videoFrameIndex = i + 1;
- resized.close();
}
// Only close a real source frame; the synthetic path reuses
@@ -1976,8 +2413,100 @@ export class WebCodecsRecorder {
this.log("[WCR] audio loop start");
const encodeAudioData = (audioData) => {
+ // E2E hook: override the perceived rate for one frame to drive
+ // mismatch-rebuild in tests. Timestamps still use the real rate.
+ const _g = /** @type {any} */ (globalThis);
+ const overrideRate = _g.__screenityForceAudioSampleRateOverride || 0;
+ if (overrideRate > 0) {
+ _g.__screenityForceAudioSampleRateOverride = 0;
+ }
+ const realSampleRate = audioData.sampleRate || null;
+ const incomingSampleRate = overrideRate || realSampleRate;
+
+ // Mic switched mid-recording: rebuild at the new rate. Pre-check
+ // AAC's allowed rates so configure() can't brick the encoder.
+ const codec = this._activeAudioConfig?.codec || "mp4a.40.2";
+ const isAac = codec.startsWith("mp4a") || codec === "aac";
+ if (
+ isAac &&
+ incomingSampleRate &&
+ this.audioSampleRate &&
+ incomingSampleRate !== this.audioSampleRate &&
+ !isAacRateInSpec(incomingSampleRate)
+ ) {
+ if (!this._audioRebuildUnsupportedRates) {
+ this._audioRebuildUnsupportedRates = new Set();
+ }
+ if (!this._audioRebuildUnsupportedRates.has(incomingSampleRate)) {
+ this._audioRebuildUnsupportedRates.add(incomingSampleRate);
+ try {
+ diagForward("recorder-audio-rebuild-unsupported", {
+ rate: incomingSampleRate,
+ keptRate: this.audioSampleRate,
+ codec,
+ reason: "codec-rate-not-supported",
+ });
+ } catch {}
+ }
+ }
+ const rateUnsupported =
+ incomingSampleRate &&
+ this._audioRebuildUnsupportedRates &&
+ this._audioRebuildUnsupportedRates.has(incomingSampleRate);
+ if (
+ incomingSampleRate &&
+ this.audioSampleRate &&
+ incomingSampleRate !== this.audioSampleRate &&
+ !rateUnsupported &&
+ this._audioSampleRateMismatchRebuilds <
+ this._maxAudioSampleRateRebuilds
+ ) {
+ const oldRate = this.audioSampleRate;
+ this.warn("[WCR] audio sample rate changed mid-recording", {
+ from: oldRate,
+ to: incomingSampleRate,
+ rebuilds: this._audioSampleRateMismatchRebuilds + 1,
+ });
+ const newConfig = this._activeAudioConfig
+ ? { ...this._activeAudioConfig, sampleRate: incomingSampleRate }
+ : null;
+ if (newConfig && this._rebuildAudioEncoder(newConfig)) {
+ this.audioSampleRate = incomingSampleRate;
+ this._audioSampleRateMismatchRebuilds += 1;
+ // Drop this frame so the next one starts at the new rate.
+ try {
+ audioData.close?.();
+ } catch {}
+ this._audioDeviceChangePending = false;
+ try {
+ diagForward("recorder-audio-encoder-rebuilt", {
+ reason: "sample-rate-mismatch",
+ from: oldRate,
+ to: incomingSampleRate,
+ rebuilds: this._audioSampleRateMismatchRebuilds,
+ });
+ } catch {}
+ return;
+ }
+ // Rebuild failed: mark as unsupported (encoder already restored).
+ if (!this._audioRebuildUnsupportedRates) {
+ this._audioRebuildUnsupportedRates = new Set();
+ }
+ this._audioRebuildUnsupportedRates.add(incomingSampleRate);
+ try {
+ diagForward("recorder-audio-rebuild-unsupported", {
+ rate: incomingSampleRate,
+ keptRate: this.audioSampleRate,
+ codec:
+ (this._activeAudioConfig && this._activeAudioConfig.codec) ||
+ null,
+ });
+ } catch {}
+ }
+
+ // Timestamps use the real rate; the override is test-only.
const sampleRate =
- audioData.sampleRate || this.audioSampleRate || 48000;
+ realSampleRate || this.audioSampleRate || 48000;
const frames =
typeof audioData.numberOfFrames === "number"
? audioData.numberOfFrames
diff --git a/src/pages/Recorder/webcodecs/recorderLogic.js b/src/pages/Recorder/webcodecs/recorderLogic.js
new file mode 100644
index 0000000..a67a3f3
--- /dev/null
+++ b/src/pages/Recorder/webcodecs/recorderLogic.js
@@ -0,0 +1,135 @@
+// Pure helpers split out from WebCodecsRecorder so the decision logic
+// is unit-testable in Node without mocking VideoEncoder/MSTP.
+// Tests: tests/unit/recorderLogic.test.mjs
+
+// AVC Level 5.1 max encoded frame area (~4K). Outer safety net: our
+// preferred codec strings declare lower levels (4.2 ~2.07M, 3.0 ~414K)
+// but Chrome usually clamps the level silently during HW renegotiation.
+// This stops the pathological 6K+ case across NVENC/VT/VAAPI.
+export const AVC_MAX_PIXELS = 9_437_184;
+
+// Per-dimension cap before area cap runs. 3840 covers all 4K configs.
+export const VIDEO_DIM_HARD_CAP = 3840;
+
+// AAC-LC valid sample rates per ISO/IEC 14496-3. Necessary but not
+// sufficient: implementations may still reject rate/bitrate combos
+// (e.g. BT HFP narrowband lands at rates the encoder claims to support
+// but chokes on at typical bitrates).
+export const AAC_SUPPORTED_RATES = Object.freeze(
+ new Set([
+ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000,
+ 88200, 96000,
+ ]),
+);
+
+// Chrome reports reclaim via message text, not a structured code.
+const RECLAIM_MESSAGE_RE = /codec\s+reclaimed|reclaimed\s+due\s+to\s+inactivity/i;
+
+export function isReclaimErrorMessage(errOrMessage) {
+ if (!errOrMessage) return false;
+ const msg =
+ typeof errOrMessage === "string"
+ ? errOrMessage
+ : String(errOrMessage?.message || errOrMessage || "");
+ return RECLAIM_MESSAGE_RE.test(msg);
+}
+
+export function isAacRateInSpec(rate) {
+ return Number.isFinite(rate) && AAC_SUPPORTED_RATES.has(rate);
+}
+
+// Cap each dim by min(userMax, hardCap), preserve aspect, round even
+// (H.264 requirement) with min 32, then scale down if total pixels
+// still exceed avcMaxPixels.
+export function computeAvcCappedDimensions({
+ sourceWidth,
+ sourceHeight,
+ userMaxWidth = null,
+ userMaxHeight = null,
+ hardCap = VIDEO_DIM_HARD_CAP,
+ avcMaxPixels = AVC_MAX_PIXELS,
+}) {
+ if (
+ !Number.isFinite(sourceWidth) ||
+ !Number.isFinite(sourceHeight) ||
+ sourceWidth <= 0 ||
+ sourceHeight <= 0
+ ) {
+ throw new Error("computeAvcCappedDimensions: invalid source dimensions");
+ }
+ const userW = Number.isFinite(userMaxWidth) ? userMaxWidth : hardCap;
+ const userH = Number.isFinite(userMaxHeight) ? userMaxHeight : hardCap;
+ const effectiveCapW = Math.min(userW, hardCap);
+ const effectiveCapH = Math.min(userH, hardCap);
+
+ let width = Math.min(sourceWidth, effectiveCapW);
+ let height = Math.round((sourceHeight / sourceWidth) * width);
+ if (height > effectiveCapH) {
+ height = effectiveCapH;
+ width = Math.round((sourceWidth / sourceHeight) * height);
+ }
+ const perDimCapped = width < sourceWidth || height < sourceHeight;
+
+ width = Math.max(32, width - (width % 2));
+ height = Math.max(32, height - (height % 2));
+
+ let areaCapped = false;
+ if (width * height > avcMaxPixels) {
+ areaCapped = true;
+ const scale = Math.sqrt(avcMaxPixels / (width * height));
+ width = Math.max(32, Math.floor((width * scale) / 2) * 2);
+ height = Math.max(32, Math.floor((height * scale) / 2) * 2);
+ }
+
+ return { width, height, capped: { perDim: perDimCapped, area: areaCapped } };
+}
+
+// Skip a rebuild if the last one was within the throttle window;
+// otherwise encoder.error fires per frame and burns the cap in ms.
+export function shouldThrottleReclaimRebuild(
+ nowMs,
+ lastRebuildAtMs,
+ throttleMs,
+) {
+ if (lastRebuildAtMs === null || lastRebuildAtMs === undefined) return false;
+ if (!Number.isFinite(throttleMs) || throttleMs <= 0) return false;
+ return nowMs - lastRebuildAtMs < throttleMs;
+}
+
+// After resetAfterMs of clean chunks since the last reclaim, restore
+// the full rebuild budget for a future intermittent reclaim.
+export function shouldResetReclaimCounter(
+ lastChunkAtMs,
+ lastReclaimAtMs,
+ resetAfterMs,
+ currentCount,
+) {
+ if (currentCount <= 0) return false;
+ if (lastReclaimAtMs === null || lastReclaimAtMs === undefined) return false;
+ return lastChunkAtMs - lastReclaimAtMs >= resetAfterMs;
+}
+
+// Frame-arrival gap above sleepGapMs is treated as wake-from-sleep. Gated
+// on running/!stopping to suppress spurious detections after stop().
+export function shouldTriggerSleepRecovery(
+ nowMs,
+ lastFrameArrivalAtMs,
+ sleepGapMs,
+ firstChunkSeen,
+ running = true,
+ stopping = false,
+) {
+ if (!running || stopping) return false;
+ if (!firstChunkSeen) return false;
+ if (lastFrameArrivalAtMs === null || lastFrameArrivalAtMs === undefined) {
+ return false;
+ }
+ if (!Number.isFinite(sleepGapMs) || sleepGapMs <= 0) return false;
+ return nowMs - lastFrameArrivalAtMs > sleepGapMs;
+}
+
+// Flush resolved but no chunks were emitted: a header-only file plays
+// silently as a corrupt blob. Caller swaps to MediaRecorder.
+export function shouldFailZeroChunksAtStop(firstChunkSeen, frameCount) {
+ return !firstChunkSeen || frameCount === 0;
+}
diff --git a/src/pages/Region/Recorder.jsx b/src/pages/Region/Recorder.jsx
index 00d5bc6..1433f0c 100644
--- a/src/pages/Region/Recorder.jsx
+++ b/src/pages/Region/Recorder.jsx
@@ -1,5 +1,6 @@
import React, { useEffect, useRef, useCallback } from "react";
import { getUserMediaWithFallback } from "../utils/mediaDeviceFallback";
+import { shouldAcquireMicAtStart } from "../utils/micAcquisitionPolicy";
import {
WebCodecsRecorder,
preloadWebCodecsModules,
@@ -125,6 +126,10 @@ const Recorder = () => {
const helperVideoStream = useRef(null);
const helperAudioStream = useRef(null);
+ // Re-entry guard for setMic()'s lazy acquire branch (see Recorder.jsx).
+ const isLazyAcquiringMic = useRef(false);
+ // Latest mic-toggle intent so a mid-acquire toggle-off is honored.
+ const pendingMicIntent = useRef(null);
const startRetryTimer = useRef(null);
const startRetryAttempts = useRef(0);
@@ -150,8 +155,8 @@ const Recorder = () => {
const lowStorageAbort = useRef(false);
const savedCount = useRef(0);
- // True once streaming-data has been received (applied OR deferred) —
- // used to stop the pull retries.
+ // True once streaming-data has been received (applied or deferred); stops
+ // the pull retries.
const streamingDataHandled = useRef(false);
const streamingDataRetryTimer = useRef(null);
// streaming-data can arrive before the `crop-target` message that sets
@@ -165,7 +170,7 @@ const Recorder = () => {
// Apply streaming-data once. Shared by the `get-streaming-data` pull
// response and the `streaming-data` push message. Idempotent. If the
// crop target hasn't landed yet (regionRef not set), the payload is
- // deferred — flushPendingStreamingData replays it.
+ // deferred; flushPendingStreamingData replays it.
const applyStreamingData = (dataStr) => {
if (streamingDataHandled.current) return;
streamingDataHandled.current = true;
@@ -204,11 +209,8 @@ const Recorder = () => {
}
};
- // Pull get-streaming-data from the SW. The SW answers the pull directly
- // with the payload (response.data), so delivery does not depend on the
- // `loaded` push landing — `loaded` is routinely lost to the cold-start
- // race (the SW→tab handoff failure). SW mid-wakeup can still drop the
- // initial sendMessage; retry with backoff.
+ // Pull streaming-data directly via response.data so we don't depend on the
+ // `loaded` push (lost to the cold-start race). Retry with backoff.
const requestStreamingDataWithRetry = (attempt = 0) => {
if (streamingDataHandled.current) return;
const backoffMs = [0, 250, 500, 1000, 2000, 3000];
@@ -240,7 +242,7 @@ const Recorder = () => {
retryIfNeeded();
return;
}
- // SW answered the pull directly with the payload — robust path.
+ // SW answered the pull directly with the payload (robust path).
if (response && response.data) {
persistRegionStartDebug({
stage: "get-streaming-data-response-applied",
@@ -318,6 +320,17 @@ const Recorder = () => {
const startRecordingTick = () => {
if (recordingTick.current) clearInterval(recordingTick.current);
+ // Resolution drift mid-recording corrupts the MR-fallback WebM
+ // (dims baked into the header). Snapshot now and diag if it shifts.
+ let initialDisplayDims = null;
+ try {
+ const vt = liveStream.current?.getVideoTracks?.()[0];
+ const s = vt?.getSettings?.();
+ if (s && Number.isFinite(s.width) && Number.isFinite(s.height)) {
+ initialDisplayDims = { width: s.width, height: s.height };
+ }
+ } catch {}
+ let resolutionDriftReported = false;
recordingTick.current = setInterval(async () => {
if (!recordingStartTimeRef.current) return;
const { totalPausedMs, pausedAt, paused } =
@@ -331,6 +344,32 @@ const Recorder = () => {
now - recordingStartTimeRef.current - basePaused - extraPaused,
);
chrome.storage.local.set({ recordingNow: now, recordingDuration: elapsed });
+ // Report once per session.
+ if (!resolutionDriftReported && initialDisplayDims) {
+ try {
+ const vt = liveStream.current?.getVideoTracks?.()[0];
+ const s = vt?.getSettings?.();
+ if (
+ s &&
+ Number.isFinite(s.width) &&
+ Number.isFinite(s.height) &&
+ (s.width !== initialDisplayDims.width ||
+ s.height !== initialDisplayDims.height)
+ ) {
+ resolutionDriftReported = true;
+ chrome.runtime.sendMessage({
+ type: "diag-forward",
+ event: "recorder-resolution-changed-mid-recording",
+ data: {
+ from: initialDisplayDims,
+ to: { width: s.width, height: s.height },
+ source: "region",
+ savedChunks: savedCount.current,
+ },
+ }).catch(() => {});
+ }
+ } catch {}
+ }
}, 1000);
};
@@ -360,6 +399,12 @@ const Recorder = () => {
async function saveChunk(e, i) {
const ts = e.timecode ?? 0;
+ // MediaRecorder occasionally fires zero-byte dataavailable
+ // (w3c/mediacapture-record#153); drop before it hits OPFS.
+ if (!e.data || e.data.size === 0) {
+ return;
+ }
+
if (!(await canFitChunk(e.data.size))) {
// Post-stop, navigator.storage.estimate() can read false-low.
// Don't surface "Memory limit reached"; save the tail chunk.
@@ -628,8 +673,7 @@ const Recorder = () => {
if (event.data.type === "crop-target") {
target.current = event.data.target;
regionRef.current = true;
- // regionRef is now set — apply any streaming-data that arrived
- // before the crop target did.
+ // regionRef is now set; apply any streaming-data that arrived first.
flushPendingStreamingData();
} else if (event.data.type === "restart-recording") {
restartRecording();
@@ -644,11 +688,8 @@ const Recorder = () => {
async function startRecording() {
if (recorder.current !== null) return;
- // Bail out if this iframe isn't actually the recording target. Without
- // this guard, a stale state (e.g. start-recording-tab arriving by some
- // unexpected path) makes the iframe spin its 5s preflight retry loop,
- // then fire "Capture stream is not ready yet" - which tears down a
- // legitimate recording happening in a different tab.
+ // Bail if this iframe isn't the recording target: stale state would
+ // fire "Capture stream not ready" and tear down the real recording.
if (!regionRef.current && !target.current) {
persistRegionStartDebug({
stage: "start-recording-bailout",
@@ -831,6 +872,18 @@ const Recorder = () => {
let mimeType = mimeTypes.find((mimeType) =>
MediaRecorder.isTypeSupported(mimeType),
);
+ // No supported WebM variant. Without an explicit mimeType the
+ // browser picks a default container and the editor can't read
+ // the resulting blob. Mirrors Free Recorder.jsx.
+ if (!mimeType) {
+ console.error(
+ "[Region.Recorder] no supported MediaRecorder mimeType",
+ );
+ sendRecordingError(
+ chrome.i18n.getMessage("unsupportedVideoCodecError"),
+ );
+ return;
+ }
const recordingId = `${Date.now()}-${Math.random()
.toString(16)
@@ -1084,78 +1137,52 @@ const Recorder = () => {
chunkWriter.current = null;
}
await updateFreeFinalizeStatus("chunks_ready", 95);
- let validation = null;
- try {
- const blob = await rebuildBlobFromChunks();
- validation = await validateFastRecorderOutputBlob(blob, {
- minBytes: 64 * 1024,
- // 15s for multi-GB demuxer scans on slow disks.
- timeoutMs: 15000,
- videoCodec: recorder.current?.selectedVideoCodec || undefined,
- audioCodec: hasAudioTrack ? "mp4a.40.2" : null,
- recordingId,
- });
- debugRecordingEvent(recdbgSessionRef, "fast-recorder-validate", {
- validation,
- });
- } catch (err) {
- validation = {
- ok: false,
- hardFail: true,
- reasons: ["validation-exception"],
- details: { error: String(err) },
- };
- }
-
- if (validation && !validation.ok) {
- await markFastRecorderFailure("validation-failed", validation);
- await chrome.storage.local.set({
- useWebCodecsRecorder: false,
- lastWebCodecsFailureAt: Date.now(),
- lastWebCodecsFailureCode: "validation-failed",
- });
- const hardFail = Boolean(validation.hardFail);
- await chrome.storage.local.set({
- fastRecorderValidationFailed: hardFail,
- fastRecorderValidation: validation,
- });
- await updateFreeFinalizeStatus(
- "failed",
- 100,
- validation.reasons || "validation-failed",
- );
- chrome.runtime.sendMessage({
- type: "show-toast",
- message: chrome.i18n.getMessage("webcodecsFailedOffToast"),
- });
- if (hardFail) {
- chrome.runtime.sendMessage({
- type: "fast-recorder-hard-fail",
- recordingId,
- });
- if (!sentLast.current) {
- sentLast.current = true;
- isFinished.current = true;
- isFinishing.current = false;
- if (!isRestarting.current) {
- chrome.runtime.sendMessage({ type: "video-ready" });
- }
- }
- return;
- }
- } else {
- await chrome.storage.local.set({
- fastRecorderValidationFailed: false,
- fastRecorderValidation: validation,
- });
- }
-
+ // Open the sandbox first (foreground demux is ~100x faster than
+ // this throttled tab); run validation off the critical path.
await chrome.storage.local.set({
lastRecordingBackendRef: chunkBackendRef.current || {
backend: "idb",
},
});
await updateFreeFinalizeStatus("ready", 100);
+ (async () => {
+ let validation = null;
+ try {
+ const blob = await rebuildBlobFromChunks();
+ validation = await validateFastRecorderOutputBlob(blob, {
+ minBytes: 64 * 1024,
+ timeoutMs: 15000,
+ videoCodec: recorder.current?.selectedVideoCodec || undefined,
+ audioCodec: hasAudioTrack ? "mp4a.40.2" : null,
+ recordingId,
+ });
+ debugRecordingEvent(recdbgSessionRef, "fast-recorder-validate", {
+ validation,
+ });
+ } catch (err) {
+ validation = {
+ ok: false,
+ hardFail: true,
+ reasons: ["validation-exception"],
+ details: { error: String(err) },
+ };
+ }
+ if (validation && !validation.ok) {
+ await markFastRecorderFailure("validation-failed", validation);
+ await chrome.storage.local.set({
+ useWebCodecsRecorder: false,
+ lastWebCodecsFailureAt: Date.now(),
+ lastWebCodecsFailureCode: "validation-failed",
+ fastRecorderValidationFailed: Boolean(validation.hardFail),
+ fastRecorderValidation: validation,
+ });
+ } else {
+ await chrome.storage.local.set({
+ fastRecorderValidationFailed: false,
+ fastRecorderValidation: validation,
+ });
+ }
+ })();
if (!sentLast.current) {
sentLast.current = true;
isFinished.current = true;
@@ -1183,16 +1210,24 @@ const Recorder = () => {
onError: (err) => {
const errStr = String(err);
const transient = isTransientFastRecorderError(errStr);
- markFastRecorderFailure("webcodecs-error", { error: errStr });
+ // err.finalized: salvage stop already ran, skip sticky-disable.
+ const fatalFinalized = err?.finalized === true;
+ markFastRecorderFailure(
+ fatalFinalized ? "webcodecs-finalized" : "webcodecs-error",
+ { error: errStr, finalized: fatalFinalized || undefined },
+ );
// Keep useWebCodecsRecorder on for transient stream errors.
const persisted = {
lastWebCodecsFailureAt: Date.now(),
lastWebCodecsFailureCode: transient
? "webcodecs-transient"
- : "webcodecs-error",
+ : fatalFinalized
+ ? "webcodecs-finalized"
+ : "webcodecs-error",
};
if (!transient) persisted.useWebCodecsRecorder = false;
chrome.storage.local.set(persisted);
+ if (fatalFinalized) return;
updateFreeFinalizeStatus("failed", 100, errStr);
// Same-session fallback: encoder errored before any chunk landed
@@ -1228,6 +1263,16 @@ const Recorder = () => {
try {
prev?.cleanup?.();
} catch {}
+ // Abort the OPFS writer so MR's ondataavailable can't
+ // stream WebM into the WebCodecs file via chunkWriter.
+ // Mirrors the free-tier fix.
+ if (chunkWriter.current) {
+ try {
+ await chunkWriter.current.abort();
+ } catch {}
+ chunkWriter.current = null;
+ chunkBackendRef.current = null;
+ }
let swapped = false;
try {
swapped = await startMediaRecorderWithCodec("vp9");
@@ -1256,7 +1301,7 @@ const Recorder = () => {
});
}
}
- // Fallback failed too — surface the original failure.
+ // Fallback failed too; surface the original failure.
chrome.runtime.sendMessage({
type: "show-toast",
message: chrome.i18n.getMessage("webcodecsFailedOffToast"),
@@ -1302,11 +1347,8 @@ const Recorder = () => {
lastWebCodecsFailureAt: Date.now(),
lastWebCodecsFailureCode: "start-failed",
});
- // The OPFS writer was opened for the WebCodecs path. If we let it
- // hang around, startMediaRecorderWithCodec's no-existing-writer guard
- // would reuse it, sending MediaRecorder bytes into OPFS where the
- // sandboxed editor can't read them. Abort here so the MR path opens
- // a fresh IDB writer.
+ // Drop the WebCodecs OPFS writer; otherwise MR bytes route into
+ // OPFS where the sandboxed editor can't read them.
if (chunkWriter.current) {
try {
await chunkWriter.current.abort();
@@ -1366,9 +1408,8 @@ const Recorder = () => {
// Force IDB: MediaRecorder chunks must relay to the null-origin sandbox
// editor, which cannot read OPFS. Always replace whatever is in
- // chunkWriter.current — if WebCodecs opened an OPFS writer earlier and
- // then fell back to us, leaving the OPFS writer in place would silently
- // route MR bytes into OPFS and strand them.
+ // Drop any OPFS writer left from a WebCodecs-then-MR fallback, or MR
+ // bytes route into OPFS and get stranded.
if (chunkWriter.current) {
try {
await chunkWriter.current.abort();
@@ -1798,21 +1839,35 @@ const Recorder = () => {
why: "Audio track became inactive",
});
};
- // Mirrors Recorder.jsx sysTrack.onended; surfaces mid-recording
- // mic disconnects.
+ // Mirrors Recorder.jsx sysTrack.onended. Below 30s the salvage prompt
+ // would over-promise (Continuity Mic often drops 10-20s in).
aTrack.onended = () => {
+ const dur = recordingStartTimeRef.current
+ ? Date.now() - recordingStartTimeRef.current
+ : null;
+ const SALVAGE_THRESHOLD_MS = 30000;
+ const isShort = !dur || dur < SALVAGE_THRESHOLD_MS;
+ const trackLabel = String(aTrack.label || "");
+ const isLikelyContinuityMic = /\biphone\b/i.test(trackLabel);
try {
chrome.runtime.sendMessage({
type: "diag-forward",
event: "recorder-region-audio-track-ended",
data: {
- trackLabel: String(aTrack.label || "").slice(0, 80),
+ trackLabel: trackLabel.slice(0, 80),
+ recordingDuration: dur,
+ isLikelyContinuityMic,
+ salvageOffered: !isShort,
},
});
} catch {}
chrome.runtime.sendMessage({
type: "show-toast",
- message: chrome.i18n.getMessage("audioTrackEndedToast"),
+ message: chrome.i18n.getMessage(
+ isShort
+ ? "streamErrorModalDescription"
+ : "audioTrackEndedToast",
+ ),
timeout: 8000,
}).catch(() => {});
};
@@ -2002,6 +2057,15 @@ const Recorder = () => {
});
helperAudioStream.current = null;
}
+ // Close the AudioContext or the audio thread ticks indefinitely
+ // and tab-reuse for another recording would stack a fresh context.
+ if (aCtx.current) {
+ try {
+ await aCtx.current.close();
+ } catch {}
+ aCtx.current = null;
+ }
+ destination.current = null;
// dismissRecording reuses isRestarting as an "incoming-chunks shield"
// during teardown; release here or a later restartRecording sees a
// stuck-true flag and early-returns false.
@@ -2249,8 +2313,12 @@ const Recorder = () => {
aCtx.current = new AudioContext();
destination.current = aCtx.current.createMediaStreamDestination();
liveStream.current = new MediaStream();
+ // If the user disabled the mic, skip getUserMedia: gain-muting still
+ // wakes iPhone Continuity etc. Toggle-on mid-recording goes via setMic().
const endMic = perfSpan("Region.Recorder startAudioStream(mic)");
- const micstream = await startAudioStream(data.defaultAudioInput);
+ const micstream = shouldAcquireMicAtStart(data)
+ ? await startAudioStream(data.defaultAudioInput)
+ : null;
endMic({ hasMic: Boolean(micstream) });
helperAudioStream.current = micstream;
@@ -2268,10 +2336,6 @@ const Recorder = () => {
.connect(destination.current);
}
- if (helperAudioStream.current != null && !data.micActive) {
- setAudioInputVolume(0);
- }
-
if (helperVideoStream.current.getAudioTracks().length > 0) {
audioOutputGain.current = aCtx.current.createGain();
audioOutputSource.current = aCtx.current.createMediaStreamSource(
@@ -2396,12 +2460,52 @@ const Recorder = () => {
}, []);
const setMic = async (result) => {
+ pendingMicIntent.current = Boolean(result.active);
if (helperAudioStream.current != null) {
if (result.active) {
setAudioInputVolume(1);
} else {
setAudioInputVolume(0);
}
+ return;
+ }
+
+ // Cold-start path: mic was off at recording start; acquire now and
+ // splice into the audio graph.
+ if (!result.active || !aCtx.current || !destination.current) return;
+ if (isLazyAcquiringMic.current) return;
+ isLazyAcquiringMic.current = true;
+ try {
+ const deviceId =
+ result.defaultAudioInput ||
+ (await chrome.storage.local.get(["defaultAudioInput"]))
+ .defaultAudioInput;
+ const acquired = await startAudioStream(deviceId);
+ const acquireFailed =
+ !acquired || !acquired.getAudioTracks().length;
+ const tornDown =
+ !aCtx.current || !destination.current || isFinishing.current;
+ const userCanceled = pendingMicIntent.current === false;
+ if (acquireFailed || tornDown || userCanceled) {
+ try {
+ acquired?.getTracks?.().forEach((t) => t.stop());
+ } catch {}
+ // See Recorder.jsx setMic for rationale.
+ if (acquireFailed && !tornDown && !userCanceled) {
+ try {
+ chrome.storage.local.set({ micActive: false });
+ } catch {}
+ }
+ return;
+ }
+ helperAudioStream.current = acquired;
+ audioInputGain.current = aCtx.current.createGain();
+ audioInputSource.current = aCtx.current.createMediaStreamSource(acquired);
+ audioInputSource.current
+ .connect(audioInputGain.current)
+ .connect(destination.current);
+ } finally {
+ isLazyAcquiringMic.current = false;
}
};
@@ -2412,9 +2516,8 @@ const Recorder = () => {
isRegion: Boolean(request.region),
});
backupRef.current = request.backup;
- // streaming-data is pulled on mount (see the mount effect), not
- // here — `loaded` can be lost to the cold-start race and must not
- // be the sole trigger for the pull.
+ // streaming-data is pulled on mount; `loaded` is lost to the
+ // cold-start race and can't be the sole trigger.
// Ack so BG's sendMessageRecord doesn't reject + trigger retries.
try { sendResponse?.({ ok: true }); } catch {}
return true;
@@ -2437,8 +2540,7 @@ const Recorder = () => {
});
if (regionRef.current || target.current) {
regionRef.current = true;
- // regionRef is set — apply any streaming-data that was deferred
- // because it arrived before the crop target.
+ // regionRef is set; apply streaming-data that arrived early.
flushPendingStreamingData();
setRegionRestartPhase("restart-started");
startRecording();
@@ -2578,11 +2680,8 @@ const Recorder = () => {
lifecycle("Region.Recorder", "iframe-mount", {
href: typeof window !== "undefined" ? window.location?.href?.slice(0, 200) : null,
});
- // Pull streaming-data as soon as the iframe is mounted — do not wait
- // for the SW's `loaded` push, which is routinely lost to the
- // cold-start race (the SW→tab handoff failure). The pull is answered
- // directly in its own response; if the crop target hasn't landed yet
- // the payload is deferred and replayed by flushPendingStreamingData.
+ // Pull streaming-data on mount; don't wait for the `loaded` push (lost
+ // to the cold-start race). Deferred if crop target hasn't landed.
requestStreamingDataWithRetry();
return () => {
diff --git a/src/pages/Sandbox/Sandbox.jsx b/src/pages/Sandbox/Sandbox.jsx
index ae4cd5c..da6ef43 100644
--- a/src/pages/Sandbox/Sandbox.jsx
+++ b/src/pages/Sandbox/Sandbox.jsx
@@ -15,6 +15,7 @@ import { ContentStateContext } from "./context/ContentState";
import { diagForward } from "../utils/diagForward";
import { perfMark } from "../utils/perfMarks";
import { triggerSupportDownload } from "../utils/triggerSupportDownload";
+import GradientBackground from "../Components/GradientBackground";
const Sandbox = () => {
const [contentState, setContentState] = useContext(ContentStateContext);
@@ -337,7 +338,7 @@ const Sandbox = () => {
)}
</div>
<HelpButton />
- <div className="setupBackgroundSVG"></div>
+ <GradientBackground />
</div>
)}
<style>
@@ -346,16 +347,6 @@ const Sandbox = () => {
.wrap {
overflow: hidden;
}
- .setupBackgroundSVG {
- position: absolute;
- top: 0px;
- left: 0px;
- width: 100%;
- height: 100%;
- background: url(/assets/helper/pattern-svg.svg) repeat;
- background-size: 62px 23.5px;
- animation: moveBackground 138s linear infinite;
- }
.button-stop {
padding: 10px 20px;
background: #FFF;
@@ -370,15 +361,6 @@ const Sandbox = () => {
margin-right: auto;
z-index: 999999;
}
-
- @keyframes moveBackground {
- 0% {
- background-position: 0 0;
- }
- 100% {
- background-position: 100% 0;
- }
- }
.logo {
position: absolute;
@@ -395,6 +377,7 @@ const Sandbox = () => {
width: 100%;
height: 100%;
background-color: #F6F7FB;
+ isolation: isolate;
}
.middle-area {
display: flex;
diff --git a/src/pages/Setup/Setup.jsx b/src/pages/Setup/Setup.jsx
index 88e04df..48fb292 100644
--- a/src/pages/Setup/Setup.jsx
+++ b/src/pages/Setup/Setup.jsx
@@ -1,4 +1,5 @@
import React, { useEffect, useState } from "react";
+import GradientBackground from "../Components/GradientBackground";
const Setup = () => {
const [setupComplete, setSetupComplete] = useState(false);
@@ -38,6 +39,7 @@ const Setup = () => {
return (
<div className="setupBackground">
+ <GradientBackground />
{!setupComplete && (
<div className="setupContainer">
<div className="setupImage">
@@ -106,12 +108,6 @@ const Setup = () => {
padding: 0;
min-height: 100%;
background-color: #F6F7FB!important;
- background: url('` +
- chrome.runtime.getURL("assets/helper/pattern-svg.svg") +
- `') repeat;
- background-size: 62px 23.5px;
- animation: moveBackground 138s linear infinite;
- transform: rotate(0deg);
}
.setupInfo {
@@ -121,15 +117,6 @@ const Setup = () => {
text-decoration: none!important;
color: #4C7DE2;
}
-
- @keyframes moveBackground {
- 0% {
- background-position: 0 0;
- }
- 100% {
- background-position: 100% 0;
- }
- }
.setupLogo {
@@ -148,6 +135,7 @@ const Setup = () => {
display: flex;
justify-content: center;
align-items: center;
+ isolation: isolate;
}
.setupContainer {
diff --git a/src/pages/utils/errorCodes.js b/src/pages/utils/errorCodes.js
index 2cadc9c..8ddf0f0 100644
--- a/src/pages/utils/errorCodes.js
+++ b/src/pages/utils/errorCodes.js
@@ -57,6 +57,7 @@ const STREAM_PATTERNS = [
"failed to setup streaming",
"failed to get stream",
"failed to access screen stream",
+ "the screen stream",
"failed to access region stream",
"no streams to record",
"no screen video track",
@@ -96,6 +97,7 @@ const TAB_PATTERNS = [
"unable to resolve tab",
"tab capture",
"message routing",
+ "this tab's video",
];
const TIMEOUT_PATTERNS = [
@@ -136,7 +138,11 @@ export const classifyError = (errorStr = "", errorType = "") => {
return REC_START_PERM;
}
- if (lower.includes("streaming-data never arrived")) {
+ if (
+ lower.includes("streaming-data never arrived") ||
+ lower.includes("didn't start in time") ||
+ lower.includes("didnt start in time")
+ ) {
return REC_START_NO_STREAM_MSG;
}
diff --git a/src/pages/utils/micAcquisitionPolicy.js b/src/pages/utils/micAcquisitionPolicy.js
new file mode 100644
index 0000000..e287aa3
--- /dev/null
+++ b/src/pages/utils/micAcquisitionPolicy.js
@@ -0,0 +1,5 @@
+// Skip getUserMedia at record start when the user has the mic off: gain-muting
+// still wakes iPhone Continuity etc. Pure (unit-tested under tests/unit/).
+export function shouldAcquireMicAtStart(data) {
+ return Boolean(data && data.micActive === true);
+}