The free and privacy-friendly screen recorder with no limits 🎥
JavaScript annotationannotation-toolaudiocamerachrome-extensiondesigneditorffmpegjavascriptproductivityrecorderscreen-capturescreen-recorderscreencasttensorflowvideo
More reliable recording starts and recovery, cancellable downloads that don't hang, and instant large-file editing
Alyssa X19a1fc808df5
diff --git a/package.json b/package.jsonindex 18ab26b..1b25d22 100755--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "screenity",- "version": "4.5.2",+ "version": "4.5.3","description": "The free and privacy-friendly screen recorder with no sign in needed.","scripts": {"build": "cross-env NODE_ENV=production node utils/build.js",diff --git a/src/_locales/ca/messages.json b/src/_locales/ca/messages.jsonindex 1a4699c..c221f9e 100644--- a/src/_locales/ca/messages.json+++ b/src/_locales/ca/messages.json@@ -1682,5 +1682,33 @@"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"+ },+ "cancelLabel": {+ "message": "Cancel·la",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "La conversió a WebM pot trigar una estona",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "Desar com a WebM torna a codificar tot el vídeo, de manera que pot trigar uns minuts en gravacions llargues. L'MP4 es desa a l'instant.",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "Descarrega MP4 en lloc d'això",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "Continua amb WebM",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "Preparant la teva descàrrega",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "Això pot trigar una estona en gravacions llargues.",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/_locales/de/messages.json b/src/_locales/de/messages.jsonindex 472babb..35a3c3d 100644--- a/src/_locales/de/messages.json+++ b/src/_locales/de/messages.json@@ -1682,5 +1682,33 @@"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"+ },+ "cancelLabel": {+ "message": "Abbrechen",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "Die Konvertierung in WebM kann eine Weile dauern",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "Beim Speichern als WebM wird das gesamte Video neu codiert, was bei langen Aufnahmen einige Minuten dauern kann. MP4 wird sofort gespeichert.",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "Stattdessen MP4 herunterladen",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "Mit WebM fortfahren",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "Download wird vorbereitet",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "Bei langen Aufnahmen kann dies eine Weile dauern.",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.jsonindex 9d10c77..5df7d84 100644--- a/src/_locales/en/messages.json+++ b/src/_locales/en/messages.json@@ -1700,5 +1700,33 @@"recordingCorruptToast": {"message": "This recording can't be played back. The file may be incomplete or corrupted. Try downloading the raw file from the Save menu.","description": "Toast shown when the editor's video element fails to decode the recording (corrupt or zero-byte file)"+ },+ "cancelLabel": {+ "message": "Cancel",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "Converting to WebM may take a while",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "Saving as WebM re-encodes the whole video, so it can take a few minutes for long recordings. MP4 saves instantly.",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "Download MP4 instead",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "Continue to WebM",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "Preparing your download",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "This can take a while for long recordings.",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/_locales/es/messages.json b/src/_locales/es/messages.jsonindex 1a9eb0b..ef0d312 100644--- a/src/_locales/es/messages.json+++ b/src/_locales/es/messages.json@@ -1682,5 +1682,33 @@"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"+ },+ "cancelLabel": {+ "message": "Cancelar",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "La conversión a WebM puede tardar un rato",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "Guardar como WebM vuelve a codificar todo el vídeo, por lo que puede tardar unos minutos en grabaciones largas. El MP4 se guarda al instante.",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "Descargar MP4 en su lugar",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "Continuar con WebM",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "Preparando tu descarga",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "Esto puede tardar un rato en grabaciones largas.",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/_locales/fr/messages.json b/src/_locales/fr/messages.jsonindex 3e10306..d219630 100644--- a/src/_locales/fr/messages.json+++ b/src/_locales/fr/messages.json@@ -1682,5 +1682,33 @@"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"+ },+ "cancelLabel": {+ "message": "Annuler",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "La conversion en WebM peut prendre un moment",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "Enregistrer en WebM réencode l'intégralité de la vidéo, ce qui peut prendre quelques minutes pour les longs enregistrements. Le MP4 s'enregistre instantanément.",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "Télécharger le MP4 à la place",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "Continuer avec WebM",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "Préparation de votre téléchargement",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "Cela peut prendre un moment pour les longs enregistrements.",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/_locales/hi/messages.json b/src/_locales/hi/messages.jsonindex fbcac98..2c9b181 100644--- a/src/_locales/hi/messages.json+++ b/src/_locales/hi/messages.json@@ -1682,5 +1682,33 @@"unsupportedVideoCodecError": {"message": "आपका ब्राउज़र ज़रूरी वीडियो कोडेक्स का समर्थन नहीं करता। Chrome को अपडेट करें और फिर से कोशिश करें।","description": "Shown when no supported MediaRecorder mimeType is available"+ },+ "cancelLabel": {+ "message": "रद्द करें",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "WebM में बदलने में कुछ समय लग सकता है",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "WebM के रूप में सहेजने पर पूरा वीडियो फिर से एन्कोड होता है, इसलिए लंबी रिकॉर्डिंग में कुछ मिनट लग सकते हैं। MP4 तुरंत सहेजा जाता है।",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "इसके बजाय MP4 डाउनलोड करें",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "WebM के साथ जारी रखें",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "आपका डाउनलोड तैयार किया जा रहा है",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "लंबी रिकॉर्डिंग में इसमें कुछ समय लग सकता है।",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/_locales/id/messages.json b/src/_locales/id/messages.jsonindex d504efd..ad2ca9a 100644--- a/src/_locales/id/messages.json+++ b/src/_locales/id/messages.json@@ -1682,5 +1682,33 @@"unsupportedVideoCodecError": {"message": "Browser Anda tidak mendukung codec video yang diperlukan. Perbarui Chrome lalu coba lagi.","description": "Shown when no supported MediaRecorder mimeType is available"+ },+ "cancelLabel": {+ "message": "Batal",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "Mengonversi ke WebM mungkin memakan waktu",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "Menyimpan sebagai WebM mengodekan ulang seluruh video, sehingga bisa memakan waktu beberapa menit untuk rekaman panjang. MP4 disimpan secara instan.",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "Unduh MP4 saja",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "Lanjutkan ke WebM",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "Menyiapkan unduhan Anda",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "Ini bisa memakan waktu untuk rekaman panjang.",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/_locales/it/messages.json b/src/_locales/it/messages.jsonindex 35feb94..2535e42 100644--- a/src/_locales/it/messages.json+++ b/src/_locales/it/messages.json@@ -1677,5 +1677,33 @@"unsupportedVideoCodecError": {"message": "Il tuo browser non supporta i codec video richiesti. Aggiorna Chrome e riprova.","description": "Shown when no supported MediaRecorder mimeType is available"+ },+ "cancelLabel": {+ "message": "Annulla",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "La conversione in WebM potrebbe richiedere del tempo",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "Il salvataggio come WebM ricodifica l'intero video, quindi può richiedere alcuni minuti per le registrazioni lunghe. L'MP4 viene salvato all'istante.",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "Scarica invece l'MP4",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "Continua con WebM",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "Preparazione del download",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "Questo può richiedere del tempo per le registrazioni lunghe.",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/_locales/ko/messages.json b/src/_locales/ko/messages.jsonindex cdee675..fdba738 100644--- a/src/_locales/ko/messages.json+++ b/src/_locales/ko/messages.json@@ -1682,5 +1682,33 @@"unsupportedVideoCodecError": {"message": "브라우저가 필요한 비디오 코덱을 지원하지 않아요. Chrome을 업데이트하고 다시 시도해 주세요.","description": "Shown when no supported MediaRecorder mimeType is available"+ },+ "cancelLabel": {+ "message": "취소",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "WebM으로 변환하는 데 시간이 걸릴 수 있습니다",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "WebM으로 저장하면 전체 영상을 다시 인코딩하므로 긴 녹화의 경우 몇 분이 걸릴 수 있습니다. MP4는 즉시 저장됩니다.",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "대신 MP4 다운로드",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "WebM으로 계속",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "다운로드 준비 중",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "긴 녹화의 경우 시간이 걸릴 수 있습니다.",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/_locales/pl/messages.json b/src/_locales/pl/messages.jsonindex 9af7709..cb6b7ea 100644--- a/src/_locales/pl/messages.json+++ b/src/_locales/pl/messages.json@@ -1682,5 +1682,33 @@"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"+ },+ "cancelLabel": {+ "message": "Anuluj",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "Konwersja do WebM może chwilę potrwać",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "Zapisywanie jako WebM ponownie koduje cały film, więc w przypadku długich nagrań może to potrwać kilka minut. MP4 zapisuje się natychmiast.",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "Pobierz zamiast tego MP4",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "Kontynuuj z WebM",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "Przygotowywanie pobierania",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "W przypadku długich nagrań może to chwilę potrwać.",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/_locales/pt_BR/messages.json b/src/_locales/pt_BR/messages.jsonindex 01a8b9d..85dc033 100644--- a/src/_locales/pt_BR/messages.json+++ b/src/_locales/pt_BR/messages.json@@ -1682,5 +1682,33 @@"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"+ },+ "cancelLabel": {+ "message": "Cancelar",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "A conversão para WebM pode demorar um pouco",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "Salvar como WebM recodifica o vídeo inteiro, então pode levar alguns minutos em gravações longas. O MP4 é salvo instantaneamente.",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "Baixar MP4 em vez disso",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "Continuar para WebM",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "Preparando seu download",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "Isso pode demorar um pouco em gravações longas.",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/_locales/pt_PT/messages.json b/src/_locales/pt_PT/messages.jsonindex 0afd550..d50e53f 100644--- a/src/_locales/pt_PT/messages.json+++ b/src/_locales/pt_PT/messages.json@@ -1682,5 +1682,33 @@"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"+ },+ "cancelLabel": {+ "message": "Cancelar",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "A conversão para WebM pode demorar algum tempo",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "Guardar como WebM recodifica todo o vídeo, pelo que pode demorar alguns minutos em gravações longas. O MP4 é guardado instantaneamente.",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "Descarregar MP4 em alternativa",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "Continuar para WebM",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "A preparar a sua transferência",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "Isto pode demorar algum tempo em gravações longas.",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/_locales/ru/messages.json b/src/_locales/ru/messages.jsonindex 56d58e2..8188ba2 100644--- a/src/_locales/ru/messages.json+++ b/src/_locales/ru/messages.json@@ -1682,5 +1682,33 @@"unsupportedVideoCodecError": {"message": "Ваш браузер не поддерживает необходимые видеокодеки. Обновите Chrome и попробуйте снова.","description": "Shown when no supported MediaRecorder mimeType is available"+ },+ "cancelLabel": {+ "message": "Отмена",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "Преобразование в WebM может занять некоторое время",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "При сохранении в WebM всё видео кодируется заново, поэтому для длинных записей это может занять несколько минут. MP4 сохраняется мгновенно.",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "Скачать MP4 вместо этого",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "Продолжить с WebM",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "Подготовка загрузки",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "Для длинных записей это может занять некоторое время.",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/_locales/ta/messages.json b/src/_locales/ta/messages.jsonindex 2b2811d..78acc4e 100644--- a/src/_locales/ta/messages.json+++ b/src/_locales/ta/messages.json@@ -1682,5 +1682,33 @@"unsupportedVideoCodecError": {"message": "உங்கள் உலாவி தேவையான வீடியோ கோடெக்குகளை ஆதரிக்கவில்லை. Chrome ஐ புதுப்பித்து மீண்டும் முயற்சிக்கவும்.","description": "Shown when no supported MediaRecorder mimeType is available"+ },+ "cancelLabel": {+ "message": "ரத்து செய்",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "WebM ஆக மாற்றுவதற்கு சிறிது நேரம் ஆகலாம்",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "WebM ஆகச் சேமிக்கும்போது முழு வீடியோவும் மீண்டும் குறியாக்கம் செய்யப்படுகிறது, எனவே நீண்ட பதிவுகளுக்கு சில நிமிடங்கள் ஆகலாம். MP4 உடனடியாகச் சேமிக்கப்படும்.",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "மாறாக MP4 ஐப் பதிவிறக்கவும்",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "WebM உடன் தொடரவும்",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "உங்கள் பதிவிறக்கம் தயாராகிறது",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "நீண்ட பதிவுகளுக்கு இதற்கு சிறிது நேரம் ஆகலாம்.",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/_locales/tr/messages.json b/src/_locales/tr/messages.jsonindex f0eea53..7a55c8e 100644--- a/src/_locales/tr/messages.json+++ b/src/_locales/tr/messages.json@@ -1682,5 +1682,33 @@"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"+ },+ "cancelLabel": {+ "message": "İptal",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "WebM'e dönüştürme biraz zaman alabilir",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "WebM olarak kaydetmek videonun tamamını yeniden kodlar, bu nedenle uzun kayıtlarda birkaç dakika sürebilir. MP4 anında kaydedilir.",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "Bunun yerine MP4 indir",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "WebM ile devam et",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "İndirmeniz hazırlanıyor",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "Uzun kayıtlarda bu biraz zaman alabilir.",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/_locales/uk/messages.json b/src/_locales/uk/messages.jsonindex 72695bf..b6d8685 100644--- a/src/_locales/uk/messages.json+++ b/src/_locales/uk/messages.json@@ -1680,5 +1680,33 @@"unsupportedVideoCodecError": {"message": "Ваш браузер не підтримує потрібні відеокодеки. Оновіть Chrome і спробуйте знову.","description": "Shown when no supported MediaRecorder mimeType is available"+ },+ "cancelLabel": {+ "message": "Скасувати",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "Перетворення на WebM може зайняти деякий час",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "Збереження у форматі WebM повторно кодує все відео, тож для довгих записів це може зайняти кілька хвилин. MP4 зберігається миттєво.",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "Завантажити MP4 натомість",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "Продовжити з WebM",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "Підготовка завантаження",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "Для довгих записів це може зайняти деякий час.",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/_locales/zh_CN/messages.json b/src/_locales/zh_CN/messages.jsonindex 4bc5494..a902ce1 100644--- a/src/_locales/zh_CN/messages.json+++ b/src/_locales/zh_CN/messages.json@@ -1681,5 +1681,33 @@"unsupportedVideoCodecError": {"message": "您的浏览器不支持所需的视频编码器。请更新 Chrome 后重试。","description": "Shown when no supported MediaRecorder mimeType is available"+ },+ "cancelLabel": {+ "message": "取消",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "转换为 WebM 可能需要一些时间",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "保存为 WebM 会重新编码整个视频,因此长录制可能需要几分钟。MP4 可即时保存。",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "改为下载 MP4",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "继续转换为 WebM",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "正在准备下载",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "长录制可能需要一些时间。",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/_locales/zh_TW/messages.json b/src/_locales/zh_TW/messages.jsonindex aa9eef7..2489bc4 100644--- a/src/_locales/zh_TW/messages.json+++ b/src/_locales/zh_TW/messages.json@@ -1682,5 +1682,33 @@"unsupportedVideoCodecError": {"message": "您的瀏覽器不支援所需的視訊編解碼器。請更新 Chrome 後再試一次。","description": "Shown when no supported MediaRecorder mimeType is available"+ },+ "cancelLabel": {+ "message": "取消",+ "description": "Cancel button on the download-in-progress banner"+ },+ "webmSlowTitle": {+ "message": "轉換成 WebM 可能需要一些時間",+ "description": "Title of the modal warning that MP4 to WebM conversion is slow"+ },+ "webmSlowDescription": {+ "message": "儲存為 WebM 會重新編碼整部影片,因此長時間錄製可能需要幾分鐘。MP4 可立即儲存。",+ "description": "Body of the slow-WebM warning modal"+ },+ "webmSlowMp4": {+ "message": "改為下載 MP4",+ "description": "Primary button: download MP4 instead of the slow WebM conversion"+ },+ "webmSlowContinue": {+ "message": "繼續轉換為 WebM",+ "description": "Secondary button: proceed with the slow WebM conversion"+ },+ "downloadProcessingTitle": {+ "message": "正在準備下載",+ "description": "Title of the download-in-progress banner with the Cancel button"+ },+ "downloadProcessingDescription": {+ "message": "長時間錄製可能需要一些時間。",+ "description": "Body of the download-in-progress banner"}}diff --git a/src/manifest.json b/src/manifest.jsonindex 038f424..3e5230e 100755--- a/src/manifest.json+++ b/src/manifest.json@@ -3,7 +3,7 @@"name": "__MSG_extName__","description": "__MSG_extDesc__","default_locale": "en",- "version": "4.5.2",+ "version": "4.5.3","background": {"service_worker": "background.bundle.js"},diff --git a/src/pages/Background/alarms/handleAlarm.js b/src/pages/Background/alarms/handleAlarm.jsindex 604e71e..ef1b781 100644--- a/src/pages/Background/alarms/handleAlarm.js+++ b/src/pages/Background/alarms/handleAlarm.js@@ -232,25 +232,9 @@ export const handleAlarm = async (alarm) => {const { recording } = await chrome.storage.local.get(["recording"]);if (recording) {diagEvent("error", { note: "first-chunk-watchdog-fired" });- // If the fast (WebCodecs) recorder was in use, a missing first chunk- // is almost always a silently-failed WebCodecs encoder (the- // "28-byte ftyp" stall). Sticky-disable it now so the user's retry- // falls back to MediaRecorder and succeeds, instead of hitting- // WebCodecs again and failing identically. (markFastRecorderFailure- // ignores transient stream errors via its own pattern list.)- try {- const { fastRecorderInUse } = await chrome.storage.local.get([- "fastRecorderInUse",- ]);- if (fastRecorderInUse) {- await markFastRecorderFailure("webcodecs-no-first-chunk", {- error: "WebCodecs produced no first chunk within 8s (watchdog)",- });- }- } catch (err) {- console.warn("[Screenity][BG] watchdog sticky-disable failed", err);- }- // 1500ms cap so a wedged tab can't delay the user-facing error+ // Snapshot the recorder first (1500ms cap so a wedged tab can't delay the+ // user-facing error) so the disable and stop decisions can read the+ // capture track's state.let snapshot = null;let snapshotError = null;try {@@ -276,15 +260,44 @@ export const handleAlarm = async (alarm) => {},});} catch {}- // handleRecordingError (not sendMessageRecord) so the editor gets notified- try {- await handleRecordingError({- error: "stream-error",- why: "Recording failed: no video data received within 8 seconds. The tab may have been throttled. Please try again.",- errorCode: "no-first-chunk",- });- } catch (err) {- console.warn("[Screenity][BG] first-chunk watchdog handler failed", err);++ const vt = snapshot?.stream?.videoTrack || null;+ if (vt && vt.readyState === "live" && vt.muted === true) {+ // Capture track is live but muted: the recorded tab is backgrounded,+ // focus was lost, or the display slept, so no frames are arriving. That+ // is not an encoder defect, so don't disable WebCodecs and don't fail+ // the recording. It keeps running and the first chunk cancels this+ // watchdog once the user returns and frames resume.+ diagEvent("warning", { note: "first-chunk-watchdog-capture-muted" });+ } else {+ // Sticky-disable WebCodecs for the device only when the capture track+ // was live and unmuted yet produced no chunk (the genuine "28-byte+ // ftyp" silent-encoder defect). An ended track or no snapshot is+ // ambiguous: fail the recording but leave the fast path enabled.+ try {+ const { fastRecorderInUse } = await chrome.storage.local.get([+ "fastRecorderInUse",+ ]);+ const realEncoderDefect =+ Boolean(vt) && vt.readyState === "live" && vt.muted === false;+ if (fastRecorderInUse && realEncoderDefect) {+ await markFastRecorderFailure("webcodecs-no-first-chunk", {+ error: "WebCodecs produced no first chunk within 8s (watchdog)",+ });+ }+ } catch (err) {+ console.warn("[Screenity][BG] watchdog sticky-disable failed", err);+ }+ // handleRecordingError (not sendMessageRecord) so the editor gets notified+ try {+ await handleRecordingError({+ error: "stream-error",+ why: "Recording failed: no video data received within 8 seconds. The tab may have been throttled. Please try again.",+ errorCode: "no-first-chunk",+ });+ } catch (err) {+ console.warn("[Screenity][BG] first-chunk watchdog handler failed", err);+ }}}await chrome.alarms.clear(FIRST_CHUNK_WATCHDOG_ALARM);diff --git a/src/pages/Background/index.js b/src/pages/Background/index.jsindex 5d84ba3..8cb857c 100644--- a/src/pages/Background/index.js+++ b/src/pages/Background/index.js@@ -13,6 +13,12 @@ import {} from "../CloudRecorder/recorderStorage/opfsKvStore";import { handleGetStreamingData } from "./recording/recordingHelpers";+// Don't tear down an in-flight start on SW restart: a fresh start is+// mid-setup (recorder tab not loaded yet), not dead. Mirrors the alarm+// watchdog's recordingStartingAt window (handleAlarm.js).+const ENABLE_START_GRACE_ON_INIT = true;+const START_GRACE_MS = 30_000;+// Must run before any message/alarm handler can bail on a stale lock.const clearStaleLocks = async () => {try {@@ -27,6 +33,7 @@ const clearStaleLocks = async () => {offscreen,multiMode,region,+ recordingStartingAt,} = await chrome.storage.local.get(["sendingChunks","postStopEditorOpening",@@ -38,6 +45,7 @@ const clearStaleLocks = async () => {"offscreen","multiMode","region",+ "recordingStartingAt",]);const stale = {};@@ -81,7 +89,26 @@ const clearStaleLocks = async () => {);} catch {}}- if (!recorderAlive) {+ // A start younger than START_GRACE_MS is mid-setup, not dead: the SW+ // restarted before the recorder tab came up. Wiping it here is what+ // surfaces as REC_START_FAILED under SW instability. Leave it; the+ // alarm watchdog (same window) and the recorder's 12s start gate+ // still catch a genuinely dead start.+ const startIsFresh =+ ENABLE_START_GRACE_ON_INIT &&+ typeof recordingStartingAt === "number" &&+ Date.now() - recordingStartingAt < START_GRACE_MS;+ if (!recorderAlive && startIsFresh) {+ console.warn(+ "[Screenity][BG] Stale-looking start on startup but within start grace, keeping",+ { recordingStartingAt, ageMs: Date.now() - recordingStartingAt },+ );+ diagEvent("sw-init-start-grace-kept", {+ ageMs: Date.now() - recordingStartingAt,+ recordingTab: recordingTab || null,+ });+ }+ if (!recorderAlive && !startIsFresh) {stale.recording = false;stale.pendingRecording = false;stale.restarting = false;diff --git a/src/pages/Background/messaging/handlers.js b/src/pages/Background/messaging/handlers.jsindex 018fb73..a55ab73 100644--- a/src/pages/Background/messaging/handlers.js+++ b/src/pages/Background/messaging/handlers.js@@ -1189,13 +1189,17 @@ export const setupHandlers = () => {};}try {- // deterministic timeout so a wedged offscreen can't hang the caller forever- const REMUX_TIMEOUT_MS = 60_000;+ // deterministic timeout so a wedged offscreen can't hang the caller+ // forever. WebM is a full re-encode (minutes on large files), so it gets+ // a far longer ceiling than the packet-copy remux; the editor's+ // progress-reset stall guard catches a genuinely wedged conversion first.+ const isWebm = message.kind === "webm";+ const TIMEOUT_MS = isWebm ? 30 * 60_000 : 60_000;let timeoutId = null;try {const response = await Promise.race([chrome.runtime.sendMessage({- type: "remux-start",+ type: isWebm ? "webm-start" : "remux-start",requestId: message.requestId,inputFileName: message.inputFileName,outputFileName: message.outputFileName,@@ -1203,7 +1207,7 @@ export const setupHandlers = () => {new Promise((_, reject) => {timeoutId = setTimeout(() => reject(new Error("remux-offscreen-timeout")),- REMUX_TIMEOUT_MS,+ TIMEOUT_MS,);}),]);diff --git a/src/pages/Background/offscreen/ensureRemuxOffscreen.js b/src/pages/Background/offscreen/ensureRemuxOffscreen.jsindex aa2c7d6..e33ac92 100644--- a/src/pages/Background/offscreen/ensureRemuxOffscreen.js+++ b/src/pages/Background/offscreen/ensureRemuxOffscreen.js@@ -14,27 +14,39 @@ export const ensureRemuxOffscreen = async () => {throw new Error("offscreen-api-unavailable");}- const contexts = await chrome.runtime.getContexts({});- const existing = contexts.find(- (c) => c.contextType === "OFFSCREEN_DOCUMENT",- );- if (existing) {+ // The recorder offscreen tears down asynchronously right after a recording+ // stops, so a download fired immediately after can still see it present.+ // Poll for it to finish closing (~7s) before giving up, so a just-recorded+ // download still gets the streaming OPFS remux/encode instead of the slow+ // in-editor BufferTarget fallback. We never displace the recorder ourselves:+ // closing it mid-capture kills the recording and aborts TUS finalize.+ const waitDelaysMs = [0, 500, 1000, 1500, 2000, 2000];+ for (let i = 0; i < waitDelaysMs.length; i += 1) {+ if (waitDelaysMs[i] > 0) {+ await new Promise((r) => setTimeout(r, waitDelaysMs[i]));+ }+ const contexts = await chrome.runtime.getContexts({});+ const existing = contexts.find(+ (c) => c.contextType === "OFFSCREEN_DOCUMENT",+ );+ if (!existing) break;const existingUrl =typeof existing.documentUrl === "string" ? existing.documentUrl : "";- const alreadyRemux = existingUrl.endsWith(REMUX_OFFSCREEN_URL);- if (alreadyRemux) return;- // never displace the recorder offscreen; closing it mid-capture kills the- // recording and mid-upload aborts TUS finalize. editor download() falls back.+ if (existingUrl.endsWith(REMUX_OFFSCREEN_URL)) return;if (existingUrl.includes("offscreenrecorder.html")) {- throw new Error("offscreen-busy-recorder");+ // Recorder still closing; wait and retry. Give up only on the last try.+ if (i === waitDelaysMs.length - 1) {+ throw new Error("offscreen-busy-recorder");+ }+ continue;}+ // A different offscreen (audio beep / upload resume): close it and proceed.try {await chrome.offscreen.closeDocument();} catch (err) {- // If closeDocument fails we still try to proceed; createDocument- // will surface a clearer error if the state is actually bad.console.warn("ensureRemuxOffscreen: closeDocument failed", err);}+ break;}await chrome.offscreen.createDocument({diff --git a/src/pages/Content/Wrapper.jsx b/src/pages/Content/Wrapper.jsxindex e131009..133911a 100644--- a/src/pages/Content/Wrapper.jsx+++ b/src/pages/Content/Wrapper.jsx@@ -331,7 +331,8 @@ const Wrapper = () => {{contentState.zoomEnabled && <ZoomContainer />}<BlurTool />- {contentState.showExtension || contentState.recording ? (+ {(contentState.showExtension || contentState.recording) &&+ contentState.recordingUiAllowed !== false ? (<div>{!contentState.recording &&!contentState.drawingMode &&diff --git a/src/pages/Content/context/ContentState.jsx b/src/pages/Content/context/ContentState.jsxindex 54c6980..b149350 100644--- a/src/pages/Content/context/ContentState.jsx+++ b/src/pages/Content/context/ContentState.jsx@@ -43,6 +43,11 @@ const deriveCursorMode = (effects, fallbackMode) => {return effects[0] || "none";};+// Scope the recording toolbar + camera bubble to the recorded tab for+// tab/region recordings (they leak into other tabs today). Computation errs+// toward showing; setting this false restores the prior always-show behavior.+const ENABLE_TAB_SCOPED_UI = true;+const ContentState = (props) => {const [timer, setTimerInternal] = React.useState(0);const CLOUD_FEATURES_ENABLED =@@ -95,6 +100,44 @@ const ContentState = (props) => {return true;}, []);+ // Whether THIS tab may render the recording UI. For tab/region recordings the+ // toolbar + camera belong to the recorded tab only; desktop/screen/camera-only+ // and idle are unaffected (always allowed). Errs toward showing while the tab+ // id is still unknown so the recorded tab never flashes blank on navigation.+ // The render gate in Wrapper reads contentState.recordingUiAllowed.+ const recomputeRecordingUiAllowed = useCallback(+ (reason) => {+ const s = contentStateRef.current;+ const type = s?.recordingType;+ const tabBoundFlow =+ (type === "tab" || type === "region") &&+ Boolean(+ s?.recording ||+ s?.countdownActive ||+ s?.isCountdownVisible ||+ s?.preparingRecording ||+ s?.pendingRecording,+ );+ let allowed = true;+ if (ENABLE_TAB_SCOPED_UI && tabBoundFlow && tabIdRef.current != null) {+ allowed = isTargetTab();+ }+ if (s?.recordingUiAllowed !== allowed) {+ lifecycle("Content.ContentState", "recording-ui-allowed", {+ allowed,+ reason,+ tabId: tabIdRef.current,+ tabRecordedID: tabRecordedIdRef.current,+ recordingUiTabId: recordingUiTabRef.current,+ recordingType: type,+ tabBoundFlow,+ });+ setContentState((prev) => ({ ...prev, recordingUiAllowed: allowed }));+ }+ },+ [isTargetTab],+ );+const verifyUser = useCallback(async () => {if (!CLOUD_FEATURES_ENABLED) return;// Don't force a cookie-based re-login from the popup: a fresh install with@@ -134,6 +177,7 @@ const ContentState = (props) => {chrome.runtime.sendMessage({ type: "get-tab-id" }, (response) => {if (response?.tabId !== undefined && response?.tabId !== null) {tabIdRef.current = response.tabId;+ recomputeRecordingUiAllowed("tab-id");}});@@ -152,9 +196,27 @@ const ContentState = (props) => {recordingUiTabRef.current = result.recordingUiTabId ?? null;recordingStartTimeRef.current = result.recordingStartTime ?? null;recordingBeepTabIdRef.current = result.recordingBeepTabId ?? null;+ recomputeRecordingUiAllowed("storage-mount");},);- }, []);+ }, [recomputeRecordingUiAllowed]);++ // Recompute the recording-UI scope on visibility/focus. Unlike+ // reconcileOnVisible (which bails during active recording), this runs during+ // recording too, so a tab the user switches to mid-recording re-scopes. Flow+ // changes (recording/type/scoping) trigger a recompute from the storage+ // onChanged listener below. Deps are the stable callback only; this effect+ // runs before `contentState` is declared, so it must not reference it.+ useEffect(() => {+ recomputeRecordingUiAllowed("mount");+ const onVisible = () => recomputeRecordingUiAllowed("visibility");+ document.addEventListener("visibilitychange", onVisible);+ window.addEventListener("focus", onVisible);+ return () => {+ document.removeEventListener("visibilitychange", onVisible);+ window.removeEventListener("focus", onVisible);+ };+ }, [recomputeRecordingUiAllowed]);// Permissions-Policy: camera=(), microphone=() on the host page disables// those APIs in every iframe including ours, surfacing as NotAllowedError;@@ -1226,6 +1288,21 @@ const ContentState = (props) => {});contentStateRef.current = contentState;+ // Re-scope the recording UI when the recording flow changes (recording / type+ // / countdown / preparing). Placed after `contentState` is declared so it can+ // depend on it; recompute reads fresh state via contentStateRef.+ useEffect(() => {+ recomputeRecordingUiAllowed("flow");+ }, [+ recomputeRecordingUiAllowed,+ contentState.recording,+ contentState.recordingType,+ contentState.countdownActive,+ contentState.isCountdownVisible,+ contentState.preparingRecording,+ contentState.pendingRecording,+ ]);+setContentState = (updater) => {if (typeof updater === "function") {setContentStateInternal((prevState) => {diff --git a/src/pages/Editor/mediabunny/lib/videoConverter.ts b/src/pages/Editor/mediabunny/lib/videoConverter.tsindex 42f6854..0f9b9f2 100644--- a/src/pages/Editor/mediabunny/lib/videoConverter.ts+++ b/src/pages/Editor/mediabunny/lib/videoConverter.ts@@ -21,6 +21,10 @@ export interface ConversionOptions {audioCodec?: AudioCodec;onProgress?: (progress: number) => void;verbose?: boolean;+ // When provided (e.g. a StreamTarget writing to OPFS), output streams to it+ // and convert() resolves to null; the caller owns the written file. Used by+ // the offscreen worker to re-encode large files with bounded memory.+ target?: any;}export interface CodecInfo {@@ -130,7 +134,7 @@ export class VideoConverter {? new Mp4OutputFormat({ fastStart: false }): new WebMOutputFormat();- const target = new BufferTarget();+ const target = options.target || new BufferTarget();const output = new Output({ format: outputFormat, target });const conversion = await Conversion.init({@@ -151,6 +155,10 @@ export class VideoConverter {await conversion.execute();+ // Streamed to a caller-provided target (e.g. OPFS): the caller owns the+ // output file, so there's no in-memory buffer to wrap.+ if (options.target) return null;+if (!target.buffer) throw new Error("Conversion failed - no output buffer");return new Blob([target.buffer], {diff --git a/src/pages/EditorApp/context/ContentState.jsx b/src/pages/EditorApp/context/ContentState.jsxindex f484f72..2f944e0 100644--- a/src/pages/EditorApp/context/ContentState.jsx+++ b/src/pages/EditorApp/context/ContentState.jsx@@ -34,6 +34,18 @@ const loadMb = () => {return _mbPromise;};+// Pre-finalize the downloadable standard MP4 in the background on editor-ready+// so the MP4 download is an instant file-save instead of an on-click remux that+// can stall on large recordings. Flag-gated; download falls back to the on-+// demand remux and the fragmented file if disabled or if the finalize fails.+const ENABLE_EAGER_MP4_FINALIZE = true;++// Route the MP4 -> WebM re-encode through the offscreen worker (OPFS-streamed,+// bounded memory) instead of the in-editor BufferTarget path that OOMs on large+// files. On failure (incl. a 60s no-progress stall) the download falls back to+// delivering the source file, so it's safe to leave on.+const ENABLE_OFFSCREEN_WEBM = true;+localforage.config({driver: localforage.INDEXEDDB,name: "screenity",@@ -382,20 +394,38 @@ const ContentState = (props) => {// A finalized OPFS recording is download-ready once the OPFS writer stamps// lastRecordingFinalizedFileName (a reliable write). The freeFinalizeStatus// "ready" below is fire-and-forget and often never lands, so use the marker.+ // The marker is a single write a SW restart mid-finalize can wipe, so when+ // it's missing we fall back to the OPFS file itself: if the session+ // completed and the file exists with content, it's finalized regardless.+ // This avoids the 60s freeFinalizeStatus timeout + the premature "stuck"+ // error when the marker is lost.const isOpfsFinalized = async () => {try {- const { lastRecordingBackendRef, lastRecordingFinalizedFileName } =- await chrome.storage.local.get([- "lastRecordingBackendRef",- "lastRecordingFinalizedFileName",- ]);+ const {+ lastRecordingBackendRef,+ lastRecordingFinalizedFileName,+ freeRecorderSession,+ } = await chrome.storage.local.get([+ "lastRecordingBackendRef",+ "lastRecordingFinalizedFileName",+ "freeRecorderSession",+ ]);const fileName = lastRecordingBackendRef?.fileName;- return (- lastRecordingBackendRef?.backend === "opfs" &&- Boolean(fileName) &&- lastRecordingFinalizedFileName === fileName &&- String(fileName).includes(recordingId)- );+ if (+ lastRecordingBackendRef?.backend !== "opfs" ||+ !fileName ||+ !String(fileName).includes(recordingId)+ ) {+ return false;+ }+ if (lastRecordingFinalizedFileName === fileName) return true;+ // Marker missing: trust a completed session + the on-disk file.+ const status = freeRecorderSession?.status;+ if (status !== "completed" && status !== "complete") return false;+ const dir = await navigator.storage.getDirectory();+ const handle = await dir.getFileHandle(fileName);+ const file = await handle.getFile();+ return file.size > 0;} catch {return false;}@@ -1208,14 +1238,20 @@ const ContentState = (props) => {});await reader.close().catch(() => {});if (!rawBlob) throw new Error("opfs-readblob-empty");- // use the OPFS Blob directly; arrayBuffer copy was 30-60s on slow- // disks for 100MB+ ("stuck at 90%"). materialize in the background.+ // Use the disk-backed OPFS blob directly: <video> streams it from+ // disk and mediabunny reads it lazily (~8MB cache), so the editor+ // loads at O(1) memory regardless of size.const blob = rawBlob;diagForward("sandbox-opfs-materialize-deferred", {bytes: rawBlob.size,});- // fire-and-forget; swaps in once done, video keeps original src- if (rawBlob.size <= 1_500_000_000) {+ // Only small recordings get an in-memory copy. Its only benefit is+ // surviving a later "new recording" sweep of the OPFS file; above+ // ~100MB the arrayBuffer copy itself spikes memory and janks the tab+ // (the 873MB "can't load the recording" reports), so large files+ // stay disk-backed and load instantly.+ const MATERIALIZE_MAX_BYTES = 100_000_000;+ if (rawBlob.size <= MATERIALIZE_MAX_BYTES) {const materializeStart = Date.now();(async () => {try {@@ -2855,7 +2891,11 @@ const ContentState = (props) => {};// OPFS sync access handle in an offscreen worker; bypasses BufferTarget's 2 GB cap- const remuxViaOffscreenOpfs = async (fragmentedBlob, onProgress) => {+ const remuxViaOffscreenOpfs = async (+ fragmentedBlob,+ onProgress,+ kind = "remux",+ ) => {const requestId =(typeof crypto !== "undefined" && typeof crypto.randomUUID === "function"? crypto.randomUUID()@@ -2883,7 +2923,9 @@ const ContentState = (props) => {// sendMessage's structured clone is lossy for Blobs across the SW// (BlobSource rejects with "blob must be a Blob"); transport via OPFS+filename- const outputFileName = `remux-${requestId}.mp4`;+ const outputFileName = `remux-${requestId}.${+ kind === "webm" ? "webm" : "mp4"+ }`;let opfsDir;try {opfsDir = await navigator.storage.getDirectory();@@ -2943,6 +2985,7 @@ const ContentState = (props) => {const response = await chrome.runtime.sendMessage({type: "remux-request",+ kind,requestId,inputFileName,outputFileName,@@ -2954,7 +2997,9 @@ const ContentState = (props) => {const outputHandle = await opfsDir.getFileHandle(outputFileName);const file = await outputHandle.getFile();- const outputBlob = new Blob([file], { type: "video/mp4" });+ const outputBlob = new Blob([file], {+ type: kind === "webm" ? "video/webm" : "video/mp4",+ });devLog("offscreen-remux-ok", { outputBytes: outputBlob.size });return outputBlob;} finally {@@ -2969,37 +3014,85 @@ const ContentState = (props) => {}};- const download = async () => {- // ref: rapid clicks fire before state propagates- const latest = contentStateRef.current || contentState;- // isFfmpegRunning leaks from bg poll handlers and swallows real clicks;- // downloading is the real lock- if (latest.downloading) return;+ // A remux can stall indefinitely on a huge file (offscreen worker wedged,+ // slow disk): reject if no progress lands within the window so download()+ // falls through to the next tier or the raw-fMP4 fallback instead of hanging.+ // Resets on every progress tick, so a slow-but-advancing remux is never cut.+ const REMUX_STALL_MS = 60000;+ const runRemuxWithStallGuard = (startFn, baseProgress) =>+ new Promise((resolve, reject) => {+ let timer = null;+ let settled = false;+ const arm = () => {+ if (timer) clearTimeout(timer);+ timer = setTimeout(() => {+ if (settled) return;+ settled = true;+ reject(new Error(`remux-stalled-${REMUX_STALL_MS}ms`));+ }, REMUX_STALL_MS);+ };+ const onProgress = (p) => {+ arm();+ if (typeof baseProgress === "function") baseProgress(p);+ };+ arm();+ Promise.resolve(startFn(onProgress)).then(+ (v) => {+ if (settled) return;+ settled = true;+ if (timer) clearTimeout(timer);+ resolve(v);+ },+ (e) => {+ if (settled) return;+ settled = true;+ if (timer) clearTimeout(timer);+ reject(e);+ },+ );+ });++ const standardMp4Ref = useRef(null);+ const downloadCancelledRef = useRef(false);+ // Cancel an in-progress download/conversion so the user isn't stuck waiting on+ // a slow WebM re-encode. Resets the UI immediately and best-effort aborts the+ // offscreen worker; the pending conversion's deliver step is skipped below.+ const cancelDownload = () => {+ downloadCancelledRef.current = true;+ chrome.runtime.sendMessage({ type: "cancel-remux" }).catch(() => {});setContentState((prev) => ({...prev,- downloading: true,- isFfmpegRunning: true,+ downloading: false,+ downloadingWEBM: false,+ isFfmpegRunning: false,processingProgress: 0,}));+ };- const progressHandler = (p) =>- setContentState((prev) => ({- ...prev,- processingProgress: Math.round(p * 100),- }));+ // Only surface finalize progress while a download is actually in flight, so+ // the background pre-warm doesn't flash a progress bar during editing.+ const sharedFinalizeProgress = (p) => {+ if (!contentStateRef.current?.downloading) return;+ setContentState((prev) => ({+ ...prev,+ processingProgress: Math.round(p * 100),+ }));+ };- const inputSize = contentState.blob?.size || 0;- const remuxStartedAt = Date.now();+ // Remux the fragmented recording MP4 to a standard (moov-at-end) MP4 the way+ // QuickTime/Premiere/upload widgets expect. Two tiers: offscreen OPFS+ // streaming (bounded memory, any size), then in-editor BufferTarget. Returns+ // { blob, path }; blob is null if both tiers fail (caller serves fragmented).+ const produceStandardMp4 = async (blob) => {+ const inputSize = blob?.size || 0;let remuxedBlob = null;let remuxPath = null;-- // tier 1: offscreen+OPFS, bounded memorytry {diagForward("remux-offscreen-start", { inputBytes: inputSize });- remuxedBlob = await remuxViaOffscreenOpfs(- contentState.blob,- progressHandler,+ remuxedBlob = await runRemuxWithStallGuard(+ (pg) => remuxViaOffscreenOpfs(blob, pg),+ sharedFinalizeProgress,);remuxPath = "offscreen-opfs";diagForward("remux-offscreen-ok", { inputBytes: inputSize });@@ -3010,13 +3103,15 @@ const ContentState = (props) => {err: String(err?.message || err).slice(0, 200),});}-- // tier 2: in-sandbox BufferTarget, capped at ~2 GB- if (!remuxedBlob) {+ // tier 2 is an in-editor BufferTarget remux the offscreen cancel-remux+ // can't reach, so skip it if the user already cancelled; otherwise a+ // cancel during tier 1 still kicks off a full in-editor remux. download()+ // resets the flag and re-runs this if the cache shows failed.+ if (!remuxedBlob && !downloadCancelledRef.current) {try {- remuxedBlob = await remuxFragmentedToStandardMp4(- contentState.blob,- progressHandler,+ remuxedBlob = await runRemuxWithStallGuard(+ (pg) => remuxFragmentedToStandardMp4(blob, pg),+ sharedFinalizeProgress,);remuxPath = "buffer-target";diagForward("remux-buffer-target-ok", { inputBytes: inputSize });@@ -3031,6 +3126,81 @@ const ContentState = (props) => {});}}+ return { blob: remuxedBlob, path: remuxPath };+ };++ // Cache + dedupe the standard-MP4 finalize, keyed on the exact source blob so+ // an edit (which produces a new blob) re-finalizes. Lets the result be pre-+ // warmed in the background on editor-ready and reused instantly on download.+ const ensureStandardMp4 = () => {+ const blob = contentStateRef.current?.blob;+ if (!blob || blob.type !== "video/mp4") {+ return Promise.resolve({ blob: null, path: null });+ }+ const cur = standardMp4Ref.current;+ if (+ cur &&+ cur.forBlob === blob &&+ (cur.status === "ready" || cur.status === "pending")+ ) {+ return cur.promise;+ }+ const promise = produceStandardMp4(blob).then((res) => {+ standardMp4Ref.current = {+ status: res.blob ? "ready" : "failed",+ promise,+ forBlob: blob,+ blob: res.blob,+ path: res.path,+ };+ return res;+ });+ standardMp4Ref.current = { status: "pending", promise, forBlob: blob };+ return promise;+ };++ // Pre-warm the standard MP4 in the background once the editor is ready so the+ // download is an instant file-save. Failures are cached; download() falls+ // back to the fragmented file. Skipped when the flag is off.+ useEffect(() => {+ if (!ENABLE_EAGER_MP4_FINALIZE) return;+ if (!contentState.ready) return;+ if (contentState.blob?.type !== "video/mp4") return;+ if (standardMp4Ref.current?.forBlob === contentState.blob) return;+ ensureStandardMp4().catch(() => {});+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [contentState.ready, contentState.blob]);++ const download = async () => {+ // ref: rapid clicks fire before state propagates+ const latest = contentStateRef.current || contentState;+ // isFfmpegRunning leaks from bg poll handlers and swallows real clicks;+ // downloading is the real lock+ if (latest.downloading) return;+ downloadCancelledRef.current = false;++ setContentState((prev) => ({+ ...prev,+ downloading: true,+ isFfmpegRunning: true,+ processingProgress: 0,+ }));++ const inputSize = contentState.blob?.size || 0;+ const remuxStartedAt = Date.now();+ let remuxedBlob = null;+ let remuxPath = null;++ // Reuse the background pre-warm if it finished (instant) or is in flight+ // (await it); otherwise this runs the finalize now. Keyed on the blob, so+ // an edited recording re-finalizes before download.+ try {+ const res = await ensureStandardMp4();+ remuxedBlob = res.blob;+ remuxPath = res.path;+ } catch (err) {+ console.warn("[Screenity] standard mp4 finalize failed", err);+ }const remuxDurationMs = Date.now() - remuxStartedAt;const finalPath = remuxPath || "fmp4-fallback";@@ -3053,6 +3223,7 @@ const ContentState = (props) => {},}));+ if (downloadCancelledRef.current) return;try {if (remuxedBlob) {const url = URL.createObjectURL(remuxedBlob);@@ -3090,6 +3261,7 @@ const ContentState = (props) => {const downloadWEBM = async () => {if (contentState.downloadingWEBM) return;+ downloadCancelledRef.current = false;const sourceBlob = contentState.blob || contentState.webm;@@ -3126,6 +3298,29 @@ const ContentState = (props) => {return;}+ // MP4 -> WebM here is a software VP9 re-encode (no hardware encoder on most+ // setups), so it can take minutes on a long recording. Warn first and offer+ // the instant MP4 instead.+ const webmChoice = await new Promise((resolve) => {+ const open = contentStateRef.current?.openModal;+ if (typeof open !== "function") {+ resolve("webm");+ return;+ }+ open(+ chrome.i18n.getMessage("webmSlowTitle"),+ chrome.i18n.getMessage("webmSlowDescription"),+ chrome.i18n.getMessage("webmSlowMp4"),+ chrome.i18n.getMessage("webmSlowContinue"),+ () => resolve("mp4"),+ () => resolve("webm"),+ );+ });+ if (webmChoice === "mp4") {+ download();+ return;+ }+setContentState((prevState) => ({...prevState,downloadingWEBM: true,@@ -3133,20 +3328,106 @@ const ContentState = (props) => {processingProgress: 0,}));+ // Offscreen re-encode (OPFS-streamed, bounded memory) so large MP4s don't+ // OOM the in-editor BufferTarget path. On any failure (incl. a 60s no-+ // progress stall) we deliver the source so the user is never stuck.+ if (ENABLE_OFFSCREEN_WEBM) {+ let webmBlob = null;+ try {+ webmBlob = await runRemuxWithStallGuard(+ (pg) => remuxViaOffscreenOpfs(sourceBlob, pg, "webm"),+ (p) =>+ setContentState((prev) => ({+ ...prev,+ processingProgress: Math.round(p * 100),+ })),+ );+ } catch (err) {+ console.warn(+ "[Screenity] offscreen webm convert failed, falling back",+ err,+ );+ }+ if (downloadCancelledRef.current) return;+ const blobToSave = webmBlob || sourceBlob;+ const ext = blobToSave.type === "video/webm" ? ".webm" : ".mp4";+ try {+ const url = URL.createObjectURL(blobToSave);+ await requestDownload(url, ext);+ URL.revokeObjectURL(url);+ } catch (err) {+ console.error("[Screenity] webm download failed", err);+ }+ setContentState((prevState) => ({+ ...prevState,+ downloadingWEBM: false,+ isFfmpegRunning: false,+ saved: true,+ }));+ return;+ }+sendMessage({type: "to-webm",blob: sourceBlob,duration: contentState.duration,});- await waitForUpdatedBlob();+ // The transcode delivers the file via the "download-webm" message handler+ // and progress via "ffmpeg-progress". Guard against a stalled or failed+ // transcode (large MP4s can exhaust ffmpeg): if no progress or completion+ // lands within the window, deliver the source as-is so the user isn't stuck+ // on an endless "processing". Resets on every progress tick.+ const WEBM_STALL_MS = 60000;+ const completed = await new Promise((resolve) => {+ let timer = null;+ const cleanup = () => {+ if (timer) clearTimeout(timer);+ window.removeEventListener("message", handler);+ };+ const arm = () => {+ if (timer) clearTimeout(timer);+ timer = setTimeout(() => {+ cleanup();+ resolve(false);+ }, WEBM_STALL_MS);+ };+ function handler(event) {+ const t = event.data?.type;+ if (t === "ffmpeg-progress") {+ arm();+ } else if (t === "download-webm") {+ cleanup();+ resolve(true);+ } else if (t === "ffmpeg-error") {+ cleanup();+ resolve(false);+ }+ }+ window.addEventListener("message", handler);+ arm();+ });- setContentState((prevState) => ({- ...prevState,- downloadingWEBM: false,- isFfmpegRunning: false,- saved: true,- }));+ if (!completed) {+ // Stalled or failed: deliver the source as-is so the user isn't stuck.+ // It's already a finalized, playable file; use its real extension.+ const ext = sourceBlob.type === "video/webm" ? ".webm" : ".mp4";+ try {+ const url = URL.createObjectURL(sourceBlob);+ await requestDownload(url, ext);+ URL.revokeObjectURL(url);+ } catch (err) {+ console.error("[Screenity] webm fallback download failed", err);+ }+ setContentState((prevState) => ({+ ...prevState,+ downloadingWEBM: false,+ isFfmpegRunning: false,+ saved: true,+ }));+ }+ // On success the "download-webm" handler delivered the file and cleared the+ // downloading flags, so there is nothing more to do here.};const downloadGIF = async () => {@@ -3201,6 +3482,7 @@ const ContentState = (props) => {contentState.handleTrim = handleTrim;contentState.handleMute = handleMute;contentState.download = download;+ contentState.cancelDownload = cancelDownload;contentState.handleCrop = handleCrop;contentState.handleReencode = handleReencode;contentState.getFrame = getImage;diff --git a/src/pages/EditorApp/layout/player/RightPanel.js b/src/pages/EditorApp/layout/player/RightPanel.jsindex 0acd252..4b7693a 100644--- a/src/pages/EditorApp/layout/player/RightPanel.js+++ b/src/pages/EditorApp/layout/player/RightPanel.js@@ -531,7 +531,34 @@ const RightPanel = () => {</div></div>)}+ {(contentState.downloadingWEBM || contentState.downloading) && (+ <div className={styles.alert}>+ <div className={styles.buttonLeft}>+ <ReactSVG src={URL + "editor/icons/alert.svg"} />+ </div>+ <div className={styles.buttonMiddle}>+ <div className={styles.buttonTitle}>+ {chrome.i18n.getMessage("downloadProcessingTitle")}+ </div>+ <div className={styles.buttonDescription}>+ {contentState.processingProgress > 0+ ? `${chrome.i18n.getMessage(+ "downloadProcessingDescription",+ )} (${contentState.processingProgress}%)`+ : chrome.i18n.getMessage("downloadProcessingDescription")}+ </div>+ </div>+ <div+ className={styles.buttonRight}+ onClick={() => contentState.cancelDownload?.()}+ >+ {chrome.i18n.getMessage("cancelLabel")}+ </div>+ </div>+ )}{(!contentState.mp4ready || contentState.isFfmpegRunning) &&+ !contentState.downloadingWEBM &&+ !contentState.downloading &&(contentState.duration <= contentState.editLimit ||contentState.override) &&!contentState.offline &&diff --git a/src/pages/Recorder/Recorder.jsx b/src/pages/Recorder/Recorder.jsxindex 457d372..1aa8875 100644--- a/src/pages/Recorder/Recorder.jsx+++ b/src/pages/Recorder/Recorder.jsx@@ -993,6 +993,12 @@ const Recorder = () => {// only; storage cache keeps subsequent recordings instant.}, []);+ // Preserve-and-recover instead of discarding when the abandonment watchdog+ // fires on a recording that actually captured content (a slow stop under+ // contention, not a true teardown). Flag-gated since it's on the recorder+ // critical path.+ const ENABLE_ABANDON_FINALIZE = true;+// Grace before acting on a recording=false flag flip: a normal stop// flips storage a beat before its stop-recording-tab message reaches// this tab, so wait that window out before declaring abandonment.@@ -1005,6 +1011,29 @@ const Recorder = () => {const abortAbandonedRecording = (detail) => {if (abandonHandled.current) return;abandonHandled.current = true;++ // If real content was captured, the stop signal just didn't reach us in+ // time (slow stop under contention) rather than a genuine teardown. Finalize+ // through the normal stop path so the file is closed, recoverable, and the+ // editor can open, instead of silently discarding the recording.+ if (+ ENABLE_ABANDON_FINALIZE &&+ (savedCount.current > 0 || hasChunks.current)+ ) {+ lifecycle("Recorder", "abandoned-finalize", {+ ...detail,+ savedCount: savedCount.current,+ recorderType: useWebCodecs.current ? "webcodecs" : "mediarecorder",+ });+ try {+ slLog("abandoned-finalize", detail);+ } catch {}+ stopRecording().catch((err) => {+ debugError("abandoned-finalize: stopRecording failed", err);+ });+ return;+ }+localStopInitiated.current = true;isRecording.current = false;// Invalidate the run so any late ondataavailable is dropped.@@ -4068,6 +4097,13 @@ const Recorder = () => {});}, []);+ // A fresh start under SW instability can hit a transient mint failure: the+ // SW restart racing the call, or the just-closed previous recording's+ // tab-capture binding not released yet ("active stream"). The mint was+ // single-shot, so one transient miss surfaced as REC_START_FAILED. Retry a+ // few times with backoff; a permanent failure (no API) breaks out at once.+ const ENABLE_TAB_STREAM_MINT_RETRY = true;+const getStreamID = async (id) => {perfMark("Recorder getStreamID.enter", { tabId: id });debug("getStreamID()", id);@@ -4075,60 +4111,79 @@ const Recorder = () => {// Track mint latency (lastTabStreamMintMs) so a tabStreamUnavailableError// report shows whether the mint was slow or genuinely hung.const mintStartedAt = Date.now();- let streamId;- try {- if (IS_OFFSCREEN_HOST) {- // chrome.tabCapture isn't callable from offscreen; delegate to SW.- const endOff = perfSpan("Recorder offscreen-request-stream(tab)");- const response = await chrome.runtime- .sendMessage({- type: "offscreen-request-stream",- mode: "tab",+ const maxAttempts = ENABLE_TAB_STREAM_MINT_RETRY ? 3 : 1;+ const backoffMs = [0, 400, 900];+ // Hold the error locally until we give up: waitForTabStreamId bails the+ // moment tabIDError is set, so a per-attempt write would abort the retry.+ let lastErr = null;+ for (let attempt = 0; attempt < maxAttempts; attempt++) {+ if (backoffMs[attempt] > 0) {+ await new Promise((r) => setTimeout(r, backoffMs[attempt]));+ }+ let streamId;+ let permanent = false;+ try {+ if (IS_OFFSCREEN_HOST) {+ // chrome.tabCapture isn't callable from offscreen; delegate to SW.+ const endOff = perfSpan("Recorder offscreen-request-stream(tab)");+ const response = await chrome.runtime+ .sendMessage({+ type: "offscreen-request-stream",+ mode: "tab",+ targetTabId: id,+ })+ .catch((err) => ({ ok: false, error: String(err) }));+ endOff({ ok: Boolean(response?.ok) });+ if (!response?.ok || !response.streamId) {+ debug("Offscreen tab stream acquisition failed", response);+ lastErr = response?.error || "offscreen-tab-stream-empty-response";+ } else {+ streamId = response.streamId;+ }+ } else if (!chrome?.tabCapture?.getMediaStreamId) {+ lastErr = "chrome.tabCapture.getMediaStreamId unavailable";+ permanent = true;+ } else {+ const endTc = perfSpan("Recorder tabCapture.getMediaStreamId");+ streamId = await chrome.tabCapture.getMediaStreamId({targetTabId: id,- })- .catch((err) => ({ ok: false, error: String(err) }));- endOff({ ok: Boolean(response?.ok) });- if (!response?.ok || !response.streamId) {- debug("Offscreen tab stream acquisition failed", response);- tabIDError.current =- response?.error || "offscreen-tab-stream-empty-response";- return;- }- streamId = response.streamId;- } else {- if (!chrome?.tabCapture?.getMediaStreamId) {- tabIDError.current = "chrome.tabCapture.getMediaStreamId unavailable";- return;+ });+ endTc({ hasStreamId: Boolean(streamId) });+ if (!streamId) {+ lastErr = "tabCapture.getMediaStreamId returned empty";+ }}- const endTc = perfSpan("Recorder tabCapture.getMediaStreamId");- streamId = await chrome.tabCapture.getMediaStreamId({- targetTabId: id,- });- endTc({ hasStreamId: Boolean(streamId) });- if (!streamId) {- tabIDError.current = "tabCapture.getMediaStreamId returned empty";- return;+ if (streamId) {+ debug("Resolved tabCapture streamId", streamId);+ tabID.current = streamId;+ break;}+ } catch (err) {+ lastErr = String(err?.message || err);+ debugWarn("getStreamID failed", lastErr);}- debug("Resolved tabCapture streamId", streamId);- tabID.current = streamId;- } catch (err) {- const errStr = String(err?.message || err);- debugWarn("getStreamID failed", errStr);- tabIDError.current = errStr;- } finally {- perfMark("Recorder getStreamID.done", {- ok: Boolean(tabID.current),- error: tabIDError.current,- });- try {- chrome.storage.local.set({- lastTabStreamMintMs: Date.now() - mintStartedAt,- lastTabStreamMintOk: Boolean(tabID.current),- lastTabStreamMintOffscreen: IS_OFFSCREEN_HOST,+ if (permanent) break;+ if (attempt + 1 < maxAttempts) {+ slLog("tab-stream-mint-retry", {+ attempt,+ err: String(lastErr || "").slice(0, 120),});- } catch {}+ }}+ if (!tabID.current) {+ tabIDError.current = lastErr || "tab-stream-mint-failed";+ }+ perfMark("Recorder getStreamID.done", {+ ok: Boolean(tabID.current),+ error: tabIDError.current,+ });+ try {+ chrome.storage.local.set({+ lastTabStreamMintMs: Date.now() - mintStartedAt,+ lastTabStreamMintOk: Boolean(tabID.current),+ lastTabStreamMintOffscreen: IS_OFFSCREEN_HOST,+ });+ } catch {}};// chromeMediaSource constraints have no "no padding" knob: any combodiff --git a/src/pages/RemuxOffscreen/index.js b/src/pages/RemuxOffscreen/index.jsindex 873943a..69e7a22 100644--- a/src/pages/RemuxOffscreen/index.js+++ b/src/pages/RemuxOffscreen/index.js@@ -77,23 +77,48 @@ const ensureWorker = () => {return worker;};+chrome.runtime.onMessage.addListener((message) => {+ if (!message || message.type !== "cancel-remux") return undefined;+ // Editor cancelled the download: kill the worker so it stops encoding.+ if (worker) {+ try {+ worker.terminate();+ } catch {+ // already gone+ }+ worker = null;+ }+ for (const [, entry] of pending) {+ entry?.sendResponse?.({ ok: false, error: "cancelled" });+ }+ pending.clear();+ return false;+});+chrome.runtime.onMessage.addListener((message, _sender, sendResponse) => {- if (!message || message.type !== "remux-start") return undefined;+ if (+ !message ||+ (message.type !== "remux-start" && message.type !== "webm-start")+ ) {+ return undefined;+ }const { requestId, inputFileName, outputFileName } = message;if (!requestId || !inputFileName || !outputFileName) {sendResponse({ ok: false, error: "invalid-remux-start-payload" });return false;}+ const workerType = message.type === "webm-start" ? "webm" : "remux";try {const w = ensureWorker();devLog("remux-start-received", {requestId,inputFileName,outputFileName,+ kind: workerType,});pending.set(requestId, { sendResponse });w.postMessage({- type: "remux",+ type: workerType,requestId,inputFileName,outputFileName,diff --git a/src/pages/RemuxOffscreen/worker.js b/src/pages/RemuxOffscreen/worker.jsindex 9ab8733..a5cf139 100644--- a/src/pages/RemuxOffscreen/worker.js+++ b/src/pages/RemuxOffscreen/worker.js@@ -16,6 +16,7 @@ import {EncodedAudioPacketSource,} from "mediabunny";import { createOpfsWritable } from "./opfsTarget";+import { videoConverter } from "../Editor/mediabunny/lib/videoConverter";const TEMP_FILE_PREFIX = "remux-";const STALE_AGE_MS = 5 * 60 * 1000;@@ -247,8 +248,86 @@ const remuxToOpfs = async ({ requestId, inputFileName, outputFileName }) => {}};+// Re-encodes an MP4 (H.264) to WebM (VP9) from OPFS to OPFS, streaming output+// so memory stays bounded on large files (the in-editor BufferTarget path OOMs+// past ~2 GB). Far slower than the remux (it fully decodes and re-encodes+// every frame), but it can't passthrough since WebM can't hold H.264.+const convertWebmToOpfs = async ({ requestId, inputFileName, outputFileName }) => {+ const startedAt = Date.now();+ devLog("webm-start", { requestId, inputFileName, outputFileName });+ await sweepOpfsStaleFiles();++ let dir;+ let outputHandle;+ let syncHandle;+ let handleReleased = false;++ try {+ dir = await navigator.storage.getDirectory();+ const inputHandle = await dir.getFileHandle(inputFileName);+ const inputFile = await inputHandle.getFile();++ outputHandle = await dir.getFileHandle(outputFileName, { create: true });+ syncHandle = await (async () => {+ const delaysMs = [0, 200, 400, 600, 800];+ let lastErr = null;+ for (let i = 0; i < delaysMs.length; i += 1) {+ if (delaysMs[i] > 0) {+ await new Promise((r) => setTimeout(r, delaysMs[i]));+ }+ try {+ return await outputHandle.createSyncAccessHandle();+ } catch (err) {+ lastErr = err;+ if (err?.name !== "NoModificationAllowedError") break;+ }+ }+ throw lastErr;+ })();+ syncHandle.truncate(0);++ const writable = createOpfsWritable(syncHandle);++ await videoConverter.convertToWebM(inputFile, {+ target: new StreamTarget(writable),+ onProgress: (p) => postProgress(requestId, p),+ });++ try {+ await writable.close();+ } catch {}+ syncHandle.flush();+ const finalSize = syncHandle.getSize();+ syncHandle.close();+ handleReleased = true;++ devLog("webm-done", {+ durationMs: Date.now() - startedAt,+ outputBytes: finalSize,+ });+ postDone(requestId, outputFileName);+ } catch (err) {+ devLog("webm-error", {+ err: String(err?.message || err).slice(0, 200),+ durationMs: Date.now() - startedAt,+ });+ postError(requestId, err);+ if (syncHandle && !handleReleased) {+ try {+ syncHandle.close();+ } catch {}+ }+ if (dir && outputFileName) {+ try {+ await dir.removeEntry(outputFileName).catch(() => {});+ } catch {}+ }+ }+};+self.onmessage = (e) => {const msg = e.data;- if (!msg || msg.type !== "remux") return;- remuxToOpfs(msg);+ if (!msg) return;+ if (msg.type === "remux") remuxToOpfs(msg);+ else if (msg.type === "webm") convertWebmToOpfs(msg);};