Skip to content

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

Teleprompter with floating controls, better quality options, microphone toggle shortcut

Alyssa Xc5b344fbb3d9
diff --git a/package-lock.json b/package-lock.json
index b479ea1..ce15cb9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "screenity",
- "version": "4.6.12",
+ "version": "4.7.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "screenity",
- "version": "4.6.12",
+ "version": "4.7.0",
"hasInstallScript": true,
"dependencies": {
"@babel/plugin-transform-react-jsx": "^7.27.1",
@@ -2159,9 +2159,9 @@
}
},
"node_modules/@mediabunny/aac-encoder": {
- "version": "1.60.0",
- "resolved": "https://registry.npmjs.org/@mediabunny/aac-encoder/-/aac-encoder-1.60.0.tgz",
- "integrity": "sha512-wevrs3VuwOKMmXkEn01KIwapKAe5QoGazWyND1B9pYUz+GC+wxfVcyv9kUfrpXDfy/xPhM7pOePCHSC9aw0k5A==",
+ "version": "1.61.5",
+ "resolved": "https://registry.npmjs.org/@mediabunny/aac-encoder/-/aac-encoder-1.61.5.tgz",
+ "integrity": "sha512-PC1ZQJMX8FQlw7XjdyacVmTRCZ8DA6x8VyJXakmOQuWsddawfK+KBRhpSYD5ezqe1NdqfdmeLUwDsarjzsTSUA==",
"license": "MPL-2.0",
"funding": {
"type": "individual",
@@ -9007,9 +9007,9 @@
}
},
"node_modules/mediabunny": {
- "version": "1.60.0",
- "resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.60.0.tgz",
- "integrity": "sha512-CRQ/2D+qUF9w2IyjbjTxxSLEG+PeWeD4whb43UpUBpeNomWb/ffn+ngKgqJSPZ+bmO66MX2yBJQITZ6ijfRjug==",
+ "version": "1.61.5",
+ "resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.61.5.tgz",
+ "integrity": "sha512-IYrDTozxGVRTWQ1YdIcF+P7S7qHvvkiQYsX3WUbAHkxgAcCfEn7a/RbM9i/WiJHJ1MSYZqSxZkna1UUn4FGGBQ==",
"license": "MPL-2.0",
"workspaces": [
".",
diff --git a/package.json b/package.json
index f838d31..19e7ee4 100755
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "screenity",
- "version": "4.6.12",
+ "version": "4.7.0",
"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.json
index 7a924b2..c1a723b 100644
--- a/src/_locales/ca/messages.json
+++ b/src/_locales/ca/messages.json
@@ -1085,13 +1085,29 @@
"message": "Assegureu-vos d'activar l'opció 'Comparteix l'audio del sistema' si voleu enregistrar l'audio de l'ordinador. Si no veieu aquesta opció, proveu d'actualitzar Chrome o canviar a l'opció d'enregistrament de pestanyes.",
"description": "Descripció d'avís d'àudio per a altres sistemes"
},
- "maxResolutionLabel": {
- "message": "Resolució màxima",
- "description": "Etiqueta de resolució màxima al menú de configuració"
+ "qualityLabel": {
+ "message": "Qualitat",
+ "description": "Etiqueta de qualitat al menú de configuració"
},
- "maxFPSLabel": {
- "message": "FPS màxims",
- "description": "Etiqueta de FPS màxims al menú de configuració"
+ "qualityAutoLabel": {
+ "message": "Automàtic",
+ "description": "Opció de qualitat automàtica al menú de configuració"
+ },
+ "qualityCustomLabel": {
+ "message": "Personalitzat",
+ "description": "Es mostra quan la resolució o la freqüència de fotogrames s'han triat manualment"
+ },
+ "smootherMotionLabel": {
+ "message": "Prioritza el moviment més fluid",
+ "description": "Interruptor de la configuració de qualitat que afavoreix un vídeo més fluid davant la nitidesa"
+ },
+ "resolutionGroupLabel": {
+ "message": "Resolució",
+ "description": "Encapçalament sobre les opcions de resolució"
+ },
+ "frameRateGroupLabel": {
+ "message": "Freqüència de fotogrames",
+ "description": "Encapçalament sobre les opcions de freqüència de fotogrames"
},
"notEnoughRAM": {
"message": "No hi ha prou RAM",
@@ -1904,5 +1920,141 @@
"unsavedRecordingModalDismiss": {
"message": "No ho tornis a mostrar",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "Teleprompter",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "Teleprompter (no disponible en aquesta pàgina)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "Com funciona el teleprompter",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "El teu guió s'obre en una finestra flotant que queda fora de la gravació quan comparteixes una finestra o una pestanya, graves una àrea o graves només la càmera. Si comparteixes tota la pantalla, la finestra sortiria al vídeo, així que es tanca quan comences. El guió es desa sempre.",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "S'ha tancat el teleprompter perquè no surti a la gravació",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "Escriu o enganxa el teu guió",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "Inicia el desplaçament",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "Pausa el desplaçament",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "Més opcions del guió",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "Mida del text",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "Velocitat",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "Text més petit",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "Text més gran",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "Més lent",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "Més ràpid",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "ppm",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "Desplaça en començar a gravar",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "Torna a l'inici",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "Amaga el guió",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "Es desplaça automàticament quan comences a gravar",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "El teleprompter es tancarà",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "Estàs gravant tota la pantalla, així que la finestra del teleprompter apareixeria al vídeo. La tancarem perquè no surti a la gravació. Pots mantenir-la oberta, però es gravarà.",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "D'acord, tanca-la",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "Mantén-la visible",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "No ho tornis a mostrar",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "La finestra de la càmera es tancarà",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "Estàs gravant tota la pantalla, així que la finestra de la càmera apareixeria al vídeo. La tancarem perquè no surti a la gravació. La càmera continua gravant-se.",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "Esborra el guió",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "Torna a fer clic per esborrar",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "Mou la càmera a la pàgina",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "Mou la càmera aquí",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "Mostra el guió",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "Fes clic a \"Inicia la gravació\" a la pàgina aquesta primera vegada perquè Chrome pugui demanar accés a la captura de pantalla.",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "L'enregistrament d'una regió s'ha d'iniciar des de la pàgina",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/_locales/de/messages.json b/src/_locales/de/messages.json
index 6c79592..6e2e012 100644
--- a/src/_locales/de/messages.json
+++ b/src/_locales/de/messages.json
@@ -1085,13 +1085,29 @@
"message": "Stellen Sie sicher, dass Sie die Option 'System-Audio teilen' aktivieren, wenn Sie Computer-Audio aufzeichnen möchten. Wenn Sie diese Option nicht sehen, versuchen Sie, Chrome zu aktualisieren oder zur Tab-Aufzeichnung zu wechseln.",
"description": "Beschreibung der Audio-Warnung für andere Systeme"
},
- "maxResolutionLabel": {
- "message": "Maximale Auflösung",
- "description": "Beschriftung für maximale Auflösung im Einstellungsmenü"
+ "qualityLabel": {
+ "message": "Qualität",
+ "description": "Beschriftung für Qualität im Einstellungsmenü"
},
- "maxFPSLabel": {
- "message": "Maximale FPS",
- "description": "Beschriftung für maximale FPS im Einstellungsmenü"
+ "qualityAutoLabel": {
+ "message": "Automatisch",
+ "description": "Option für automatische Qualität im Einstellungsmenü"
+ },
+ "qualityCustomLabel": {
+ "message": "Benutzerdefiniert",
+ "description": "Wird angezeigt, wenn Auflösung oder Bildrate manuell gewählt wurden"
+ },
+ "smootherMotionLabel": {
+ "message": "Flüssigere Bewegung bevorzugen",
+ "description": "Schalter in den Qualitätseinstellungen, der flüssigeres Video gegenüber Schärfe bevorzugt"
+ },
+ "resolutionGroupLabel": {
+ "message": "Auflösung",
+ "description": "Überschrift über den Auflösungsoptionen"
+ },
+ "frameRateGroupLabel": {
+ "message": "Bildrate",
+ "description": "Überschrift über den Bildratenoptionen"
},
"notEnoughRAM": {
"message": "Nicht genügend RAM",
@@ -1904,5 +1920,141 @@
"unsavedRecordingModalDismiss": {
"message": "Nicht mehr anzeigen",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "Teleprompter",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "Teleprompter (auf dieser Seite nicht verfügbar)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "So funktioniert der Teleprompter",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "Ihr Skript öffnet sich in einem schwebenden Fenster, das nicht in der Aufnahme erscheint, wenn Sie ein Fenster oder einen Tab teilen, einen Bereich aufnehmen oder nur Ihre Kamera. Teilen Sie Ihren gesamten Bildschirm, würde das Fenster im Video zu sehen sein, deshalb wird es beim Start geschlossen. Ihr Skript wird immer gespeichert.",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "Teleprompter geschlossen, damit er nicht in der Aufnahme erscheint",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "Skript schreiben oder einfügen",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "Scrollen starten",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "Scrollen pausieren",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "Weitere Skriptoptionen",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "Textgröße",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "Tempo",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "Kleinerer Text",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "Größerer Text",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "Langsamer",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "Schneller",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "WPM",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "Beim Aufnahmestart scrollen",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "Zurück zum Anfang scrollen",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "Skript ausblenden",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "Scrollt automatisch, sobald die Aufnahme startet",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "Der Teleprompter wird geschlossen",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "Sie nehmen Ihren gesamten Bildschirm auf, daher wäre das Teleprompter-Fenster im Video zu sehen. Wir schließen es, damit es nicht aufgenommen wird. Sie können es geöffnet lassen, dann wird es aber mit aufgenommen.",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "OK, schließen",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "Sichtbar lassen",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "Nicht mehr anzeigen",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "Das Kamerafenster wird geschlossen",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "Sie nehmen Ihren gesamten Bildschirm auf, daher würde das Kamerafenster im Video erscheinen. Wir schließen es, damit es nicht in der Aufnahme zu sehen ist. Ihre Kamera wird weiterhin aufgenommen.",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "Skript löschen",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "Zum Löschen erneut klicken",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "Kamera auf die Seite verschieben",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "Kamera hierher verschieben",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "Skript anzeigen",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "Klicken Sie dieses eine Mal auf der Seite auf „Aufnahme starten“, damit Chrome den Zugriff auf die Bildschirmaufnahme anfragen kann.",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "Die Aufnahme eines Bereichs muss auf der Seite gestartet werden",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json
index 4c772ab..28da360 100644
--- a/src/_locales/en/messages.json
+++ b/src/_locales/en/messages.json
@@ -1133,13 +1133,29 @@
"message": "Make sure to enable the option to 'Share system audio' if you want to record computer audio. If you don't see this option, try updating Chrome, or switch to Tab recording.",
"description": "Other audio warning description"
},
- "maxResolutionLabel": {
- "message": "Max resolution",
- "description": "Max resolution label in settings menu"
+ "qualityLabel": {
+ "message": "Quality",
+ "description": "Quality label in settings menu"
},
- "maxFPSLabel": {
- "message": "Max FPS",
- "description": "Max FPS label in settings menu"
+ "qualityAutoLabel": {
+ "message": "Auto",
+ "description": "Auto quality option in settings menu"
+ },
+ "qualityCustomLabel": {
+ "message": "Custom",
+ "description": "Shown when resolution or frame rate was picked by hand"
+ },
+ "smootherMotionLabel": {
+ "message": "Prioritize smoother motion",
+ "description": "Switch in quality settings that favors smoother video over sharpness"
+ },
+ "resolutionGroupLabel": {
+ "message": "Resolution",
+ "description": "Heading above the resolution options"
+ },
+ "frameRateGroupLabel": {
+ "message": "Frame rate",
+ "description": "Heading above the frame rate options"
},
"notEnoughRAM": {
"message": "Not enough RAM",
@@ -1922,5 +1938,141 @@
"unsavedRecordingModalDismiss": {
"message": "Don't show again",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "Teleprompter",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "Teleprompter (not available on this page)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "How the teleprompter works",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "Your script opens in a floating window that stays out of the recording when you share a window or tab, record an area, or record just your camera. If you share your entire screen, the window would show in the video, so it closes when you start. Your script is always saved.",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "Teleprompter closed to keep it out of your recording",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "Write or paste your script",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "Start scrolling",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "Pause scrolling",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "More script options",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "Text size",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "Speed",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "Smaller text",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "Larger text",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "Slower",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "Faster",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "wpm",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "Scroll when recording starts",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "Scroll back to the top",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "Hide script",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "Scrolls automatically once you start recording",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "Teleprompter will be closed",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "You're recording your entire screen, so the teleprompter window would appear in the video. We'll close it to keep it out of the recording. You can keep it open, but it will be recorded.",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "OK, close it",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "Keep it visible",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "Don't show again",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "Camera window will close",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "You're recording your entire screen, so the camera window would appear in the video. We'll close it to keep it out of the recording. Your camera is still recorded.",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "Clear script",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "Click again to clear",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "Move camera to the page",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "Move camera here",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "Show script",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "Click Start recording on the page once, so Chrome can ask for screen access.",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "Region recording must be started from the page",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/_locales/es/messages.json b/src/_locales/es/messages.json
index 80ecb80..4b42284 100644
--- a/src/_locales/es/messages.json
+++ b/src/_locales/es/messages.json
@@ -1085,13 +1085,29 @@
"message": "Asegúrate de activar la opción 'Compartir audio del sistema' si deseas grabar audio de la computadora. Si no ves esta opción, intenta actualizar Chrome o cambia a la opción de grabación de pestañas.",
"description": "Descripción de advertencia de audio para otros sistemas"
},
- "maxResolutionLabel": {
- "message": "Resolución máxima",
- "description": "Etiqueta de resolución máxima en el menú de configuración"
+ "qualityLabel": {
+ "message": "Calidad",
+ "description": "Etiqueta de calidad en el menú de configuración"
},
- "maxFPSLabel": {
- "message": "FPS máximos",
- "description": "Etiqueta de FPS máximos en el menú de configuración"
+ "qualityAutoLabel": {
+ "message": "Automático",
+ "description": "Opción de calidad automática en el menú de configuración"
+ },
+ "qualityCustomLabel": {
+ "message": "Personalizado",
+ "description": "Se muestra cuando la resolución o la velocidad de fotogramas se eligieron manualmente"
+ },
+ "smootherMotionLabel": {
+ "message": "Priorizar un movimiento más fluido",
+ "description": "Interruptor en los ajustes de calidad que prefiere un vídeo más fluido a la nitidez"
+ },
+ "resolutionGroupLabel": {
+ "message": "Resolución",
+ "description": "Encabezado sobre las opciones de resolución"
+ },
+ "frameRateGroupLabel": {
+ "message": "Velocidad de fotogramas",
+ "description": "Encabezado sobre las opciones de velocidad de fotogramas"
},
"notEnoughRAM": {
"message": "No hay suficiente RAM",
@@ -1904,5 +1920,141 @@
"unsavedRecordingModalDismiss": {
"message": "No volver a mostrar",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "Teleprompter",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "Teleprompter (no disponible en esta página)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "Cómo funciona el teleprompter",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "Tu guion se abre en una ventana flotante que queda fuera de la grabación cuando compartes una ventana o una pestaña, grabas un área o grabas solo la cámara. Si compartes toda la pantalla, la ventana saldría en el vídeo, así que se cierra al empezar. Tu guion siempre se guarda.",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "Teleprompter cerrado para que no salga en tu grabación",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "Escribe o pega tu guion",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "Iniciar desplazamiento",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "Pausar desplazamiento",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "Más opciones del guion",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "Tamaño del texto",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "Velocidad",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "Texto más pequeño",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "Texto más grande",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "Más lento",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "Más rápido",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "ppm",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "Desplazar al empezar la grabación",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "Volver al principio",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "Ocultar guion",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "Se desplaza automáticamente al empezar a grabar",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "Se cerrará el teleprompter",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "Estás grabando toda la pantalla, así que la ventana del teleprompter aparecería en el vídeo. La cerraremos para que no salga en la grabación. Puedes mantenerla abierta, pero se grabará.",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "De acuerdo, cerrar",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "Mantener visible",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "No volver a mostrar",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "La ventana de la cámara se cerrará",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "Estás grabando toda la pantalla, así que la ventana de la cámara aparecería en el vídeo. La cerraremos para que no salga en la grabación. Tu cámara se sigue grabando.",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "Borrar guion",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "Haz clic de nuevo para borrar",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "Mover la cámara a la página",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "Mover la cámara aquí",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "Mostrar guion",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "Haz clic en \"Iniciar grabación\" en la página esta primera vez para que Chrome pueda pedir acceso a la captura de pantalla.",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "La grabación de una región debe iniciarse desde la página",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/_locales/fr/messages.json b/src/_locales/fr/messages.json
index 931ac19..931d173 100644
--- a/src/_locales/fr/messages.json
+++ b/src/_locales/fr/messages.json
@@ -1085,13 +1085,29 @@
"message": "Assurez-vous d'activer l'option 'Partager l'audio du système' si vous souhaitez enregistrer l'audio de l'ordinateur. Si vous ne voyez pas cette option, essayez de mettre à jour Chrome ou basculez vers l'enregistrement de l'onglet.",
"description": "Description de l'avertissement audio pour d'autres systèmes"
},
- "maxResolutionLabel": {
- "message": "Résolution maximale",
- "description": "Étiquette de résolution maximale dans le menu des paramètres"
+ "qualityLabel": {
+ "message": "Qualité",
+ "description": "Étiquette de qualité dans le menu des paramètres"
},
- "maxFPSLabel": {
- "message": "FPS maximum",
- "description": "Étiquette de FPS maximum dans le menu des paramètres"
+ "qualityAutoLabel": {
+ "message": "Automatique",
+ "description": "Option de qualité automatique dans le menu des paramètres"
+ },
+ "qualityCustomLabel": {
+ "message": "Personnalisé",
+ "description": "Affiché lorsque la résolution ou la fréquence d'images a été choisie manuellement"
+ },
+ "smootherMotionLabel": {
+ "message": "Privilégier la fluidité",
+ "description": "Interrupteur des paramètres de qualité qui favorise une vidéo plus fluide au détriment de la netteté"
+ },
+ "resolutionGroupLabel": {
+ "message": "Résolution",
+ "description": "Titre au-dessus des options de résolution"
+ },
+ "frameRateGroupLabel": {
+ "message": "Fréquence d'images",
+ "description": "Titre au-dessus des options de fréquence d'images"
},
"notEnoughRAM": {
"message": "Pas assez de RAM",
@@ -1904,5 +1920,141 @@
"unsavedRecordingModalDismiss": {
"message": "Ne plus afficher",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "Téléprompteur",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "Téléprompteur (indisponible sur cette page)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "Comment fonctionne le téléprompteur",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "Votre script s'ouvre dans une fenêtre flottante qui reste en dehors de l'enregistrement quand vous partagez une fenêtre ou un onglet, enregistrez une zone ou seulement votre caméra. Si vous partagez tout l'écran, la fenêtre apparaîtrait dans la vidéo : elle se ferme donc au démarrage. Votre script est toujours enregistré.",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "Téléprompteur fermé pour qu'il n'apparaisse pas dans votre enregistrement",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "Écrivez ou collez votre script",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "Démarrer le défilement",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "Mettre le défilement en pause",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "Plus d'options du script",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "Taille du texte",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "Vitesse",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "Texte plus petit",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "Texte plus grand",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "Plus lent",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "Plus rapide",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "mpm",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "Défiler au début de l'enregistrement",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "Revenir au début",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "Masquer le script",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "Défile automatiquement au début de l'enregistrement",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "Le téléprompteur va être fermé",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "Vous enregistrez tout votre écran, la fenêtre du téléprompteur apparaîtrait donc dans la vidéo. Nous la fermons pour qu'elle ne soit pas enregistrée. Vous pouvez la garder ouverte, mais elle sera enregistrée.",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "OK, la fermer",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "La garder visible",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "Ne plus afficher",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "La fenêtre de la caméra va se fermer",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "Vous enregistrez tout l'écran, la fenêtre de la caméra apparaîtrait donc dans la vidéo. Nous la fermons pour qu'elle n'apparaisse pas dans l'enregistrement. Votre caméra est toujours enregistrée.",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "Effacer le script",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "Cliquez à nouveau pour effacer",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "Déplacer la caméra sur la page",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "Déplacer la caméra ici",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "Afficher le script",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "Cliquez une première fois sur « Démarrer l'enregistrement » dans la page pour que Chrome puisse demander l'accès à la capture d'écran.",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "L'enregistrement d'une zone doit être lancé depuis la page",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/_locales/hi/messages.json b/src/_locales/hi/messages.json
index 0218313..a83ba40 100644
--- a/src/_locales/hi/messages.json
+++ b/src/_locales/hi/messages.json
@@ -1085,13 +1085,29 @@
"message": "कंप्यूटर ऑडियो को रिकॉर्ड करना चाहते हैं तो 'सिस्टम ऑडियो साझा करें' विकल्प को टॉगल करने की सुनिश्चित करें। इस विकल्प को दिखाई नहीं देता है, तो कृपया Chrome को अपडेट करने का प्रयास करें, या टैब रिकॉर्डिंग पर स्विच करें।",
"description": "अन्य ऑडियो चेतावना विवरण"
},
- "maxResolutionLabel": {
- "message": "अधिकतम रिज़ॉल्यूशन",
- "description": "सेटिंग्स मेनू में अधिकतम रिज़ॉल्यूशन का लेबल"
+ "qualityLabel": {
+ "message": "गुणवत्ता",
+ "description": "सेटिंग मेनू में गुणवत्ता का लेबल"
},
- "maxFPSLabel": {
- "message": "अधिकतम FPS",
- "description": "सेटिंग्स मेनू में अधिकतम FPS का लेबल"
+ "qualityAutoLabel": {
+ "message": "ऑटो",
+ "description": "सेटिंग मेनू में ऑटो गुणवत्ता विकल्प"
+ },
+ "qualityCustomLabel": {
+ "message": "कस्टम",
+ "description": "तब दिखता है जब रिज़ॉल्यूशन या फ़्रेम दर हाथ से चुनी गई हो"
+ },
+ "smootherMotionLabel": {
+ "message": "स्मूद मोशन को प्राथमिकता दें",
+ "description": "गुणवत्ता सेटिंग में स्विच, जो स्पष्टता के बजाय अधिक सहज वीडियो को प्राथमिकता देता है"
+ },
+ "resolutionGroupLabel": {
+ "message": "रिज़ॉल्यूशन",
+ "description": "रिज़ॉल्यूशन विकल्पों के ऊपर का शीर्षक"
+ },
+ "frameRateGroupLabel": {
+ "message": "फ़्रेम दर",
+ "description": "फ़्रेम दर विकल्पों के ऊपर का शीर्षक"
},
"notEnoughRAM": {
"message": "पर्याप्त रैम नहीं",
@@ -1904,5 +1920,141 @@
"unsavedRecordingModalDismiss": {
"message": "दोबारा न दिखाएं",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "टेलीप्रॉम्प्टर",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "टेलीप्रॉम्प्टर (इस पेज पर उपलब्ध नहीं)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "टेलीप्रॉम्प्टर कैसे काम करता है",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "आपकी स्क्रिप्ट एक फ़्लोटिंग विंडो में खुलती है, जो विंडो या टैब शेयर करने, किसी हिस्से को रिकॉर्ड करने या सिर्फ़ कैमरा रिकॉर्ड करने पर रिकॉर्डिंग में नहीं आती। अगर आप पूरी स्क्रीन शेयर करते हैं, तो विंडो वीडियो में दिखाई देगी, इसलिए शुरू करते ही वह बंद हो जाती है। आपकी स्क्रिप्ट हमेशा सेव रहती है।",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "टेलीप्रॉम्प्टर बंद किया गया ताकि वह आपकी रिकॉर्डिंग में न दिखे",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "अपनी स्क्रिप्ट लिखें या पेस्ट करें",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "स्क्रोल शुरू करें",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "स्क्रोल रोकें",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "स्क्रिप्ट के और विकल्प",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "टेक्स्ट का आकार",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "गति",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "छोटा टेक्स्ट",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "बड़ा टेक्स्ट",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "धीमा",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "तेज़",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "शब्द/मिनट",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "रिकॉर्डिंग शुरू होने पर स्क्रोल करें",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "सबसे ऊपर वापस जाएं",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "स्क्रिप्ट छिपाएं",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "रिकॉर्डिंग शुरू होते ही अपने आप स्क्रोल होगा",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "टेलीप्रॉम्प्टर बंद किया जाएगा",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "आप पूरी स्क्रीन रिकॉर्ड कर रहे हैं, इसलिए टेलीप्रॉम्प्टर विंडो वीडियो में दिखाई देगी। इसे रिकॉर्डिंग से बाहर रखने के लिए हम इसे बंद कर देंगे। आप इसे खुला रख सकते हैं, लेकिन यह रिकॉर्ड हो जाएगी।",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "ठीक है, बंद करें",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "खुला रखें",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "फिर से न दिखाएं",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "कैमरा विंडो बंद हो जाएगी",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "आप पूरी स्क्रीन रिकॉर्ड कर रहे हैं, इसलिए कैमरा विंडो वीडियो में दिखाई देगी। उसे रिकॉर्डिंग से बाहर रखने के लिए हम उसे बंद कर देंगे। आपका कैमरा फिर भी रिकॉर्ड होता रहेगा।",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "स्क्रिप्ट साफ़ करें",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "साफ़ करने के लिए फिर क्लिक करें",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "कैमरा पेज पर ले जाएं",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "कैमरा यहां ले जाएं",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "स्क्रिप्ट दिखाएं",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "पहली बार पेज पर “रिकॉर्डिंग शुरू करें” पर क्लिक करें, ताकि Chrome स्क्रीन कैप्चर की अनुमति माँग सके।",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "क्षेत्र की रिकॉर्डिंग पेज से ही शुरू करनी होगी",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/_locales/id/messages.json b/src/_locales/id/messages.json
index ca7c7c3..097d503 100644
--- a/src/_locales/id/messages.json
+++ b/src/_locales/id/messages.json
@@ -1085,13 +1085,29 @@
"message": "Pastikan Anda mengaktifkan opsi 'Bagikan audio sistem' jika Anda ingin merekam audio dari komputer. Jika Anda tidak melihat opsi ini, coba perbarui Chrome atau beralih ke opsi merekam tab.",
"description": "Deskripsi Peringatan Audio untuk Sistem Lainnya"
},
- "maxResolutionLabel": {
- "message": "Resolusi Maksimum",
- "description": "Label resolusi maksimum dalam menu pengaturan"
+ "qualityLabel": {
+ "message": "Kualitas",
+ "description": "Label kualitas di menu pengaturan"
},
- "maxFPSLabel": {
- "message": "FPS Maksimum",
- "description": "Label FPS maksimum dalam menu pengaturan"
+ "qualityAutoLabel": {
+ "message": "Otomatis",
+ "description": "Opsi kualitas otomatis di menu pengaturan"
+ },
+ "qualityCustomLabel": {
+ "message": "Kustom",
+ "description": "Ditampilkan saat resolusi atau kecepatan bingkai dipilih secara manual"
+ },
+ "smootherMotionLabel": {
+ "message": "Utamakan gerakan lebih mulus",
+ "description": "Sakelar di pengaturan kualitas yang mengutamakan video lebih mulus daripada ketajaman"
+ },
+ "resolutionGroupLabel": {
+ "message": "Resolusi",
+ "description": "Judul di atas opsi resolusi"
+ },
+ "frameRateGroupLabel": {
+ "message": "Kecepatan bingkai",
+ "description": "Judul di atas opsi kecepatan bingkai"
},
"notEnoughRAM": {
"message": "Tidak cukup RAM",
@@ -1904,5 +1920,141 @@
"unsavedRecordingModalDismiss": {
"message": "Jangan tampilkan lagi",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "Teleprompter",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "Teleprompter (tidak tersedia di halaman ini)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "Cara kerja teleprompter",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "Naskah Anda terbuka di jendela mengambang yang tidak ikut terekam saat Anda membagikan jendela atau tab, merekam area, atau hanya merekam kamera. Jika Anda membagikan seluruh layar, jendela itu akan muncul di video, jadi ditutup saat Anda mulai. Naskah Anda selalu tersimpan.",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "Teleprompter ditutup agar tidak ikut terekam",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "Tulis atau tempel naskah Anda",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "Mulai gulir",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "Jeda gulir",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "Opsi naskah lainnya",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "Ukuran teks",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "Kecepatan",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "Teks lebih kecil",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "Teks lebih besar",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "Lebih lambat",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "Lebih cepat",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "kpm",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "Gulir saat perekaman dimulai",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "Gulir kembali ke atas",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "Sembunyikan naskah",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "Menggulir otomatis setelah Anda mulai merekam",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "Teleprompter akan ditutup",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "Anda merekam seluruh layar, jadi jendela teleprompter akan muncul di video. Kami akan menutupnya agar tidak ikut terekam. Anda bisa membiarkannya terbuka, tetapi jendela itu akan terekam.",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "OK, tutup",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "Biarkan terlihat",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "Jangan tampilkan lagi",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "Jendela kamera akan ditutup",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "Anda merekam seluruh layar, jadi jendela kamera akan muncul di video. Kami akan menutupnya agar tidak ikut terekam. Kamera Anda tetap direkam.",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "Hapus naskah",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "Klik lagi untuk menghapus",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "Pindahkan kamera ke halaman",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "Pindahkan kamera ke sini",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "Tampilkan naskah",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "Klik \"Mulai merekam\" di halaman satu kali agar Chrome dapat meminta akses ke layar.",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "Perekaman area harus dimulai dari halaman",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/_locales/it/messages.json b/src/_locales/it/messages.json
index d5a2855..0eaea45 100644
--- a/src/_locales/it/messages.json
+++ b/src/_locales/it/messages.json
@@ -1065,13 +1065,29 @@
"message": "Assicurati di attivare l'opzione 'Condividi l'audio del sistema' se desideri registrare l'audio del computer. Se non vedi questa opzione, prova a aggiornare Chrome o passa alla registrazione della scheda.",
"description": "Descrizione dell'avviso audio per altri sistemi"
},
- "maxResolutionLabel": {
- "message": "Risoluzione massima",
- "description": "Etichetta risoluzione massima nel menu delle impostazioni"
+ "qualityLabel": {
+ "message": "Qualità",
+ "description": "Etichetta della qualità nel menu delle impostazioni"
},
- "maxFPSLabel": {
- "message": "FPS massimi",
- "description": "Etichetta FPS massimi nel menu delle impostazioni"
+ "qualityAutoLabel": {
+ "message": "Automatico",
+ "description": "Opzione di qualità automatica nel menu delle impostazioni"
+ },
+ "qualityCustomLabel": {
+ "message": "Personalizzato",
+ "description": "Mostrato quando risoluzione o frequenza fotogrammi sono state scelte a mano"
+ },
+ "smootherMotionLabel": {
+ "message": "Privilegia la fluidità",
+ "description": "Interruttore nelle impostazioni di qualità che favorisce un video più fluido rispetto alla nitidezza"
+ },
+ "resolutionGroupLabel": {
+ "message": "Risoluzione",
+ "description": "Titolo sopra le opzioni di risoluzione"
+ },
+ "frameRateGroupLabel": {
+ "message": "Frequenza fotogrammi",
+ "description": "Titolo sopra le opzioni di frequenza fotogrammi"
},
"notEnoughRAM": {
"message": "RAM insufficiente",
@@ -1899,5 +1915,141 @@
"unsavedRecordingModalDismiss": {
"message": "Non mostrare più",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "Teleprompter",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "Teleprompter (non disponibile in questa pagina)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "Come funziona il teleprompter",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "Il tuo copione si apre in una finestra mobile che resta fuori dalla registrazione quando condividi una finestra o una scheda, registri un'area o registri solo la fotocamera. Se condividi l'intero schermo, la finestra comparirebbe nel video, quindi si chiude all'avvio. Il copione viene sempre salvato.",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "Teleprompter chiuso per tenerlo fuori dalla registrazione",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "Scrivi o incolla il tuo copione",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "Avvia lo scorrimento",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "Metti in pausa lo scorrimento",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "Altre opzioni del copione",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "Dimensione testo",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "Velocità",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "Testo più piccolo",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "Testo più grande",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "Più lento",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "Più veloce",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "ppm",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "Scorri all'avvio della registrazione",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "Torna all'inizio",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "Nascondi copione",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "Scorre automaticamente quando avvii la registrazione",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "Il teleprompter verrà chiuso",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "Stai registrando l'intero schermo, quindi la finestra del teleprompter comparirebbe nel video. La chiudiamo per tenerla fuori dalla registrazione. Puoi lasciarla aperta, ma verrà registrata.",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "OK, chiudilo",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "Lascialo visibile",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "Non mostrare più",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "La finestra della fotocamera si chiuderà",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "Stai registrando l'intero schermo, quindi la finestra della fotocamera comparirebbe nel video. La chiuderemo per tenerla fuori dalla registrazione. La fotocamera viene comunque registrata.",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "Cancella copione",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "Fai di nuovo clic per cancellare",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "Sposta la fotocamera sulla pagina",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "Sposta la fotocamera qui",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "Mostra copione",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "Fai clic una volta su \"Avvia la registrazione\" nella pagina, così Chrome può chiedere l'accesso allo schermo.",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "La registrazione di un'area deve essere avviata dalla pagina",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/_locales/ko/messages.json b/src/_locales/ko/messages.json
index 701467f..9697761 100644
--- a/src/_locales/ko/messages.json
+++ b/src/_locales/ko/messages.json
@@ -1085,13 +1085,29 @@
"message": "컴퓨터 오디오를 녹음하려면 '시스템 오디오 공유' 옵션을 활성화하세요. 이 옵션을 보지 못하는 경우 Chrome을 업데이트하거나 탭 녹음 옵션으로 전환해 보세요.",
"description": "기타 시스템용 오디오 경고 설명"
},
- "maxResolutionLabel": {
- "message": "최대 해상도",
- "description": "설정 메뉴에서 최대 해상도 레이블"
+ "qualityLabel": {
+ "message": "품질",
+ "description": "설정 메뉴의 품질 레이블"
},
- "maxFPSLabel": {
- "message": "최대 FPS",
- "description": "설정 메뉴에서 최대 FPS 레이블"
+ "qualityAutoLabel": {
+ "message": "자동",
+ "description": "설정 메뉴의 자동 품질 옵션"
+ },
+ "qualityCustomLabel": {
+ "message": "사용자 지정",
+ "description": "해상도나 프레임 속도를 직접 선택했을 때 표시됩니다"
+ },
+ "smootherMotionLabel": {
+ "message": "더 부드러운 움직임 우선",
+ "description": "선명도보다 더 부드러운 영상을 우선하는 품질 설정 스위치"
+ },
+ "resolutionGroupLabel": {
+ "message": "해상도",
+ "description": "해상도 옵션 위의 제목"
+ },
+ "frameRateGroupLabel": {
+ "message": "프레임 속도",
+ "description": "프레임 속도 옵션 위의 제목"
},
"notEnoughRAM": {
"message": "RAM 부족",
@@ -1904,5 +1920,141 @@
"unsavedRecordingModalDismiss": {
"message": "다시 표시하지 않기",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "텔레프롬프터",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "텔레프롬프터(이 페이지에서는 사용할 수 없음)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "텔레프롬프터 작동 방식",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "스크립트는 플로팅 창에서 열리며, 창이나 탭을 공유하거나 영역 또는 카메라만 녹화할 때는 녹화에 나타나지 않습니다. 전체 화면을 공유하면 창이 영상에 보이게 되므로 시작할 때 닫힙니다. 스크립트는 항상 저장됩니다.",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "녹화에 나오지 않도록 텔레프롬프터를 닫았습니다",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "스크립트를 작성하거나 붙여넣으세요",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "스크롤 시작",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "스크롤 일시 중지",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "스크립트 옵션 더보기",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "글자 크기",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "속도",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "글자 작게",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "글자 크게",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "느리게",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "빠르게",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "wpm",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "녹화 시작 시 자동 스크롤",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "맨 위로 스크롤",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "스크립트 숨기기",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "녹화를 시작하면 자동으로 스크롤됩니다",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "텔레프롬프터가 닫힙니다",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "전체 화면을 녹화 중이라 텔레프롬프터 창이 영상에 나타납니다. 녹화에 포함되지 않도록 창을 닫겠습니다. 열어 둘 수도 있지만, 그러면 녹화됩니다.",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "닫기",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "계속 표시",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "다시 표시하지 않기",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "카메라 창이 닫힙니다",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "전체 화면을 녹화 중이라 카메라 창이 영상에 나타나게 됩니다. 녹화에 보이지 않도록 창을 닫겠습니다. 카메라는 계속 녹화됩니다.",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "스크립트 지우기",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "다시 클릭하면 지워집니다",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "카메라를 페이지로 이동",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "카메라를 여기로 이동",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "스크립트 표시",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "처음 한 번은 페이지에서 ‘녹화 시작’을 눌러 Chrome이 화면 캡처 권한을 요청할 수 있게 해 주세요.",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "영역 녹화는 페이지에서 시작해야 합니다",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/_locales/pl/messages.json b/src/_locales/pl/messages.json
index cda4c23..69114b6 100644
--- a/src/_locales/pl/messages.json
+++ b/src/_locales/pl/messages.json
@@ -1085,13 +1085,29 @@
"message": "Aby nagrać dźwięk z komputera, upewnij się, że opcja 'Udostępnij dźwięk systemowy' jest włączona. Jeśli nie widzisz tej opcji, spróbuj zaktualizować Chrome lub przełączyć się na opcję nagrywania zakładek.",
"description": "Opis ostrzeżenia dźwiękowego dla innych systemów"
},
- "maxResolutionLabel": {
- "message": "Maksymalna rozdzielczość",
- "description": "Etykieta maksymalnej rozdzielczości w menu ustawień"
+ "qualityLabel": {
+ "message": "Jakość",
+ "description": "Etykieta jakości w menu ustawień"
},
- "maxFPSLabel": {
- "message": "Maksymalna ilość kl./s",
- "description": "Etykieta maksymalnej ilości kl./s w menu ustawień"
+ "qualityAutoLabel": {
+ "message": "Auto",
+ "description": "Opcja automatycznej jakości w menu ustawień"
+ },
+ "qualityCustomLabel": {
+ "message": "Własna",
+ "description": "Wyświetlane, gdy rozdzielczość lub liczba klatek na sekundę została wybrana ręcznie"
+ },
+ "smootherMotionLabel": {
+ "message": "Priorytet płynności",
+ "description": "Przełącznik w ustawieniach jakości, który przedkłada płynniejsze wideo nad ostrość"
+ },
+ "resolutionGroupLabel": {
+ "message": "Rozdzielczość",
+ "description": "Nagłówek nad opcjami rozdzielczości"
+ },
+ "frameRateGroupLabel": {
+ "message": "Klatki na sekundę",
+ "description": "Nagłówek nad opcjami liczby klatek na sekundę"
},
"notEnoughRAM": {
"message": "Za mało pamięci RAM",
@@ -1904,5 +1920,141 @@
"unsavedRecordingModalDismiss": {
"message": "Nie pokazuj ponownie",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "Teleprompter",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "Teleprompter (niedostępny na tej stronie)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "Jak działa teleprompter",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "Twój skrypt otwiera się w pływającym oknie, które nie trafia do nagrania, gdy udostępniasz okno lub kartę, nagrywasz obszar albo samą kamerę. Jeśli udostępniasz cały ekran, okno byłoby widoczne w filmie, więc zamyka się po starcie. Skrypt jest zawsze zapisywany.",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "Teleprompter zamknięty, aby nie trafił do nagrania",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "Napisz lub wklej swój skrypt",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "Rozpocznij przewijanie",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "Wstrzymaj przewijanie",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "Więcej opcji skryptu",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "Rozmiar tekstu",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "Szybkość",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "Mniejszy tekst",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "Większy tekst",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "Wolniej",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "Szybciej",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "słów/min",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "Przewijaj po rozpoczęciu nagrywania",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "Przewiń na początek",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "Ukryj skrypt",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "Przewija się automatycznie po rozpoczęciu nagrywania",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "Teleprompter zostanie zamknięty",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "Nagrywasz cały ekran, więc okno telepromptera pojawiłoby się w nagraniu. Zamkniemy je, żeby się w nim nie znalazło. Możesz je zostawić otwarte, ale wtedy też zostanie nagrane.",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "OK, zamknij",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "Zostaw widoczny",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "Nie pokazuj ponownie",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "Okno kamery zostanie zamknięte",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "Nagrywasz cały ekran, więc okno kamery byłoby widoczne w filmie. Zamkniemy je, aby nie trafiło do nagrania. Twoja kamera nadal jest nagrywana.",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "Wyczyść skrypt",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "Kliknij ponownie, aby wyczyścić",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "Przenieś kamerę na stronę",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "Przenieś kamerę tutaj",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "Pokaż skrypt",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "Kliknij „Rozpocznij nagrywanie” na stronie raz, aby Chrome mógł poprosić o dostęp do przechwytywania ekranu.",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "Nagrywanie obszaru trzeba rozpocząć ze strony",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/_locales/pt_BR/messages.json b/src/_locales/pt_BR/messages.json
index 4781597..99fa7f8 100644
--- a/src/_locales/pt_BR/messages.json
+++ b/src/_locales/pt_BR/messages.json
@@ -1085,13 +1085,29 @@
"message": "Certifique-se de ativar a opção 'Compartilhar áudio do sistema' se desejar gravar áudio do computador. Se você não vir essa opção, tente atualizar o Chrome ou alternar para a gravação da guia.",
"description": "Descrição de Aviso de Áudio para Outros Sistemas"
},
- "maxResolutionLabel": {
- "message": "Resolução máxima",
- "description": "Etiqueta de resolução máxima no menu de configurações"
+ "qualityLabel": {
+ "message": "Qualidade",
+ "description": "Rótulo de qualidade no menu de configurações"
},
- "maxFPSLabel": {
- "message": "Taxa de quadros máxima",
- "description": "Etiqueta de taxa de quadros máxima no menu de configurações"
+ "qualityAutoLabel": {
+ "message": "Automático",
+ "description": "Opção de qualidade automática no menu de configurações"
+ },
+ "qualityCustomLabel": {
+ "message": "Personalizado",
+ "description": "Exibido quando a resolução ou a taxa de quadros foi escolhida manualmente"
+ },
+ "smootherMotionLabel": {
+ "message": "Priorizar movimento mais fluido",
+ "description": "Chave nas configurações de qualidade que favorece um vídeo mais fluido em vez de nitidez"
+ },
+ "resolutionGroupLabel": {
+ "message": "Resolução",
+ "description": "Título acima das opções de resolução"
+ },
+ "frameRateGroupLabel": {
+ "message": "Taxa de quadros",
+ "description": "Título acima das opções de taxa de quadros"
},
"notEnoughRAM": {
"message": "Memória RAM insuficiente",
@@ -1904,5 +1920,141 @@
"unsavedRecordingModalDismiss": {
"message": "Não mostrar novamente",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "Teleprompter",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "Teleprompter (indisponível nesta página)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "Como o teleprompter funciona",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "Seu roteiro abre em uma janela flutuante que fica fora da gravação quando você compartilha uma janela ou aba, grava uma área ou grava só a câmera. Se você compartilhar a tela inteira, a janela apareceria no vídeo, então ela fecha quando você começa. Seu roteiro é sempre salvo.",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "Teleprompter fechado para ficar fora da sua gravação",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "Escreva ou cole seu roteiro",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "Iniciar rolagem",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "Pausar rolagem",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "Mais opções do roteiro",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "Tamanho do texto",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "Velocidade",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "Texto menor",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "Texto maior",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "Mais devagar",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "Mais rápido",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "ppm",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "Rolar quando a gravação começar",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "Voltar ao início",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "Ocultar roteiro",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "Rola automaticamente quando você começa a gravar",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "O teleprompter será fechado",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "Você está gravando a tela inteira, então a janela do teleprompter apareceria no vídeo. Vamos fechá-la para que não seja gravada. Você pode mantê-la aberta, mas ela será gravada.",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "OK, fechar",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "Manter visível",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "Não mostrar novamente",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "A janela da câmera será fechada",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "Você está gravando a tela inteira, então a janela da câmera apareceria no vídeo. Vamos fechá-la para que fique fora da gravação. Sua câmera continua sendo gravada.",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "Limpar roteiro",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "Clique novamente para limpar",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "Mover a câmera para a página",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "Mover a câmera para cá",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "Mostrar roteiro",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "Clique uma vez em \"Iniciar gravação\" na página para o Chrome poder pedir acesso à tela.",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "A gravação de uma região precisa ser iniciada pela página",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/_locales/pt_PT/messages.json b/src/_locales/pt_PT/messages.json
index 56c8d8b..acadc2b 100644
--- a/src/_locales/pt_PT/messages.json
+++ b/src/_locales/pt_PT/messages.json
@@ -1085,13 +1085,29 @@
"message": "Certifique-se de ativar a opção 'Partilhar áudio do sistema' se desejar gravar áudio do computador. Se não visualizar esta opção, tente atualizar o Chrome ou alternar para a gravação de guias.",
"description": "Descrição do Aviso de Áudio para Outros Sistemas"
},
- "maxResolutionLabel": {
- "message": "Resolução máxima",
- "description": "Etiqueta de resolução máxima no menu de configurações"
+ "qualityLabel": {
+ "message": "Qualidade",
+ "description": "Etiqueta de qualidade no menu de definições"
},
- "maxFPSLabel": {
- "message": "Máximo de FPS",
- "description": "Etiqueta de máximo de FPS no menu de configurações"
+ "qualityAutoLabel": {
+ "message": "Automático",
+ "description": "Opção de qualidade automática no menu de definições"
+ },
+ "qualityCustomLabel": {
+ "message": "Personalizado",
+ "description": "Apresentado quando a resolução ou a taxa de fotogramas foi escolhida manualmente"
+ },
+ "smootherMotionLabel": {
+ "message": "Priorizar movimento mais fluido",
+ "description": "Interruptor nas definições de qualidade que favorece um vídeo mais fluido em vez de nitidez"
+ },
+ "resolutionGroupLabel": {
+ "message": "Resolução",
+ "description": "Título acima das opções de resolução"
+ },
+ "frameRateGroupLabel": {
+ "message": "Taxa de fotogramas",
+ "description": "Título acima das opções de taxa de fotogramas"
},
"notEnoughRAM": {
"message": "Memória RAM insuficiente",
@@ -1904,5 +1920,141 @@
"unsavedRecordingModalDismiss": {
"message": "Não mostrar novamente",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "Teleprompter",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "Teleprompter (indisponível nesta página)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "Como funciona o teleprompter",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "O teu guião abre numa janela flutuante que fica fora da gravação quando partilhas uma janela ou separador, gravas uma área ou gravas só a câmara. Se partilhares o ecrã inteiro, a janela apareceria no vídeo, por isso fecha quando começas. O teu guião é sempre guardado.",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "Teleprompter fechado para ficar fora da tua gravação",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "Escreve ou cola o teu guião",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "Iniciar deslocamento",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "Pausar deslocamento",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "Mais opções do guião",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "Tamanho do texto",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "Velocidade",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "Texto mais pequeno",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "Texto maior",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "Mais devagar",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "Mais rápido",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "ppm",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "Deslocar quando a gravação começar",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "Voltar ao início",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "Ocultar guião",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "Desloca-se automaticamente quando começares a gravar",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "O teleprompter vai ser fechado",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "Estás a gravar o ecrã inteiro, por isso a janela do teleprompter apareceria no vídeo. Vamos fechá-la para que não seja gravada. Podes mantê-la aberta, mas será gravada.",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "OK, fechar",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "Manter visível",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "Não mostrar novamente",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "A janela da câmara será fechada",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "Estás a gravar o ecrã inteiro, por isso a janela da câmara apareceria no vídeo. Vamos fechá-la para ficar fora da gravação. A tua câmara continua a ser gravada.",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "Limpar guião",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "Clica novamente para limpar",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "Mover a câmara para a página",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "Mover a câmara para aqui",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "Mostrar guião",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "Clica uma vez em \"Iniciar gravação\" na página para o Chrome poder pedir acesso ao ecrã.",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "A gravação de uma região tem de ser iniciada a partir da página",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/_locales/ru/messages.json b/src/_locales/ru/messages.json
index 3ceed95..ad995b0 100644
--- a/src/_locales/ru/messages.json
+++ b/src/_locales/ru/messages.json
@@ -1085,13 +1085,29 @@
"message": "Для записи звука с компьютера убедитесь, что включена опция 'Делиться аудио системы'. Если вы не видите эту опцию, попробуйте обновить Chrome или перейти на опцию записи вкладок.",
"description": "Описание предупреждения о звуке для других систем"
},
- "maxResolutionLabel": {
- "message": "Максимальное разрешение",
- "description": "Метка максимального разрешения в меню настроек"
+ "qualityLabel": {
+ "message": "Качество",
+ "description": "Метка качества в меню настроек"
},
- "maxFPSLabel": {
- "message": "Максимальное количество кадров в секунду",
- "description": "Метка максимального количества кадров в секунду в меню настроек"
+ "qualityAutoLabel": {
+ "message": "Авто",
+ "description": "Вариант автоматического качества в меню настроек"
+ },
+ "qualityCustomLabel": {
+ "message": "Вручную",
+ "description": "Показывается, когда разрешение или частота кадров выбраны вручную"
+ },
+ "smootherMotionLabel": {
+ "message": "Приоритет плавного движения",
+ "description": "Переключатель в настройках качества: плавное видео важнее чёткости"
+ },
+ "resolutionGroupLabel": {
+ "message": "Разрешение",
+ "description": "Заголовок над вариантами разрешения"
+ },
+ "frameRateGroupLabel": {
+ "message": "Частота кадров",
+ "description": "Заголовок над вариантами частоты кадров"
},
"notEnoughRAM": {
"message": "Недостаточно оперативной памяти",
@@ -1904,5 +1920,141 @@
"unsavedRecordingModalDismiss": {
"message": "Больше не показывать",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "Телесуфлёр",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "Телесуфлёр (недоступен на этой странице)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "Как работает телесуфлёр",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "Ваш сценарий открывается в плавающем окне, которое не попадает в запись, когда вы делитесь окном или вкладкой, записываете область или только камеру. Если вы делитесь всем экраном, окно попало бы в видео, поэтому оно закрывается при старте. Сценарий всегда сохраняется.",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "Телесуфлёр закрыт, чтобы не попасть в запись",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "Напишите или вставьте свой текст",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "Начать прокрутку",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "Приостановить прокрутку",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "Другие параметры текста",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "Размер текста",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "Скорость",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "Уменьшить текст",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "Увеличить текст",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "Медленнее",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "Быстрее",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "сл/мин",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "Прокручивать при старте записи",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "Прокрутить в начало",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "Скрыть текст",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "Прокручивается автоматически после начала записи",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "Телесуфлёр будет закрыт",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "Вы записываете весь экран, поэтому окно телесуфлёра попало бы в видео. Мы закроем его, чтобы оно не оказалось в записи. Можно оставить его открытым, но тогда оно будет записано.",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "ОК, закрыть",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "Оставить видимым",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "Больше не показывать",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "Окно камеры будет закрыто",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "Вы записываете весь экран, поэтому окно камеры попало бы в видео. Мы закроем его, чтобы оно не оказалось в записи. Камера по-прежнему записывается.",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "Очистить текст",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "Нажмите ещё раз, чтобы очистить",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "Перенести камеру на страницу",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "Перенести камеру сюда",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "Показать текст",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "Нажмите «Начать запись» на странице один раз, чтобы Chrome мог запросить доступ к захвату экрана.",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "Запись области нужно начинать со страницы",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/_locales/ta/messages.json b/src/_locales/ta/messages.json
index ecadb03..3b412c1 100644
--- a/src/_locales/ta/messages.json
+++ b/src/_locales/ta/messages.json
@@ -1085,13 +1085,29 @@
"message": "கணினி ஒலியைப் பதிவு செய்ய விரும்பினால், 'Share system audio' விருப்பத்தை இயக்க உறுதி செய்யுங்கள். இந்த விருப்பம் தெரியவில்லை எனில், Chrome-ஐப் புதுப்பிக்க முயற்சிக்கவும் அல்லது தாவல் பதிவுக்கு மாறவும்.",
"description": "பிற கணினி வடிவம் க்கு ஒலியின் எச்சரிக்கை தலைப்பு"
},
- "maxResolutionLabel": {
- "message": "அதிசய கருவி",
- "description": "அமைப்புகள் பட்டியலில் அதிசய கருவி குறியீட்டு"
+ "qualityLabel": {
+ "message": "தரம்",
+ "description": "அமைப்புகள் மெனுவில் தரத்திற்கான லேபிள்"
},
- "maxFPSLabel": {
- "message": "அதிகபட்ச FPS",
- "description": "அமைப்புகள் பட்டியலில் அதிசய கோட்டிகள் குறியீட்டு"
+ "qualityAutoLabel": {
+ "message": "தானியங்கி",
+ "description": "அமைப்புகள் மெனுவில் தானியங்கி தர விருப்பம்"
+ },
+ "qualityCustomLabel": {
+ "message": "தனிப்பயன்",
+ "description": "தெளிவுத்திறன் அல்லது ஃபிரேம் வீதம் கைமுறையாகத் தேர்ந்தெடுக்கப்பட்டால் காட்டப்படும்"
+ },
+ "smootherMotionLabel": {
+ "message": "மென்மையான இயக்கத்திற்கு முன்னுரிமை",
+ "description": "தெளிவை விட மென்மையான வீடியோவுக்கு முன்னுரிமை தரும் தர அமைப்புகளில் உள்ள சுவிட்ச்"
+ },
+ "resolutionGroupLabel": {
+ "message": "தெளிவுத்திறன்",
+ "description": "தெளிவுத்திறன் விருப்பங்களுக்கு மேலுள்ள தலைப்பு"
+ },
+ "frameRateGroupLabel": {
+ "message": "ஃபிரேம் வீதம்",
+ "description": "ஃபிரேம் வீத விருப்பங்களுக்கு மேலுள்ள தலைப்பு"
},
"notEnoughRAM": {
"message": "புதிய ரேம் போதுமில்லை",
@@ -1904,5 +1920,141 @@
"unsavedRecordingModalDismiss": {
"message": "மீண்டும் காட்ட வேண்டாம்",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "டெலிப்ராம்ப்டர்",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "டெலிப்ராம்ப்டர் (இந்தப் பக்கத்தில் கிடைக்கவில்லை)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "டெலிப்ராம்ப்டர் எப்படி வேலை செய்கிறது",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "நீங்கள் ஒரு சாளரத்தையோ தாவலையோ பகிரும்போது, ஒரு பகுதியைப் பதிவு செய்யும்போது அல்லது கேமராவை மட்டும் பதிவு செய்யும்போது, உங்கள் ஸ்கிரிப்ட் பதிவில் வராத மிதக்கும் சாளரத்தில் திறக்கும். முழுத் திரையையும் பகிர்ந்தால் அந்தச் சாளரம் வீடியோவில் தெரியும், அதனால் தொடங்கும்போது அது மூடப்படும். உங்கள் ஸ்கிரிப்ட் எப்போதும் சேமிக்கப்படும்.",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "பதிவில் வராமல் இருக்க டெலிப்ராம்ப்டர் மூடப்பட்டது",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "உங்கள் ஸ்கிரிப்டை எழுதவும் அல்லது ஒட்டவும்",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "ஸ்க்ரோலிங்கைத் தொடங்கு",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "ஸ்க்ரோலிங்கை இடைநிறுத்து",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "மேலும் ஸ்கிரிப்ட் விருப்பங்கள்",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "உரை அளவு",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "வேகம்",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "சிறிய உரை",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "பெரிய உரை",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "மெதுவாக",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "வேகமாக",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "சொல்/நிமி",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "பதிவு தொடங்கும்போது ஸ்க்ரோல் செய்",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "மேலே திரும்ப ஸ்க்ரோல் செய்",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "ஸ்கிரிப்டை மறை",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "பதிவைத் தொடங்கியவுடன் தானாக ஸ்க்ரோல் ஆகும்",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "டெலிப்ராம்ப்டர் மூடப்படும்",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "நீங்கள் முழுத் திரையையும் பதிவு செய்வதால், டெலிப்ராம்ப்டர் சாளரம் வீடியோவில் தெரியும். அது பதிவில் வராமல் இருக்க அதை மூடுவோம். அதைத் திறந்தே வைக்கலாம், ஆனால் அது பதிவாகும்.",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "சரி, மூடு",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "தெரியும்படி வை",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "மீண்டும் காட்ட வேண்டாம்",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "கேமரா சாளரம் மூடப்படும்",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "நீங்கள் முழுத் திரையையும் பதிவு செய்கிறீர்கள், அதனால் கேமரா சாளரம் வீடியோவில் தோன்றும். பதிவில் வராமல் இருக்க அதை மூடுவோம். உங்கள் கேமரா தொடர்ந்து பதிவாகும்.",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "ஸ்கிரிப்டை அழி",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "அழிக்க மீண்டும் கிளிக் செய்யவும்",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "கேமராவைப் பக்கத்துக்கு நகர்த்து",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "கேமராவை இங்கே நகர்த்து",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "ஸ்கிரிப்டைக் காட்டு",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "முதல் முறை பக்கத்தில் “பதிவு செய்ய ஆரம்பிக்கவும்” என்பதை அழுத்துங்கள்; அப்போது Chrome திரைப் பதிவுக்கான அனுமதியைக் கேட்கும்.",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "பகுதி பதிவை பக்கத்திலிருந்தே தொடங்க வேண்டும்",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/_locales/tr/messages.json b/src/_locales/tr/messages.json
index f9112b1..f66527d 100644
--- a/src/_locales/tr/messages.json
+++ b/src/_locales/tr/messages.json
@@ -1085,13 +1085,29 @@
"message": "Bilgisayar sesini kaydetmek istiyorsanız, 'Sistem Sesini Paylaş' seçeneğinin etkin olduğundan emin olun. Bu seçeneği görmüyorsanız, Chrome'u güncellemeyi deneyin veya sekme kaydı seçeneğine geçin.",
"description": "Diğer Sistemler İçin Ses Uyarı Açıklaması"
},
- "maxResolutionLabel": {
- "message": "Maksimum çözünürlük",
- "description": "Ayarlar menüsündeki maksimum çözünürlük etiketi"
+ "qualityLabel": {
+ "message": "Kalite",
+ "description": "Ayarlar menüsündeki kalite etiketi"
},
- "maxFPSLabel": {
- "message": "Maksimum FPS",
- "description": "Ayarlar menüsündeki maksimum FPS etiketi"
+ "qualityAutoLabel": {
+ "message": "Otomatik",
+ "description": "Ayarlar menüsündeki otomatik kalite seçeneği"
+ },
+ "qualityCustomLabel": {
+ "message": "Özel",
+ "description": "Çözünürlük veya kare hızı elle seçildiğinde gösterilir"
+ },
+ "smootherMotionLabel": {
+ "message": "Daha akıcı harekete öncelik ver",
+ "description": "Kalite ayarlarında netlik yerine daha akıcı videoyu tercih eden anahtar"
+ },
+ "resolutionGroupLabel": {
+ "message": "Çözünürlük",
+ "description": "Çözünürlük seçeneklerinin üstündeki başlık"
+ },
+ "frameRateGroupLabel": {
+ "message": "Kare hızı",
+ "description": "Kare hızı seçeneklerinin üstündeki başlık"
},
"notEnoughRAM": {
"message": "Yetersiz RAM",
@@ -1904,5 +1920,141 @@
"unsavedRecordingModalDismiss": {
"message": "Bir daha gösterme",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "Teleprompter",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "Teleprompter (bu sayfada kullanılamıyor)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "Teleprompter nasıl çalışır",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "Metniniz, bir pencere veya sekme paylaştığınızda, bir alan kaydettiğinizde ya da yalnızca kameranızı kaydettiğinizde kayda girmeyen kayan bir pencerede açılır. Tüm ekranı paylaşırsanız pencere videoda görünürdü, bu yüzden başlarken kapanır. Metniniz her zaman kaydedilir.",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "Teleprompter kayda girmesin diye kapatıldı",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "Metninizi yazın veya yapıştırın",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "Kaydırmayı başlat",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "Kaydırmayı duraklat",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "Diğer metin seçenekleri",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "Metin boyutu",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "Hız",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "Daha küçük metin",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "Daha büyük metin",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "Daha yavaş",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "Daha hızlı",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "kelime/dk",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "Kayıt başlayınca kaydır",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "En üste kaydır",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "Metni gizle",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "Kayda başladığınızda otomatik olarak kayar",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "Teleprompter kapatılacak",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "Tüm ekranınızı kaydediyorsunuz, bu yüzden teleprompter penceresi videoda görünürdü. Kayda girmemesi için kapatacağız. Açık tutabilirsiniz ama kaydedilir.",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "Tamam, kapat",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "Görünür kalsın",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "Tekrar gösterme",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "Kamera penceresi kapatılacak",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "Tüm ekranı kaydediyorsunuz, bu yüzden kamera penceresi videoda görünürdü. Kayda girmemesi için kapatacağız. Kameranız yine de kaydedilir.",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "Metni temizle",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "Temizlemek için tekrar tıkla",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "Kamerayı sayfaya taşı",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "Kamerayı buraya taşı",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "Metni göster",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "Chrome'un ekran erişimi isteyebilmesi için sayfadaki “Kayda başla” düğmesine bir kez tıklayın.",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "Bölge kaydı sayfadan başlatılmalıdır",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/_locales/uk/messages.json b/src/_locales/uk/messages.json
index be8c2b5..7989fa8 100644
--- a/src/_locales/uk/messages.json
+++ b/src/_locales/uk/messages.json
@@ -1085,13 +1085,29 @@
"message": "Якщо ви хочете записувати звук комп'ютера, переконайтеся, що опція 'Ділитися аудіо системи' активована. Якщо ви не бачите цю опцію, спробуйте оновити Chrome або перейти до опції запису вкладок.",
"description": "Опис попередження про аудіо для інших систем"
},
- "maxResolutionLabel": {
- "message": "Максимальний роздільна здатність",
- "description": "Максимальний підпис роздільної здатності в меню налаштувань"
+ "qualityLabel": {
+ "message": "Якість",
+ "description": "Мітка якості в меню налаштувань"
},
- "maxFPSLabel": {
- "message": "Максимальний кадровий кут",
- "description": "Максимальний підпис кадрового кута в меню налаштувань"
+ "qualityAutoLabel": {
+ "message": "Авто",
+ "description": "Варіант автоматичної якості в меню налаштувань"
+ },
+ "qualityCustomLabel": {
+ "message": "Власна",
+ "description": "Показується, коли роздільну здатність або частоту кадрів вибрано вручну"
+ },
+ "smootherMotionLabel": {
+ "message": "Пріоритет плавного руху",
+ "description": "Перемикач у налаштуваннях якості: плавне відео важливіше за чіткість"
+ },
+ "resolutionGroupLabel": {
+ "message": "Роздільна здатність",
+ "description": "Заголовок над варіантами роздільної здатності"
+ },
+ "frameRateGroupLabel": {
+ "message": "Частота кадрів",
+ "description": "Заголовок над варіантами частоти кадрів"
},
"notEnoughRAM": {
"message": "Недостатньо ОПЕРАТИВНОЇ ПАМ'ЯТІ",
@@ -1902,5 +1918,141 @@
"unsavedRecordingModalDismiss": {
"message": "Більше не показувати",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "Телесуфлер",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "Телесуфлер (недоступний на цій сторінці)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "Як працює телесуфлер",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "Ваш сценарій відкривається в плаваючому вікні, яке не потрапляє в запис, коли ви ділитеся вікном або вкладкою, записуєте область чи лише камеру. Якщо ви ділитеся всім екраном, вікно потрапило б у відео, тому воно закривається на старті. Сценарій завжди зберігається.",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "Телесуфлер закрито, щоб він не потрапив у запис",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "Напишіть або вставте свій текст",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "Почати прокручування",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "Призупинити прокручування",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "Інші параметри тексту",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "Розмір тексту",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "Швидкість",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "Зменшити текст",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "Збільшити текст",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "Повільніше",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "Швидше",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "сл/хв",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "Прокручувати на початку запису",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "Прокрутити на початок",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "Сховати текст",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "Прокручується автоматично, щойно почнеться запис",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "Телесуфлер буде закрито",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "Ви записуєте весь екран, тому вікно телесуфлера потрапило б у відео. Ми закриємо його, щоб воно не опинилося в записі. Можна залишити його відкритим, але його буде записано.",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "ОК, закрити",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "Залишити видимим",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "Більше не показувати",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "Вікно камери буде закрито",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "Ви записуєте весь екран, тому вікно камери потрапило б у відео. Ми закриємо його, щоб воно не опинилося в записі. Камера й надалі записується.",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "Очистити текст",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "Натисніть ще раз, щоб очистити",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "Перенести камеру на сторінку",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "Перенести камеру сюди",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "Показати текст",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "Натисніть «Почати запис» на сторінці один раз, щоб Chrome міг запитати доступ до захоплення екрана.",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "Запис області потрібно починати зі сторінки",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/_locales/zh_CN/messages.json b/src/_locales/zh_CN/messages.json
index afa52ba..4b1a9ba 100644
--- a/src/_locales/zh_CN/messages.json
+++ b/src/_locales/zh_CN/messages.json
@@ -1081,13 +1081,29 @@
"message": "如果您想录制计算机音频,请确保启用'共享系统音频'选项。如果您看不到此选项,请尝试更新Chrome或切换到选项卡录制选项。",
"description": "其他系统音频警告说明"
},
- "maxResolutionLabel": {
- "message": "最高分辨率",
- "description": "设置菜单中的最高分辨率标签"
+ "qualityLabel": {
+ "message": "画质",
+ "description": "设置菜单中的画质标签"
},
- "maxFPSLabel": {
- "message": "最高帧率",
- "description": "设置菜单中的最高帧率标签"
+ "qualityAutoLabel": {
+ "message": "自动",
+ "description": "设置菜单中的自动画质选项"
+ },
+ "qualityCustomLabel": {
+ "message": "自定义",
+ "description": "手动选择分辨率或帧率时显示"
+ },
+ "smootherMotionLabel": {
+ "message": "优先保证动作更流畅",
+ "description": "画质设置中的开关,优先考虑更流畅的视频而不是清晰度"
+ },
+ "resolutionGroupLabel": {
+ "message": "分辨率",
+ "description": "分辨率选项上方的标题"
+ },
+ "frameRateGroupLabel": {
+ "message": "帧率",
+ "description": "帧率选项上方的标题"
},
"notEnoughRAM": {
"message": "内存不足",
@@ -1903,5 +1919,141 @@
"unsavedRecordingModalDismiss": {
"message": "不再显示",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "提词器",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "提词器(此页面不可用)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "提词器的工作方式",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "你的讲稿会在一个悬浮窗口中打开。共享窗口或标签页、录制某个区域或只录制摄像头时,该窗口不会出现在录制中。如果共享整个屏幕,窗口会出现在视频里,所以开始时会将其关闭。你的讲稿始终会被保存。",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "已关闭提词器,避免被录进视频",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "输入或粘贴你的讲稿",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "开始滚动",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "暂停滚动",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "更多讲稿选项",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "文字大小",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "速度",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "缩小文字",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "放大文字",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "更慢",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "更快",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "字/分钟",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "开始录制时自动滚动",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "滚动回顶部",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "隐藏讲稿",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "开始录制后会自动滚动",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "提词器将被关闭",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "你正在录制整个屏幕,提词器窗口会出现在视频中。我们会将它关闭,以免被录进去。你也可以保持打开,但它会被录制下来。",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "好的,关闭",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "保持显示",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "不再显示",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "摄像头窗口将关闭",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "你正在录制整个屏幕,摄像头窗口会出现在视频中。我们会将其关闭,避免被录进去。你的摄像头仍会被录制。",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "清除讲稿",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "再次点击以清除",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "将摄像头移到页面",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "将摄像头移到此处",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "显示讲稿",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "请先在页面上点击“开始录制”一次,以便 Chrome 请求屏幕捕获权限。",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "区域录制必须从页面开始",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/_locales/zh_TW/messages.json b/src/_locales/zh_TW/messages.json
index e48c152..edd8953 100644
--- a/src/_locales/zh_TW/messages.json
+++ b/src/_locales/zh_TW/messages.json
@@ -1085,13 +1085,29 @@
"message": "如果您要錄製電腦音訊請確保您啟用「分享系統音訊」選項。如果您沒有看到這個選項,請嘗試更新 Chrome 或是改為使用分頁錄製。",
"description": "Other audio warning description"
},
- "maxResolutionLabel": {
- "message": "最大解析度",
- "description": "Max resolution label in settings menu"
+ "qualityLabel": {
+ "message": "畫質",
+ "description": "設定選單中的畫質標籤"
},
- "maxFPSLabel": {
- "message": "最大幀率",
- "description": "Max FPS label in settings menu"
+ "qualityAutoLabel": {
+ "message": "自動",
+ "description": "設定選單中的自動畫質選項"
+ },
+ "qualityCustomLabel": {
+ "message": "自訂",
+ "description": "手動選擇解析度或幀率時顯示"
+ },
+ "smootherMotionLabel": {
+ "message": "優先確保動作更流暢",
+ "description": "畫質設定中的開關,優先考慮更流暢的影片而非清晰度"
+ },
+ "resolutionGroupLabel": {
+ "message": "解析度",
+ "description": "解析度選項上方的標題"
+ },
+ "frameRateGroupLabel": {
+ "message": "影格率",
+ "description": "幀率選項上方的標題"
},
"notEnoughRAM": {
"message": "記憶體不足",
@@ -1904,5 +1920,141 @@
"unsavedRecordingModalDismiss": {
"message": "不再顯示",
"description": "Side button: start the recording and stop prompting about unsaved recordings."
+ },
+ "teleprompterLabel": {
+ "message": "提詞機",
+ "description": "Switch label: opens the floating teleprompter window"
+ },
+ "teleprompterUnavailableLabel": {
+ "message": "提詞機(此頁面無法使用)",
+ "description": "Switch label shown when the page cannot open the teleprompter window"
+ },
+ "teleprompterIntroTitle": {
+ "message": "提詞機的運作方式",
+ "description": "Modal title shown the first time the teleprompter is switched on"
+ },
+ "teleprompterIntroDescription": {
+ "message": "你的講稿會在一個浮動視窗中開啟。分享視窗或分頁、錄製某個區域或只錄製攝影機時,該視窗不會出現在錄影中。如果分享整個螢幕,視窗會出現在影片裡,所以開始時會將它關閉。你的講稿一律會被儲存。",
+ "description": "Modal body: where the script window shows and when it closes"
+ },
+ "teleprompterClosedToast": {
+ "message": "已關閉提詞機,避免被錄進影片",
+ "description": "Toast: the teleprompter window was closed because the whole screen is being recorded"
+ },
+ "teleprompterPlaceholder": {
+ "message": "輸入或貼上你的講稿",
+ "description": "Placeholder in the empty teleprompter script box"
+ },
+ "teleprompterPlay": {
+ "message": "開始捲動",
+ "description": "Teleprompter button: start scrolling the script"
+ },
+ "teleprompterPause": {
+ "message": "暫停捲動",
+ "description": "Teleprompter button: pause scrolling the script"
+ },
+ "teleprompterMore": {
+ "message": "更多講稿選項",
+ "description": "Teleprompter button: open the script options menu"
+ },
+ "teleprompterTextSize": {
+ "message": "文字大小",
+ "description": "Teleprompter menu row: text size"
+ },
+ "teleprompterSpeed": {
+ "message": "速度",
+ "description": "Teleprompter menu row: scroll speed"
+ },
+ "teleprompterSmaller": {
+ "message": "縮小文字",
+ "description": "Teleprompter button: decrease text size"
+ },
+ "teleprompterLarger": {
+ "message": "放大文字",
+ "description": "Teleprompter button: increase text size"
+ },
+ "teleprompterSlower": {
+ "message": "更慢",
+ "description": "Teleprompter button: scroll slower"
+ },
+ "teleprompterFaster": {
+ "message": "更快",
+ "description": "Teleprompter button: scroll faster"
+ },
+ "teleprompterWpmUnit": {
+ "message": "字/分鐘",
+ "description": "Unit shown after the scroll speed, words per minute"
+ },
+ "teleprompterScrollOnStart": {
+ "message": "開始錄製時自動捲動",
+ "description": "Teleprompter menu option: start scrolling when the recording starts"
+ },
+ "teleprompterRewind": {
+ "message": "捲動回頂端",
+ "description": "Teleprompter menu option: scroll the script back to the top"
+ },
+ "teleprompterHide": {
+ "message": "隱藏講稿",
+ "description": "Teleprompter menu option: close the teleprompter window"
+ },
+ "teleprompterPlayDisabled": {
+ "message": "開始錄製後會自動捲動",
+ "description": "Tooltip on the disabled teleprompter play button before recording starts"
+ },
+ "teleprompterFullScreenTitle": {
+ "message": "提詞機將會關閉",
+ "description": "Modal title: the teleprompter window is about to be closed because the whole screen is recorded"
+ },
+ "teleprompterFullScreenDescription": {
+ "message": "你正在錄製整個螢幕,提詞機視窗會出現在影片中。我們會將它關閉,以免被錄進去。你也可以保持開啟,但它會被錄製下來。",
+ "description": "Modal body: why the teleprompter window closes when recording the entire screen"
+ },
+ "teleprompterFullScreenClose": {
+ "message": "好,關閉",
+ "description": "Modal button: close the teleprompter window and start recording"
+ },
+ "teleprompterFullScreenKeep": {
+ "message": "保持顯示",
+ "description": "Modal button: keep the teleprompter window open even though it will be recorded"
+ },
+ "teleprompterFullScreenNever": {
+ "message": "不要再顯示",
+ "description": "Modal side button: close the teleprompter window and do not show this modal again"
+ },
+ "cameraFullScreenTitle": {
+ "message": "攝影機視窗將關閉",
+ "description": "Modal title: the camera window is about to be closed because the whole screen is recorded"
+ },
+ "cameraFullScreenDescription": {
+ "message": "你正在錄製整個螢幕,攝影機視窗會出現在影片中。我們會將其關閉,避免被錄進去。你的攝影機仍會被錄製。",
+ "description": "Modal body: why the camera window closes when recording the entire screen"
+ },
+ "teleprompterClear": {
+ "message": "清除講稿",
+ "description": "Script menu item: empty the script"
+ },
+ "teleprompterClearConfirm": {
+ "message": "再點一次以清除",
+ "description": "Script menu item after the first click: asks for a second click to empty the script"
+ },
+ "teleprompterHideCamera": {
+ "message": "將攝影機移到頁面",
+ "description": "Teleprompter menu option: move the camera picture out of this window and back onto the page"
+ },
+ "teleprompterShowCamera": {
+ "message": "將攝影機移到此處",
+ "description": "Teleprompter menu option: move the camera picture from the page into this window"
+ },
+ "teleprompterShow": {
+ "message": "顯示講稿",
+ "description": "Teleprompter menu option: show the script in the floating window"
+ },
+ "pressRecordOnPageToast": {
+ "message": "請先在頁面上點擊「開始錄製」一次,以便 Chrome 請求螢幕擷取權限。",
+ "description": "Toast shown when Record was pressed in the floating window and Chrome still needs a click on the page to ask for screen capture access"
+ },
+ "teleprompterRegionStartOnPage": {
+ "message": "區域錄製必須從頁面開始",
+ "description": "Tooltip on the disabled Start button in the floating teleprompter window when recording a region, which can only be started from the page"
}
}
diff --git a/src/manifest.json b/src/manifest.json
index 6cc4cc8..15136ec 100755
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -3,7 +3,7 @@
"name": "__MSG_extName__",
"description": "__MSG_extDesc__",
"default_locale": "en",
- "version": "4.6.12",
+ "version": "4.7.0",
"background": {
"service_worker": "background.bundle.js"
},
@@ -99,6 +99,9 @@
},
"toggle-cursor-mode": {
"description": "Toggle cursor options"
+ },
+ "toggle-mic": {
+ "description": "Toggle microphone"
}
},
"permissions": [
diff --git a/src/media/avcLevel.ts b/src/media/avcLevel.ts
new file mode 100644
index 0000000..e079aca
--- /dev/null
+++ b/src/media/avcLevel.ts
@@ -0,0 +1,82 @@
+// Picks the AVC level string for a frame size. The ladder declares High L4.2
+// (avc1.64002A) and Baseline L4.0 (avc1.42E028), but Chrome rejects a configure()
+// whose coded area exceeds the declared level's MaxFS, so anything above 1080p
+// needs a higher level. No imports on purpose: the gate and the recorder both
+// pull this in, and the unit tests transpile it alone.
+// Tests: tests/unit/avcLevel.test.mjs
+
+// L4.2 MaxFS 8704 macroblocks * 256. 1080p (1920x1088 coded) is 2,088,960.
+export const AVC_L42_MAX_CODED_AREA = 2_228_224;
+
+// L5.1 MaxFS 36864 macroblocks * 256 (4096x2304). Same as AVC_MAX_PIXELS.
+export const AVC_L51_MAX_CODED_AREA = 9_437_184;
+
+const LEVEL_5_1 = 0x33;
+
+const AVC_CODEC_RE = /^avc1\.([0-9a-f]{4})([0-9a-f]{2})$/i;
+
+// H.264 codes frames in 16x16 macroblocks, so 1080p is coded as 1088 rows.
+export const avcCodedArea = (width: number, height: number): number => {
+ if (!(width > 0) || !(height > 0)) return 0;
+ return Math.ceil(width / 16) * 16 * (Math.ceil(height / 16) * 16);
+};
+
+export const exceedsAvcL42 = (width: number, height: number): boolean =>
+ avcCodedArea(width, height) > AVC_L42_MAX_CODED_AREA;
+
+// L4.2 and L5.1 MaxMBPS (macroblocks per second). The level also bounds frame
+// rate, so 4K60 needs 5.2 even though its frame size already fits 5.1.
+const AVC_L42_MAX_MBPS = 522_240;
+const AVC_L51_MAX_MBPS = 983_040;
+
+const LEVEL_5_2 = 0x34;
+
+const avcMacroblocksPerSecond = (
+ width: number,
+ height: number,
+ fps: number
+): number => {
+ if (!(width > 0) || !(height > 0) || !(fps > 0)) return 0;
+ return Math.ceil(width / 16) * Math.ceil(height / 16) * fps;
+};
+
+// Raises only the level byte when the frame is too big or too fast for the
+// declared one. Fitting frames and non-avc1 codecs come back untouched. fps
+// defaults to 30, which keeps every existing caller's result.
+export const avcCodecForSize = (
+ codec: string,
+ width: number,
+ height: number,
+ fps: number = 30
+): string => {
+ const match = AVC_CODEC_RE.exec(codec || "");
+ if (!match) return codec;
+ let required = exceedsAvcL42(width, height) ? LEVEL_5_1 : 0;
+ const mbps = fps > 30 ? avcMacroblocksPerSecond(width, height, fps) : 0;
+ if (mbps > AVC_L51_MAX_MBPS) required = LEVEL_5_2;
+ else if (mbps > AVC_L42_MAX_MBPS) required = Math.max(required, LEVEL_5_1);
+ if (!required) return codec;
+ const level = parseInt(match[2], 16);
+ if (level >= required) return codec;
+ return `avc1.${match[1]}${required.toString(16).toUpperCase()}`;
+};
+
+export type LargeFrameSupport = {
+ supports1440p?: boolean;
+ supports4k?: boolean;
+};
+
+const AREA_1440P = 2560 * 1440;
+
+// True only when the gate probe positively said this size cannot be encoded.
+// Unknown (probe cached before the large-frame checks existed) is not a reason
+// to leave WebCodecs.
+export const largeFrameKnownUnsupported = (
+ width: number,
+ height: number,
+ support: LargeFrameSupport | null | undefined
+): boolean => {
+ if (!support || !exceedsAvcL42(width, height)) return false;
+ if (width * height <= AREA_1440P) return support.supports1440p === false;
+ return support.supports4k === false;
+};
diff --git a/src/media/fastRecorderGate.ts b/src/media/fastRecorderGate.ts
index 7f2d9c7..29e37a8 100644
--- a/src/media/fastRecorderGate.ts
+++ b/src/media/fastRecorderGate.ts
@@ -1,3 +1,5 @@
+import { avcCodecForSize } from "./avcLevel";
+
declare const chrome: any;
// mediabunny is ~3MB; defer until validateFastRecorderOutputBlob runs.
@@ -40,7 +42,7 @@ const STORAGE_KEYS = {
inUse: "fastRecorderInUse",
};
-const GATE_VERSION = "ladder-v1";
+const GATE_VERSION = "ladder-v2";
const getFastRecDebug = () => {
try {
@@ -132,6 +134,9 @@ const TRANSIENT_ERROR_PATTERNS = [
// stop() raced with an in-flight encode/flush.
/encoder.*closed/i,
/encoder is closed/i,
+ // Start failed after the reclaim retries: another app (Zoom, Teams, OBS)
+ // holds the encoder. Contention, not a defect on this device.
+ /another app appears to be using the video encoder/i,
];
export const isTransientFastRecorderError = (errorString: string) => {
@@ -140,6 +145,8 @@ export const isTransientFastRecorderError = (errorString: string) => {
};
const isTransientError = isTransientFastRecorderError;
+export const RESOLUTION_UNSUPPORTED_CODE = "webcodecs-resolution-unsupported";
+
// 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 = (
@@ -148,6 +155,8 @@ export const isFastRecorderFailureTransient = (
detail: any
): boolean => {
if (isTransientFastRecorderError(errorString)) return true;
+ // This frame size cannot be encoded; 1080p still can, so don't sticky-disable.
+ if (reasonCode === RESOLUTION_UNSUPPORTED_CODE) return true;
if (
reasonCode === "webcodecs-zero-frames-at-stop" &&
detail &&
@@ -449,6 +458,52 @@ export const prewarmFastRecorderProbe = (): void => {
void probeFastRecorderSupport().catch(() => {});
};
+// The 720p/1080p ladder says nothing about frames above L4.2's coded-area limit
+// (1440p, 4K). Informational: a miss must never take WebCodecs away from 1080p,
+// so it feeds details, not reasons.
+const LARGE_FRAME_PROBES = [
+ { key: "supports1440p", width: 2560, height: 1440, bitrate: 10_000_000 },
+ { key: "supports4k", width: 3840, height: 2160, bitrate: 24_000_000 },
+] as const;
+
+const probeLargeFrameSupport = async (
+ base: VideoEncoderConfig
+): Promise<Record<string, any>> => {
+ const out: Record<string, any> = {};
+ for (const probe of LARGE_FRAME_PROBES) {
+ const attempts: Array<{ codec: string; hw: string; supported: boolean }> = [];
+ let selected: VideoEncoderConfig | null = null;
+ for (const baseCodec of ["avc1.64002A", "avc1.42E028"]) {
+ const codec = avcCodecForSize(baseCodec, probe.width, probe.height);
+ for (const hw of ["prefer-hardware", "prefer-software", "no-preference"]) {
+ const config: any = {
+ ...base,
+ codec,
+ width: probe.width,
+ height: probe.height,
+ bitrate: probe.bitrate,
+ hardwareAcceleration: hw,
+ };
+ let supported = false;
+ try {
+ const support = await VideoEncoder.isConfigSupported(config);
+ supported = Boolean(support?.supported);
+ if (supported) selected = support?.config || config;
+ } catch {
+ supported = false;
+ }
+ attempts.push({ codec, hw, supported });
+ if (selected) break;
+ }
+ if (selected) break;
+ }
+ out[probe.key] = Boolean(selected);
+ out[`${probe.key}Config`] = selected;
+ out[`${probe.key}Attempts`] = attempts;
+ }
+ return out;
+};
+
const _probeFastRecorderSupportUncached = async (): Promise<FastRecorderProbeResult> => {
try {
debugLog("probe start", GATE_VERSION, Date.now());
@@ -586,6 +641,10 @@ const _probeFastRecorderSupportUncached = async (): Promise<FastRecorderProbeRes
reasons.push("video-config-unsupported");
}
+ if (selectedVideoConfig && hasVideoEncoder) {
+ Object.assign(details, await probeLargeFrameSupport(baseVideoConfig));
+ }
+
if (hasAudioEncoder && typeof AudioEncoder.isConfigSupported === "function") {
try {
const support = await AudioEncoder.isConfigSupported(audioConfig);
diff --git a/src/pages/Background/alarms/handleAlarm.js b/src/pages/Background/alarms/handleAlarm.js
index 357e3ad..4940e4e 100644
--- a/src/pages/Background/alarms/handleAlarm.js
+++ b/src/pages/Background/alarms/handleAlarm.js
@@ -128,11 +128,13 @@ export const handleAlarm = async (alarm) => {
]);
if (!(snap.recording || snap.pendingRecording) || !snap.recordingTab) {
await chrome.alarms.clear(RECORDER_KEEPALIVE_ALARM);
- await chrome.storage.local.set({
- recordingStallLevel: 0,
- firstChunkAt: null,
- lastChunkAt: null,
- });
+ // A live offscreen take has no recordingTab. Its stamps are what the
+ // dead-host check in resumePendingUploads compares, so keep them.
+ await chrome.storage.local.set(
+ snap.recording || snap.pendingRecording
+ ? {}
+ : { recordingStallLevel: 0, firstChunkAt: null, lastChunkAt: null },
+ );
// Backstop: the session is over. Remove any recorder tab still
// alive; a final guard if both the recorder's own abandonment
// listener and the teardown sweep somehow missed it. Gated on no
diff --git a/src/pages/Background/auth/loginWithWebsite.js b/src/pages/Background/auth/loginWithWebsite.js
index 0e9e8e8..315853a 100644
--- a/src/pages/Background/auth/loginWithWebsite.js
+++ b/src/pages/Background/auth/loginWithWebsite.js
@@ -1,4 +1,5 @@
import { getCurrentTab, sendMessageTab } from "../tabManagement";
+import { flagUpdatesFromUser } from "./serverFlags";
const API_BASE = process.env.SCREENITY_API_BASE_URL;
const CLOUD_FEATURES_ENABLED =
@@ -149,7 +150,6 @@ export const loginWithWebsite = async (arg = {}) => {
? {
backgroundEffectsActive: false,
backgroundEffect: "",
- fpsValue: "30",
}
: {}),
});
@@ -186,6 +186,7 @@ export const loginWithWebsite = async (arg = {}) => {
responseData;
await chrome.storage.local.set({
+ ...flagUpdatesFromUser(user, { subscribed: subscribed === true }),
screenityUser: user,
lastAuthCheck: now,
isLoggedIn: true,
@@ -201,7 +202,6 @@ export const loginWithWebsite = async (arg = {}) => {
? {
backgroundEffectsActive: false,
backgroundEffect: "",
- fpsValue: "30",
}
: {}),
});
@@ -292,7 +292,6 @@ export const loginWithWebsite = async (arg = {}) => {
? {
backgroundEffectsActive: false,
backgroundEffect: "",
- fpsValue: "30",
}
: {}),
});
diff --git a/src/pages/Background/auth/serverFlags.js b/src/pages/Background/auth/serverFlags.js
new file mode 100644
index 0000000..f8d18fe
--- /dev/null
+++ b/src/pages/Background/auth/serverFlags.js
@@ -0,0 +1,30 @@
+// Server-controlled flags carried in the /auth/verify response, mirrored into
+// chrome.storage.local so the recorders can read them without a network call.
+// A flag the server does not send is left as it is, so an older server changes
+// nothing; to switch one off the server sends false.
+// Tests: tests/unit/serverFlags.test.mjs
+
+// verify field (under user.flags) -> storage key
+const FLAG_KEYS = {
+ cloud4kRecording: "cloud4kRecording",
+};
+
+// Account settings that only apply to subscribers. Non-subscribers keep their
+// own local switch, which a mirrored account value would overwrite.
+const SUBSCRIBER_FLAG_KEYS = {
+ smootherMotion: "smootherMotion",
+};
+
+export function flagUpdatesFromUser(user, { subscribed = false } = {}) {
+ const updates = {};
+ const flags = user?.flags;
+ if (!flags || typeof flags !== "object") return updates;
+ const copy = (map) => {
+ for (const [field, key] of Object.entries(map)) {
+ if (typeof flags[field] === "boolean") updates[key] = flags[field];
+ }
+ };
+ copy(FLAG_KEYS);
+ if (subscribed === true) copy(SUBSCRIBER_FLAG_KEYS);
+ return updates;
+}
diff --git a/src/pages/Background/index.js b/src/pages/Background/index.js
index 2bdfb78..500675c 100644
--- a/src/pages/Background/index.js
+++ b/src/pages/Background/index.js
@@ -15,6 +15,7 @@ import {
} from "../CloudRecorder/recorderStorage/opfsKvStore";
import { handleGetStreamingData } from "./recording/recordingHelpers";
import { initUninstallSurvey } from "./utils/uninstallSurvey";
+import { initRecorderHostWatch } from "./offscreen/hostWatch";
// 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
@@ -34,7 +35,6 @@ const clearStaleLocks = async () => {
restarting,
recordingTab,
offscreen,
- multiMode,
region,
recordingStartingAt,
} = await chrome.storage.local.get([
@@ -46,7 +46,6 @@ const clearStaleLocks = async () => {
"restarting",
"recordingTab",
"offscreen",
- "multiMode",
"region",
"recordingStartingAt",
]);
@@ -137,13 +136,6 @@ const clearStaleLocks = async () => {
}
}
- if (multiMode && !recording) {
- stale.multiMode = false;
- stale.multiSceneCount = 0;
- stale.multiProjectId = null;
- stale.multiLastSceneId = null;
- console.warn("[Screenity][BG] Stale multi-mode state found on startup, clearing");
- }
if (region && !recording) {
stale.region = false;
@@ -339,6 +331,7 @@ setupHandlers();
initCountdownFallback();
initKeepAwake();
initLifecycleObserver();
+initRecorderHostWatch();
initUninstallSurvey();
// Recovery must run AFTER clearStaleLocks: if the recorder tab died
diff --git a/src/pages/Background/listeners/onActionButtonClickedListener.js b/src/pages/Background/listeners/onActionButtonClickedListener.js
index ebdb4dc..fedf5ef 100644
--- a/src/pages/Background/listeners/onActionButtonClickedListener.js
+++ b/src/pages/Background/listeners/onActionButtonClickedListener.js
@@ -15,6 +15,8 @@ import { traceStep } from "../../utils/startFlowTrace";
const CLOUD_FEATURES_ENABLED =
process.env.SCREENITY_ENABLE_CLOUD_FEATURES === "true";
+const PENDING_START_STALE_MS = 45_000;
+
const handleTabMessaging = async (tab) => {
const { activeTab, recordingUiTabId, offscreen } =
await chrome.storage.local.get([
@@ -26,13 +28,13 @@ const handleTabMessaging = async (tab) => {
if (offscreen) {
try {
await sendMessageRecord({ type: "stop-recording-tab", reason: "action-click" });
- return;
+ return true;
} catch (err) {
console.error(
"[Screenity][ActionClick] offscreen stop-recording send failed:",
err,
);
- return;
+ return false;
}
}
@@ -49,12 +51,15 @@ const handleTabMessaging = async (tab) => {
await sendMessageTab(tab.id, { type: "stop-recording-tab", reason: "action-click" });
chrome.storage.local.set({ activeTab: tab.id });
}
+ return true;
} catch (error) {
console.error("[Screenity][ActionClick] handleTabMessaging failed, trying direct recorder stop:", error);
try {
await sendMessageRecord({ type: "stop-recording-tab", reason: "action-click" });
+ return true;
} catch (recorderErr) {
console.error("[Screenity][ActionClick] direct recorder stop also failed:", recorderErr);
+ return false;
}
}
};
@@ -65,7 +70,7 @@ const openPlaygroundOrPopup = async (tab) => {
if (tab.url && editorUrlPattern.test(tab.url)) {
const match = tab.url.match(editorUrlPattern);
- const projectIdFromUrl = match?.[2] || null;
+ const projectIdFromUrl = match?.[1] || null;
await setEditorTabReference({
tabId: tab.id,
tabUrl: tab.url,
@@ -176,7 +181,7 @@ export const onActionButtonClickedListener = () => {
runMicRecoveryScan().catch(() => {});
try {
const snap = await chrome.storage.local.get([
- "recording", "pendingRecording", "restarting", "recorderSession",
+ "recording", "pendingRecording", "pendingRecordingAt", "restarting", "recorderSession",
"recordingTab", "offscreen",
"postStopEditorOpening", "postStopEditorOpened",
"editorRecoveryUrl",
@@ -248,6 +253,30 @@ export const onActionButtonClickedListener = () => {
}
}
+ // A start that never reached recording (picker cancelled) leaves
+ // pendingRecording set. The page ignores stop while not recording and
+ // the start guard refuses a new start, so reset once the window passes.
+ const pendingAgeMs = Date.now() - (Number(snap.pendingRecordingAt) || 0);
+ if (
+ pendingRecording &&
+ !recording &&
+ !restarting &&
+ !sessionRecording &&
+ pendingAgeMs > PENDING_START_STALE_MS
+ ) {
+ hasActiveRecorder = false;
+ }
+
+ let stopDelivered = true;
+ if (hasActiveRecorder) {
+ console.log("[Screenity][ActionClick] branch: handle-tab-messaging (active recorder)");
+ stopDelivered = await handleTabMessaging(tab);
+ // No receiver answered a pending-only start: the flag is stale.
+ if (!stopDelivered && pendingRecording && !recording && !sessionRecording) {
+ hasActiveRecorder = false;
+ }
+ }
+
if (!hasActiveRecorder) {
console.warn(
"[Screenity][ActionClick] branch: stale-reset-then-popup.",
@@ -270,9 +299,6 @@ export const onActionButtonClickedListener = () => {
.sendMessage({ type: "clear-recording-session-safe", reason: "action-button-stale-reset" })
.catch(() => {});
await openPlaygroundOrPopup(tab);
- } else {
- console.log("[Screenity][ActionClick] branch: handle-tab-messaging (active recorder)");
- await handleTabMessaging(tab);
}
} else {
console.log("[Screenity][ActionClick] branch: normal-popup");
diff --git a/src/pages/Background/listeners/onCommandListener.js b/src/pages/Background/listeners/onCommandListener.js
index 1918bef..3694adc 100644
--- a/src/pages/Background/listeners/onCommandListener.js
+++ b/src/pages/Background/listeners/onCommandListener.js
@@ -60,7 +60,8 @@ export const onCommandListener = () => {
} else if (
command === "cancel-recording" ||
command === "pause-recording" ||
- command === "stop-recording"
+ command === "stop-recording" ||
+ command === "toggle-mic"
) {
// Recording controls must reach the recording UI tab (the pill + its
// content-script handlers), not the focused tab. With offscreen
@@ -77,7 +78,9 @@ export const onCommandListener = () => {
? { type: "cancel-recording" }
: command === "pause-recording"
? { type: "pause-recording" }
- : { type: "stop-recording-tab", reason: "shortcut-stop" };
+ : command === "toggle-mic"
+ ? { type: "toggle-mic" }
+ : { type: "stop-recording-tab", reason: "shortcut-stop" };
try {
await sendMessageTab(targetTabId, msg);
} catch (err) {
diff --git a/src/pages/Background/listeners/onMessageExternalListener.js b/src/pages/Background/listeners/onMessageExternalListener.js
index 63c8d7c..423d93f 100644
--- a/src/pages/Background/listeners/onMessageExternalListener.js
+++ b/src/pages/Background/listeners/onMessageExternalListener.js
@@ -6,7 +6,10 @@ import {
clearEditorTabReference,
} from "../tabManagement";
import { loginWithWebsite } from "../auth/loginWithWebsite";
-import { handleFinishMultiRecording } from "../messaging/handlers";
+import {
+ handleFinishMultiRecording,
+ submitStageDiagnosticReport,
+} from "../messaging/handlers";
const CLOUD_FEATURES_ENABLED =
process.env.SCREENITY_ENABLE_CLOUD_FEATURES === "true";
@@ -15,7 +18,107 @@ export const onMessageExternalListener = () => {
if (!CLOUD_FEATURES_ENABLED) return;
chrome.runtime.onMessageExternal.addListener(
- async (message, sender, sendResponse) => {
+ (message, sender, sendResponse) => {
+ // Return true synchronously to keep sendResponse alive across awaits.
+ if (message?.type === "OPEN_POPUP_PROJECT") {
+ handleOpenPopupProject(message).then(sendResponse);
+ return true;
+ }
+ handleExternalMessage(message, sender, sendResponse)
+ .catch((err) => console.warn("External message failed:", err))
+ .finally(() => {
+ try {
+ sendResponse();
+ } catch {}
+ });
+ return true;
+ },
+ );
+};
+
+const reportStage = (stage, extra = {}) =>
+ submitStageDiagnosticReport({
+ attemptId: `op-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`,
+ trigger: "error",
+ outcome: "error",
+ stage,
+ ...extra,
+ });
+
+const handleOpenPopupProject = async (message) => {
+ try {
+ const tab = await getCurrentTab();
+ if (!tab?.id) {
+ console.warn("No active tab found for popup reopen");
+ reportStage("no-active-tab");
+ return { ok: false, stage: "no-active-tab" };
+ }
+
+ await chrome.storage.local.set({
+ recordingProjectTitle: message.recordingProjectTitle,
+ recordingToScene: true,
+ instantMode: false,
+ projectId: message.projectId,
+ activeSceneId: message.activeSceneId,
+ });
+
+ const parsedTarget = parseEditorTargetUrl(tab.url);
+ if (parsedTarget?.projectId === message.projectId) {
+ await setEditorTabReference({
+ tabId: tab.id,
+ tabUrl: tab.url,
+ source: "webapp-open-popup-project",
+ expectedProjectId: message.projectId,
+ });
+ } else {
+ await clearEditorTabReference("webapp-open-popup-project-not-editor", {
+ tabId: tab.id,
+ tabUrl: tab.url,
+ expectedProjectId: message.projectId,
+ });
+ }
+
+ const result = await loginWithWebsite({ force: true });
+
+ if (!result?.authenticated) {
+ const currentTab = await getCurrentTab();
+ if (currentTab?.id) {
+ await chrome.storage.local.set({ originalTabId: currentTab.id });
+ }
+
+ chrome.tabs.create({
+ url: `${process.env.SCREENITY_APP_BASE}/login?extension=true`,
+ active: true,
+ });
+ return { ok: false, stage: "login-required" };
+ }
+
+ try {
+ await sendMessageTab(tab.id, {
+ type: "open-popup-project",
+ projectTitle: message.recordingProjectTitle,
+ projectId: message.projectId,
+ activeSceneId: message.activeSceneId,
+ recordingToScene: true,
+ });
+ } catch (err) {
+ // Content handler may not reply; a closed port still means delivered.
+ if (!String(err).includes("message port closed before a response")) {
+ console.warn("Failed to send popup project message:", err);
+ reportStage("send-tab-failed");
+ return { ok: false, stage: "send-tab-failed" };
+ }
+ }
+ return { ok: true, stage: "delivered" };
+ } catch (err) {
+ console.warn("Failed to open popup project:", err);
+ reportStage("handler-threw");
+ return { ok: false, stage: "handler-threw" };
+ }
+};
+
+const handleExternalMessage = (message, sender, sendResponse) =>
+ (async () => {
if (message.type === "AUTH_SUCCESS" && message.token) {
const { stayLoggedOut } = await chrome.storage.local.get([
"stayLoggedOut",
@@ -89,63 +192,6 @@ export const onMessageExternalListener = () => {
]);
return true;
- } else if (message.type === "OPEN_POPUP_PROJECT") {
- try {
- const tab = await getCurrentTab();
- if (!tab?.id) {
- console.warn("No active tab found for popup reopen");
- return;
- }
-
- await chrome.storage.local.set({
- recordingProjectTitle: message.recordingProjectTitle,
- recordingToScene: true,
- instantMode: false,
- projectId: message.projectId,
- activeSceneId: message.activeSceneId,
- });
-
- const parsedTarget = parseEditorTargetUrl(tab.url);
- if (parsedTarget?.projectId === message.projectId) {
- await setEditorTabReference({
- tabId: tab.id,
- tabUrl: tab.url,
- source: "webapp-open-popup-project",
- expectedProjectId: message.projectId,
- });
- } else {
- await clearEditorTabReference("webapp-open-popup-project-not-editor", {
- tabId: tab.id,
- tabUrl: tab.url,
- expectedProjectId: message.projectId,
- });
- }
-
- const result = await loginWithWebsite({ force: true });
-
- if (!result?.authenticated) {
- const currentTab = await getCurrentTab();
- if (currentTab?.id) {
- await chrome.storage.local.set({ originalTabId: currentTab.id });
- }
-
- chrome.tabs.create({
- url: `${process.env.SCREENITY_APP_BASE}/login?extension=true`,
- active: true,
- });
- return;
- }
-
- await sendMessageTab(tab.id, {
- type: "open-popup-project",
- projectTitle: message.recordingProjectTitle,
- projectId: message.projectId,
- activeSceneId: message.activeSceneId,
- recordingToScene: true,
- });
- } catch (err) {
- console.warn("Failed to send popup project message:", err);
- }
} else if (message.type === "GET_PROJECT_INFO") {
const tab = await getCurrentTab();
if (!tab?.id) {
@@ -180,6 +226,4 @@ export const onMessageExternalListener = () => {
sendResponse({ success: true });
return true;
}
- }
- );
-};
+ })();
diff --git a/src/pages/Background/messaging/handlers.js b/src/pages/Background/messaging/handlers.js
index e27a2f6..6a0faa9 100644
--- a/src/pages/Background/messaging/handlers.js
+++ b/src/pages/Background/messaging/handlers.js
@@ -111,6 +111,62 @@ const markProjectPublic = async (projectId) => {
};
const CLOUD_FEATURES_ENABLED =
process.env.SCREENITY_ENABLE_CLOUD_FEATURES === "true";
+
+const postDiagnosticReport = async ({ trace, ...rest }) => {
+ const appBase = process.env.SCREENITY_APP_BASE;
+ if (!appBase) return;
+ const { screenityToken } = await chrome.storage.local.get("screenityToken");
+ if (!screenityToken) return;
+ const ua = navigator.userAgent || "";
+ const payload = {
+ ...rest,
+ extVersion: chrome.runtime.getManifest().version,
+ env: {
+ os: (await chrome.runtime.getPlatformInfo()).os || null,
+ browser: (ua.match(/Chrome\/\d+/) || [""])[0] || null,
+ },
+ trace,
+ };
+ fetch(`${appBase}/api/log/diagnostic-report`, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ Authorization: `Bearer ${screenityToken}`,
+ },
+ body: JSON.stringify(payload),
+ keepalive: true,
+ }).catch(() => {});
+};
+
+// For clicks that never started an attempt, so there is no startFlowTrace.
+export const submitStageDiagnosticReport = async (event = {}) => {
+ if (!CLOUD_FEATURES_ENABLED) return;
+ try {
+ const { projectId } = await chrome.storage.local.get("projectId");
+ await postDiagnosticReport({
+ attemptId: event.attemptId,
+ projectId: projectId || null,
+ trigger: event.trigger || "error",
+ trace: {
+ recordingType: event.recordingType || null,
+ surface: null,
+ isPro: true,
+ countdown: false,
+ outcome: event.outcome || "error",
+ t: { startStreaming: null },
+ routing: null,
+ error: null,
+ errorCode: null,
+ stuck: null,
+ stage: event.stage || null,
+ reason: event.reason || null,
+ pendingAgeMs: Number.isFinite(event.pendingAgeMs)
+ ? event.pendingAgeMs
+ : null,
+ },
+ });
+ } catch {}
+};
const DEBUG_POSTSTOP = false;
// Gate for the start-flow / stop-flow / offscreen-diag console mirrors.
// Off in prod by default; set globalThis.SCREENITY_DEBUG_RECORDER for support.
@@ -716,10 +772,13 @@ export const handleFinishMultiRecording = async () => {
});
} else {
// existing-project multi recording: only reuse editorTab if it still matches
- const { projectId, instantMode } = await chrome.storage.local.get([
+ const stored = await chrome.storage.local.get([
"projectId",
+ "multiProjectId",
"instantMode",
]);
+ const projectId = stored.projectId || stored.multiProjectId || null;
+ const instantMode = stored.instantMode;
const targetUrl = getEditorTargetUrl({
projectId,
instantMode: Boolean(instantMode),
@@ -1681,6 +1740,16 @@ export const setupHandlers = () => {
chrome.tabs.create({ url: editorRecoveryUrl, active: true });
});
registerMessage("recording-error", async (message) => {
+ // The recorder's 15s no-chunk watchdog sends this for a screen that is
+ // merely idle. It is a warning: tearing down here closed the recorder tab
+ // and cleared the project while the capture was still running.
+ if (message?.error === "stream-warning") {
+ diagEvent("warning", {
+ error: message.error,
+ why: message.why || null,
+ });
+ return;
+ }
await handleRecordingError(message);
await clearRecordingSessionSafe("recording-error", {
error: message?.error || null,
@@ -1896,6 +1965,7 @@ export const setupHandlers = () => {
},
);
registerMessage("submit-diagnostic-report", async (message) => {
+ if (message?.event) return submitStageDiagnosticReport(message.event);
try {
const appBase = process.env.SCREENITY_APP_BASE;
if (!appBase) return;
@@ -1910,17 +1980,11 @@ export const setupHandlers = () => {
const trigger = message?.trigger || "manual";
const isSuccess = trigger === "success-summary";
const trace = startFlowTrace;
- const ua = navigator.userAgent || "";
- const payload = {
+ await postDiagnosticReport({
attemptId: trace.attemptId,
projectId: projectId || null,
recordingSessionId: recorderSession?.id || null,
- extVersion: chrome.runtime.getManifest().version,
trigger,
- env: {
- os: (await chrome.runtime.getPlatformInfo()).os || null,
- browser: (ua.match(/Chrome\/\d+/) || [""])[0] || null,
- },
trace: isSuccess
? {
recordingType: trace.recordingType,
@@ -1938,16 +2002,7 @@ export const setupHandlers = () => {
stuck: null,
}
: trace,
- };
- fetch(`${appBase}/api/log/diagnostic-report`, {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- Authorization: `Bearer ${screenityToken}`,
- },
- body: JSON.stringify(payload),
- keepalive: true,
- }).catch(() => {});
+ });
} catch {
}
});
diff --git a/src/pages/Background/offscreen/closeOffscreenDocument.js b/src/pages/Background/offscreen/closeOffscreenDocument.js
index 2b05313..7f48a4a 100644
--- a/src/pages/Background/offscreen/closeOffscreenDocument.js
+++ b/src/pages/Background/offscreen/closeOffscreenDocument.js
@@ -1,3 +1,4 @@
+import { noteOffscreenClose } from "./hostWatch";
export const closeOffscreenDocument = async () => {
try {
const existingContexts = await chrome.runtime.getContexts({});
@@ -6,6 +7,7 @@ export const closeOffscreenDocument = async () => {
);
if (offscreenDocument) {
+ noteOffscreenClose("close-offscreen");
await chrome.offscreen.closeDocument();
}
} catch (error) {
diff --git a/src/pages/Background/offscreen/closeOffscreenDocumentWithFlush.js b/src/pages/Background/offscreen/closeOffscreenDocumentWithFlush.js
index 658de1d..51195d5 100644
--- a/src/pages/Background/offscreen/closeOffscreenDocumentWithFlush.js
+++ b/src/pages/Background/offscreen/closeOffscreenDocumentWithFlush.js
@@ -1,7 +1,10 @@
+import { noteOffscreenClose, noteOffscreenCloseSkipped } from "./hostWatch";
export const closeOffscreenDocumentWithFlush = async ({
reason = "unknown",
timeoutMs = 25000,
shouldFinalize = true,
+ // closeDocument() closes whatever is current, which may be a newer recording's.
+ expectedDocumentId = null,
} = {}) => {
let offDoc = null;
try {
@@ -15,6 +18,15 @@ export const closeOffscreenDocumentWithFlush = async ({
if (!offDoc) return { ok: true, existed: false };
+ if (
+ expectedDocumentId &&
+ offDoc.documentId &&
+ offDoc.documentId !== expectedDocumentId
+ ) {
+ noteOffscreenCloseSkipped(`${reason}:replaced-before-flush`);
+ return { ok: true, existed: false, skipped: "replaced" };
+ }
+
// The long timeout only matters for an in-flight TUS upload (cloud). A free
// doc has no uploader, so waiting 25s for an ack it may never send just blocks
// the next picker. Cloud docs carry ?cloud=1 in their URL; free ones don't.
@@ -70,6 +82,22 @@ export const closeOffscreenDocumentWithFlush = async ({
cleanupAck();
try {
+ const nowContexts = await chrome.runtime.getContexts({});
+ const nowDoc =
+ nowContexts.find((c) => c.contextType === "OFFSCREEN_DOCUMENT") || null;
+ if (!nowDoc) return { ok: true, existed: true, ...result };
+ if (
+ offDoc.documentId &&
+ nowDoc.documentId &&
+ nowDoc.documentId !== offDoc.documentId
+ ) {
+ noteOffscreenCloseSkipped(`${reason}:replaced-during-flush`);
+ return { ok: true, existed: true, ...result, skipped: "replaced" };
+ }
+ } catch {}
+
+ try {
+ noteOffscreenClose("close-with-flush");
await chrome.offscreen.closeDocument();
} catch (err) {
console.warn("closeOffscreenDocumentWithFlush closeDocument:", err);
diff --git a/src/pages/Background/offscreen/createCloudRecorderOffscreen.js b/src/pages/Background/offscreen/createCloudRecorderOffscreen.js
index fcb15ff..269b8c1 100644
--- a/src/pages/Background/offscreen/createCloudRecorderOffscreen.js
+++ b/src/pages/Background/offscreen/createCloudRecorderOffscreen.js
@@ -1,3 +1,4 @@
+import { noteOffscreenClose } from "./hostWatch";
// Offscreen doc host for the recorder; immune to background-tab freeze/discard.
// ?cloud=1 renders <CloudRecorder/>, else <Recorder/>. Chrome allows only one
// offscreen doc per extension, so any existing one is closed first.
@@ -12,6 +13,7 @@ export const createCloudRecorderOffscreen = async ({ cloud = true } = {}) => {
(c) => c.contextType === "OFFSCREEN_DOCUMENT",
);
if (hasOffscreen) {
+ noteOffscreenClose("create-preclose");
await chrome.offscreen.closeDocument();
}
} catch (err) {
diff --git a/src/pages/Background/offscreen/discardOffscreenDocuments.js b/src/pages/Background/offscreen/discardOffscreenDocuments.js
index d42dfc4..8a23c9d 100644
--- a/src/pages/Background/offscreen/discardOffscreenDocuments.js
+++ b/src/pages/Background/offscreen/discardOffscreenDocuments.js
@@ -1,5 +1,6 @@
import { closeOffscreenDocumentWithFlush } from "./closeOffscreenDocumentWithFlush";
import { perfSpan } from "../../utils/perfMarks";
+import { noteOffscreenClose, noteOffscreenCloseSkipped } from "./hostWatch";
// The separated mic uploads from inside the offscreen document after the scene
// POST, but the BG discards that document ~80ms later on editor-ready, killing
@@ -40,17 +41,51 @@ export const discardOffscreenDocuments = async ({
} = {}) => {
console.warn("[Screenity][discardOffscreenDocuments]", { reason, flush, shouldFinalize, stack: new Error().stack });
const endFlush = perfSpan("BG.offscreen discardOffscreenDocuments", { reason, flush });
+ // The mic wait below can outlast a new recording's start, so pin the document.
+ let expectedDocumentId = null;
+ let contextsRead = false;
+ try {
+ const ctx = await chrome.runtime.getContexts({});
+ expectedDocumentId =
+ ctx.find((c) => c.contextType === "OFFSCREEN_DOCUMENT")?.documentId ||
+ null;
+ contextsRead = true;
+ } catch {}
// Discard/cancel must not wait on the take it is throwing away.
if (shouldFinalize) await waitForMicUpload();
+ // No document at discard start, so one now is a new take's.
+ let startedAfterDiscard = false;
+ if (contextsRead && !expectedDocumentId) {
+ try {
+ const ctx = await chrome.runtime.getContexts({});
+ startedAfterDiscard = ctx.some(
+ (c) => c.contextType === "OFFSCREEN_DOCUMENT"
+ );
+ } catch {}
+ }
try {
- if (flush) {
- await closeOffscreenDocumentWithFlush({ reason, shouldFinalize });
+ if (startedAfterDiscard) {
+ noteOffscreenCloseSkipped("discard:replaced");
+ } else if (flush) {
+ await closeOffscreenDocumentWithFlush({
+ reason,
+ shouldFinalize,
+ expectedDocumentId,
+ });
} else {
const existingContexts = await chrome.runtime.getContexts({});
const offscreenDocument = existingContexts.find(
(c) => c.contextType === "OFFSCREEN_DOCUMENT"
);
- if (offscreenDocument) {
+ if (
+ offscreenDocument &&
+ expectedDocumentId &&
+ offscreenDocument.documentId &&
+ offscreenDocument.documentId !== expectedDocumentId
+ ) {
+ noteOffscreenCloseSkipped("discard-noflush:replaced");
+ } else if (offscreenDocument) {
+ noteOffscreenClose("discard-noflush");
await chrome.offscreen.closeDocument();
}
}
diff --git a/src/pages/Background/offscreen/ensureRemuxOffscreen.js b/src/pages/Background/offscreen/ensureRemuxOffscreen.js
index d2bf481..bbf08aa 100644
--- a/src/pages/Background/offscreen/ensureRemuxOffscreen.js
+++ b/src/pages/Background/offscreen/ensureRemuxOffscreen.js
@@ -1,3 +1,4 @@
+import { noteOffscreenClose } from "./hostWatch";
/*
* Creates or reuses the remux offscreen document. Chrome only permits one
* offscreen document per extension; if a different offscreen (audio beeps,
@@ -54,6 +55,7 @@ const ensureRemuxOffscreenImpl = async () => {
}
// A different offscreen (audio beep / upload resume): close it and proceed.
try {
+ noteOffscreenClose("remux-preclose");
await chrome.offscreen.closeDocument();
} catch (err) {
console.warn("ensureRemuxOffscreen: closeDocument failed", err);
diff --git a/src/pages/Background/offscreen/hostWatch.js b/src/pages/Background/offscreen/hostWatch.js
new file mode 100644
index 0000000..d65c5dc
--- /dev/null
+++ b/src/pages/Background/offscreen/hostWatch.js
@@ -0,0 +1,87 @@
+// Passive breadcrumbs for a recorder document that vanishes mid-recording:
+// stamps why we closed the offscreen doc, reports disconnects we didn't cause.
+import { emitRecordingTelemetry } from "../recording/emitRecordingTelemetry";
+
+const PORT_NAME = "recorder-host";
+const INTENT_WINDOW_MS = 15000;
+// Literal copy of RESUME_RETRY_ALARM (resumePendingUploads.js) to keep this module
+// dependency-light for its tests. Fires past DEAD_HOST_QUIET_MS.
+const RESUME_RETRY_ALARM = "resume-pending-uploads-retry";
+const RESUME_AFTER_LOST_MIN = 5.5;
+const STATE_KEYS = [
+ "recording",
+ "pendingRecording",
+ "firstChunkAt",
+ "lastChunkAt",
+];
+
+let lastIntent = null;
+
+const ageS = (t) => (t ? Math.round((Date.now() - t) / 1000) : "na");
+
+const docKind = (url) => {
+ if (!url) return "none";
+ if (url.includes("resume=1")) return "resume";
+ return url.includes("cloud=1") ? "cloud" : "plain";
+};
+
+// Only during a live recording: emitRecordingTelemetry falls back to the last
+// stored session, which would tag an unrelated one once recording is over.
+const emit = async (name, reason, statePromise, contextsPromise) => {
+ try {
+ const s = await (statePromise || chrome.storage.local.get(STATE_KEYS));
+ if (!(s.recording || s.pendingRecording)) return;
+ let kind = "na";
+ if (contextsPromise) {
+ const ctx = await contextsPromise.catch(() => null);
+ kind = docKind(ctx?.[0]?.documentUrl);
+ }
+ void emitRecordingTelemetry("recording_forensic_event", {
+ name,
+ reason,
+ errMsg: `rec=${s.recording ? 1 : 0} pend=${s.pendingRecording ? 1 : 0} first=${ageS(
+ s.firstChunkAt,
+ )}s last=${ageS(s.lastChunkAt)}s doc=${kind}`,
+ });
+ } catch {}
+};
+
+// Call right before closeDocument(). Reads are issued now and awaited later so
+// the close isn't delayed.
+export const noteOffscreenClose = (caller) => {
+ try {
+ lastIntent = { caller, at: Date.now() };
+ const statePromise = chrome.storage.local.get(STATE_KEYS);
+ const contextsPromise = chrome.runtime.getContexts({
+ contextTypes: ["OFFSCREEN_DOCUMENT"],
+ });
+ void emit("offscreen-close", caller, statePromise, contextsPromise);
+ } catch {}
+};
+
+export const noteOffscreenCloseSkipped = (caller) => {
+ try {
+ void emit(
+ "offscreen-close-skipped",
+ caller,
+ chrome.storage.local.get(STATE_KEYS),
+ chrome.runtime.getContexts({ contextTypes: ["OFFSCREEN_DOCUMENT"] }),
+ );
+ } catch {}
+};
+
+export const initRecorderHostWatch = () => {
+ chrome.runtime.onConnect.addListener((port) => {
+ if (port.name !== PORT_NAME) return;
+ if (docKind(port.sender?.url) === "resume") return;
+ port.onDisconnect.addListener(() => {
+ if (lastIntent && Date.now() - lastIntent.at < INTENT_WINDOW_MS) return;
+ void emit("recorder-host-lost", "port-disconnect");
+ try {
+ chrome.alarms?.create?.(RESUME_RETRY_ALARM, {
+ delayInMinutes: RESUME_AFTER_LOST_MIN,
+ });
+ } catch {}
+ });
+ });
+};
diff --git a/src/pages/Background/recording/openRecorderTab.js b/src/pages/Background/recording/openRecorderTab.js
index 67844f8..0aa4ef1 100644
--- a/src/pages/Background/recording/openRecorderTab.js
+++ b/src/pages/Background/recording/openRecorderTab.js
@@ -404,6 +404,18 @@ export const startRecorderSession = async (request, tabId = null) => {
}
}
+ // The region recorder is already acquiring its stream and fires
+ // reset-active-tab on its own clock; the close below can stall for seconds,
+ // and startRecording needs recordingTab by then.
+ if (request.region && request.customRegion) {
+ await chrome.storage.local.set({
+ recordingTab: activeTab.id,
+ offscreen: false,
+ region: true,
+ recordingUiTabId: activeTab.id,
+ });
+ }
+
const endCloseOffscreen = perfSpan("BG.startRecorderSession closeOffscreenDocument");
// finalize any in-flight offscreen upload before teardown; a back-to-back
// start otherwise bare-closes the prior TUS finalize and loses it
@@ -414,12 +426,6 @@ export const startRecorderSession = async (request, tabId = null) => {
if (tabId !== null) chrome.tabs.update(tabId, { active: true });
if (request.customRegion) {
- chrome.storage.local.set({
- recordingTab: activeTab.id,
- offscreen: false,
- region: true,
- recordingUiTabId: activeTab.id,
- });
const endSendLoaded = perfSpan("BG.startRecorderSession customRegion.sendLoaded");
sendMessageRecord({
type: "loaded",
diff --git a/src/pages/Background/recording/recordingHelpers.js b/src/pages/Background/recording/recordingHelpers.js
index 81b68c1..41e1861 100644
--- a/src/pages/Background/recording/recordingHelpers.js
+++ b/src/pages/Background/recording/recordingHelpers.js
@@ -300,7 +300,11 @@ export const handleRecordingError = async (request) => {
});
} catch {}
- sendMessageRecord({ type: "recording-error" }).then(() => {
+ sendMessageRecord({
+ type: "recording-error",
+ error: request?.error || null,
+ why: request?.why || null,
+ }).then(() => {
const candidateTabs = [activeTab, recordingUiTabId, tabRecordedID].filter(
(id, idx, arr) => Number.isInteger(id) && arr.indexOf(id) === idx,
);
diff --git a/src/pages/Background/recording/resumePendingUploads.js b/src/pages/Background/recording/resumePendingUploads.js
index fb516f6..dc8de38 100644
--- a/src/pages/Background/recording/resumePendingUploads.js
+++ b/src/pages/Background/recording/resumePendingUploads.js
@@ -24,6 +24,9 @@ const ACTIVE_PIPELINE_STEPS = new Set([
const PIPELINE_ACTIVE_TTL_MS = 2 * 60 * 1000;
// CloudRecorder beats every 15s while it holds a take. Past this it is gone.
const HOST_BUSY_TTL_MS = 90 * 1000;
+// No recorder document and no sign of life for this long means the host died.
+// The server reaps uploads with no completion after 6h, so waiting for a click loses the take.
+const DEAD_HOST_QUIET_MS = 5 * 60 * 1000;
// stale-cleared and crashed are what a toolbar click or a closed recorder tab
// rewrites a crashed take to.
const RECOVERABLE_SESSION_STATUSES = new Set([
@@ -124,6 +127,69 @@ const scheduleRetry = (delayInMinutes = 2) => {
} catch {}
};
+// null: no usable stamp. false: not quiet long enough. true: quiet past the limit.
+// Stamps from before this take's click belong to an earlier take, so a start stuck in
+// setup can't look like a dead host.
+export const judgeHostQuiet = (snap, now = Date.now()) => {
+ const takeStart = Number.isFinite(snap.pendingRecordingAt)
+ ? snap.pendingRecordingAt
+ : 0;
+ const stamps = [
+ snap.firstChunkAt,
+ snap.lastChunkAt,
+ snap.recorderPipelineState?.ts,
+ snap.cloudRecorderHostBusy?.at,
+ ].filter((t) => Number.isFinite(t) && t > 0 && t >= takeStart);
+ if (!stamps.length) return null;
+ return now - Math.max(...stamps) >= DEAD_HOST_QUIET_MS;
+};
+
+// Same keys the stale-reset in onActionButtonClickedListener and the startup sweep
+// clear. The icon follows `recording` via lifecycleObserver.
+const DEAD_HOST_FLAG_RESET = {
+ recording: false,
+ pendingRecording: false,
+ restarting: false,
+ offscreen: false,
+ recordingTab: null,
+ region: false,
+ customRegion: false,
+ recordingUiTabId: null,
+ tabRecordedID: null,
+ paused: false,
+ pausedAt: null,
+ totalPausedMs: 0,
+ recordingStallLevel: 0,
+ postStopEditorOpened: false,
+ postStopEditorOpening: false,
+ recordingToScene: false,
+ projectId: null,
+ activeSceneId: null,
+ multiMode: false,
+ multiSceneCount: 0,
+ multiProjectId: null,
+ multiLastSceneId: null,
+};
+
+// null: host alive or unjudgeable, flag stands. false: not quiet long enough. true: dead.
+// Only one offscreen document can exist, so resuming beside a live one evicts it.
+const recorderHostIsGone = async (snap) => {
+ try {
+ const contexts = await chrome.runtime.getContexts({
+ contextTypes: ["OFFSCREEN_DOCUMENT"],
+ });
+ if (contexts?.length) return null;
+ // Custom-region and kill-switch recordings host the recorder in a tab.
+ if (snap.recordingTab != null) {
+ const tab = await chrome.tabs.get(snap.recordingTab).catch(() => null);
+ if (tab) return null;
+ }
+ return judgeHostQuiet(snap);
+ } catch {
+ return null;
+ }
+};
+
export const tryResumePendingUploads = async ({
trigger = "unknown",
} = {}) => {
@@ -131,14 +197,26 @@ export const tryResumePendingUploads = async ({
const snap = await chrome.storage.local.get([
"recording",
"pendingRecording",
+ "pendingRecordingAt",
"resumeInProgress",
"resumeLockAt",
"recorderPipelineState",
"cloudRecorderHostBusy",
+ "firstChunkAt",
+ "lastChunkAt",
+ "recordingTab",
"screenityToken",
]);
if (snap.recording || snap.pendingRecording) {
- return { skipped: "recording-active" };
+ const hostGone = await recorderHostIsGone(snap);
+ if (hostGone === null) return { skipped: "recording-active" };
+ if (!hostGone) {
+ scheduleRetry(1);
+ return { skipped: "recording-active" };
+ }
+ // Nothing else clears these once the host is gone, so the popup and toolbar
+ // would keep showing a recording that no longer exists.
+ await chrome.storage.local.set(DEAD_HOST_FLAG_RESET).catch(() => {});
}
// Nothing survives a browser start or extension reload, so a leftover step or
// beat belongs to the host that died.
diff --git a/src/pages/Background/recording/startRecording.js b/src/pages/Background/recording/startRecording.js
index 45e82e2..8ddae5b 100644
--- a/src/pages/Background/recording/startRecording.js
+++ b/src/pages/Background/recording/startRecording.js
@@ -398,6 +398,8 @@ const _startRecordingInner = async (caller) => {
"fpsValue",
"cameraActive",
"micActive",
+ "instantMode",
+ "backgroundEffectsActive",
"recordedTabDomain",
"pendingClickBeacon",
]),
@@ -438,6 +440,8 @@ const _startRecordingInner = async (caller) => {
micActive: Boolean(extras?.micActive),
systemAudio: Boolean(systemAudio),
multiMode: Boolean(multiMode),
+ instantMode: Boolean(extras?.instantMode),
+ backgroundEffectsActive: Boolean(extras?.backgroundEffectsActive),
tabsCount: Array.isArray(tabs) ? tabs.length : null,
windowsCount: Array.isArray(wins) ? wins.length : null,
recordedTabDomain: extras?.recordedTabDomain || null,
diff --git a/src/pages/Background/utils/serializedTelemetryStore.js b/src/pages/Background/utils/serializedTelemetryStore.js
index 65bd57c..c9c550e 100644
--- a/src/pages/Background/utils/serializedTelemetryStore.js
+++ b/src/pages/Background/utils/serializedTelemetryStore.js
@@ -1,33 +1,61 @@
const STORAGE_KEY = "cloudUploadTelemetryEvents";
const MAX_EVENTS = 300;
+// Each write rewrites the whole list into every tab's onChanged listeners.
+// upload_progress fires every few seconds for the whole take, so it waits for
+// the next other event or this long, whichever comes first. Order is kept.
+export const PROGRESS_FLUSH_MS = 15000;
let writeChain = Promise.resolve();
+let queue = [];
+let flushTimer = null;
-export const appendUploadTelemetryEventSerialized = async (event) => {
- if (!event || typeof event !== "object") return false;
+const isProgressEvent = (event) =>
+ (event?.event || event?.type) === "upload_progress";
+
+const flushQueue = () => {
+ if (flushTimer) {
+ clearTimeout(flushTimer);
+ flushTimer = null;
+ }
+ if (!queue.length) return;
+ const batch = queue;
+ queue = [];
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,
- });
+ const next = [...current, ...batch.map((b) => b.event)].slice(-MAX_EVENTS);
+ await chrome.storage.local.set({ [STORAGE_KEY]: next });
});
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;
- }
+ job.then(
+ () => batch.forEach((b) => b.resolve(true)),
+ (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; events lost:",
+ err?.message || err,
+ { eventTypes: batch.map((b) => b.event?.event || b.event?.type || null) },
+ );
+ batch.forEach((b) => b.resolve(false));
+ },
+ );
+};
+
+// Other events resolve once they (and any queued progress before them) are in
+// storage. A progress event resolves on queueing: the recorder's close path
+// waits on in-flight telemetry and must not sit out the batching window.
+export const appendUploadTelemetryEventSerialized = (event) => {
+ if (!event || typeof event !== "object") return Promise.resolve(false);
+ return new Promise((resolve) => {
+ queue.push({ event, resolve });
+ if (!isProgressEvent(event)) {
+ flushQueue();
+ return;
+ }
+ resolve(true);
+ if (!flushTimer) flushTimer = setTimeout(flushQueue, PROGRESS_FLUSH_MS);
+ });
};
diff --git a/src/pages/Camera/Camera.jsx b/src/pages/Camera/Camera.jsx
index c5d6178..b35c49d 100644
--- a/src/pages/Camera/Camera.jsx
+++ b/src/pages/Camera/Camera.jsx
@@ -2,6 +2,7 @@ import React, { useEffect, useRef, useState } from "react";
import Background from "./components/Background";
import { useCameraContext } from "./context/CameraContext";
import {
+ IS_WINDOW_COPY,
getCameraStream,
stopCameraStream,
surfaceHandler,
@@ -184,6 +185,7 @@ const Camera = () => {
// recording a monitor, old PiP was destroyed with old page, re-enter once the
// new camera iframe has a live stream.
useEffect(() => {
+ if (IS_WINDOW_COPY) return;
if (!videoRef.current || !streamRef.current?.active) return;
chrome.storage.local.get(
@@ -217,6 +219,7 @@ const Camera = () => {
};
useEffect(() => {
+ if (IS_WINDOW_COPY) return undefined;
if (!videoRef.current) {
console.warn("Video element not ready for PiP events.");
return;
@@ -248,7 +251,7 @@ const Camera = () => {
transform: "translate(-50%, -50%)",
zIndex: 99,
display: !backgroundEffects ? "block" : "none",
- objectFit: isCameraMode ? "contain" : "cover",
+ objectFit: isCameraMode && !IS_WINDOW_COPY ? "contain" : "cover",
objectPosition: "50% 50%",
}}
ref={videoRef}
diff --git a/src/pages/Camera/MicMeter.jsx b/src/pages/Camera/MicMeter.jsx
new file mode 100644
index 0000000..a7c2e52
--- /dev/null
+++ b/src/pages/Camera/MicMeter.jsx
@@ -0,0 +1,61 @@
+import { useEffect } from "react";
+
+// Loaded as camera.html?meter=1 in the floating window. Listens to the mic only
+// and posts a 0 to 1 level to the parent; nothing is recorded.
+const MicMeter = () => {
+ useEffect(() => {
+ let stream = null;
+ let context = null;
+ let timer = null;
+ let cancelled = false;
+
+ const start = async () => {
+ try {
+ const { defaultAudioInput } = await chrome.storage.local.get([
+ "defaultAudioInput",
+ ]);
+ const audio =
+ defaultAudioInput && defaultAudioInput !== "none"
+ ? { deviceId: { exact: defaultAudioInput } }
+ : true;
+ stream = await navigator.mediaDevices.getUserMedia({ audio });
+ if (cancelled) {
+ stream.getTracks().forEach((t) => t.stop());
+ return;
+ }
+ context = new AudioContext();
+ if (context.state === "suspended") await context.resume();
+ if (cancelled) return;
+ const analyser = context.createAnalyser();
+ analyser.fftSize = 512;
+ context.createMediaStreamSource(stream).connect(analyser);
+ const data = new Float32Array(analyser.fftSize);
+ let smoothed = 0;
+ timer = setInterval(() => {
+ analyser.getFloatTimeDomainData(data);
+ let sum = 0;
+ for (let i = 0; i < data.length; i++) sum += data[i] * data[i];
+ const level = Math.min(1, Math.sqrt(sum / data.length) * 5);
+ smoothed = level > smoothed ? level : smoothed * 0.8 + level * 0.2;
+ try {
+ window.parent.postMessage(
+ { type: "screenity-mic-level", level: smoothed },
+ "*"
+ );
+ } catch {}
+ }, 70);
+ } catch {}
+ };
+ start();
+
+ return () => {
+ cancelled = true;
+ clearInterval(timer);
+ stream?.getTracks().forEach((t) => t.stop());
+ context?.close().catch(() => {});
+ };
+ }, []);
+ return null;
+};
+
+export default MicMeter;
diff --git a/src/pages/Camera/index.jsx b/src/pages/Camera/index.jsx
index d51f0f1..b0c21ca 100644
--- a/src/pages/Camera/index.jsx
+++ b/src/pages/Camera/index.jsx
@@ -3,17 +3,22 @@ import React from "react";
import { createRoot } from "react-dom/client";
import CameraProvider from "./context/CameraContext";
import Camera from "./Camera";
+import MicMeter from "./MicMeter";
// Find the container to render into
const container = window.document.querySelector("#app-container");
if (container) {
const root = createRoot(container);
- root.render(
- <CameraProvider>
- <Camera />
- </CameraProvider>
- );
+ if (new URLSearchParams(window.location.search).get("meter") === "1") {
+ root.render(<MicMeter />);
+ } else {
+ root.render(
+ <CameraProvider>
+ <Camera />
+ </CameraProvider>
+ );
+ }
}
// Hot Module Replacement
diff --git a/src/pages/Camera/messaging/handlers.js b/src/pages/Camera/messaging/handlers.js
index e7fd964..8cb62e9 100644
--- a/src/pages/Camera/messaging/handlers.js
+++ b/src/pages/Camera/messaging/handlers.js
@@ -6,9 +6,9 @@ import { getContextRefs } from "../context/CameraContext";
import {
getCameraStream,
stopCameraStream,
- togglePip,
surfaceHandler,
cameraToggledToolbar,
+ IS_WINDOW_COPY,
} from "../utils/cameraUtils";
import { loadEffect } from "../utils/backgroundUtils";
import {
@@ -18,6 +18,11 @@ import {
setBackgroundEffects,
} from "../utils/uiState";
+// The window copy isn't a PiP, so it must not report that one ended.
+const notifyPipEnded = () => {
+ if (!IS_WINDOW_COPY) chrome.runtime.sendMessage({ type: "pip-ended" });
+};
+
function waitForVideoRef(callback, attempts = 10) {
const { videoRef } = getContextRefs();
@@ -75,7 +80,6 @@ export const setupHandlers = ({ setLoading }) => {
);
registerMessage("camera-only-update", handleCameraOnlyUpdate);
registerMessage("screen-update", handleScreenUpdate);
- registerMessage("toggle-pip", () => togglePip(getContextRefs().videoRef));
registerMessage("set-surface", (message) => {
console.log("Preparing Picture in Picture request");
@@ -99,7 +103,7 @@ export const setupHandlers = ({ setLoading }) => {
});
}
setPipMode(false);
- chrome.runtime.sendMessage({ type: "pip-ended" });
+ notifyPipEnded();
});
messageRouter();
@@ -109,7 +113,7 @@ export const setupHandlers = ({ setLoading }) => {
if (res.pipForceClose && document.pictureInPictureElement) {
document.exitPictureInPicture().catch(() => {});
setPipMode(false);
- chrome.runtime.sendMessage({ type: "pip-ended" });
+ notifyPipEnded();
}
});
chrome.storage.onChanged.addListener((changes, area) => {
@@ -118,7 +122,7 @@ export const setupHandlers = ({ setLoading }) => {
if (document.pictureInPictureElement) {
document.exitPictureInPicture().catch(() => {});
setPipMode(false);
- chrome.runtime.sendMessage({ type: "pip-ended" });
+ notifyPipEnded();
}
});
};
@@ -127,7 +131,7 @@ const handleStopRecording = async (request) => {
if (document.pictureInPictureElement) {
document.exitPictureInPicture();
setPipMode(false);
- chrome.runtime.sendMessage({ type: "pip-ended" });
+ notifyPipEnded();
}
// Stop tracks so the webcam light goes off; otherwise the iframe holds
// the stream until the page is torn down (may be much later or never if
diff --git a/src/pages/Camera/utils/cameraUtils.js b/src/pages/Camera/utils/cameraUtils.js
index cc6c88d..4d684f4 100644
--- a/src/pages/Camera/utils/cameraUtils.js
+++ b/src/pages/Camera/utils/cameraUtils.js
@@ -2,9 +2,6 @@ import { getContextRefs } from "../context/CameraContext";
import { setPipMode } from "./uiState";
import { getUserMediaWithFallback } from "../../utils/mediaDeviceFallback";
-const CLOUD_FEATURES_ENABLED =
- process.env.SCREENITY_ENABLE_CLOUD_FEATURES === "true";
-
export const getCameraStream = async (
constraints,
streamRef,
@@ -327,78 +324,17 @@ export const stopCameraStream = (streamRef, videoRef) => {
}
};
-export const togglePip = (videoRef) => {
- if (document.pictureInPictureElement) {
- document.exitPictureInPicture();
- } else {
- try {
- videoRef.current.requestPictureInPicture().catch(() => {
- setPipMode(false);
- chrome.runtime.sendMessage({ type: "pip-ended" });
- });
- } catch (error) {
- setPipMode(false);
- chrome.runtime.sendMessage({ type: "pip-ended" });
- }
- }
-};
-export const surfaceHandler = async (request, videoRef) => {
- console.log("Picture in Picture request ready");
-
- if (
- !videoRef?.requestPictureInPicture &&
- !videoRef?.current?.requestPictureInPicture
- ) {
- setPipMode(false);
- chrome.runtime.sendMessage({ type: "pip-ended" });
- return;
- }
-
- // recordingType leads, surface only qualifies it: displaySurface reports
- // "monitor" for a region/tab crop too, since the crop happens after the pick.
- const CROPPED_TYPES = ["region", "tab", "camera"];
- const croppedCapture = CROPPED_TYPES.includes(request.recordingType);
- const fullMonitor = request.surface === "monitor" && !croppedCapture;
-
- if (!CLOUD_FEATURES_ENABLED) {
- const shouldEnterPip = fullMonitor;
- if (shouldEnterPip && videoRef.current) {
- try {
- await videoRef.current.requestPictureInPicture();
- } catch (err) {
- console.error("❌ Failed to enter PiP:", err);
- setPipMode(false);
- chrome.runtime.sendMessage({ type: "pip-ended" });
- }
- }
- return;
- }
-
- // Auth data is passed along with the set-surface message from the background
- // script (setSurface.js) to avoid an async round-trip that would lose the
- // user gesture context required by requestPictureInPicture().
- try {
- const isSubscribed = request.subscribed || false;
- const instantMode = request.instantMode || false;
-
- // PiP rule: enter PiP when the bubble needs to be visible to the
- // capture (free+monitor, pro+instant+monitor) or as a draggable
- // preview when the camera is already a separate cloud track
- // (pro+non-instant+non-monitor). Skip PiP when the on-page bubble
- // is captured naturally (pro+instant+non-monitor) or would imply
- // the camera's part of the screen recording when it isn't
- // (pro+non-instant+monitor).
- const shouldEnterPip =
- (fullMonitor && (!isSubscribed || instantMode)) ||
- (request.surface !== "monitor" && isSubscribed && !instantMode);
-
- if (shouldEnterPip && videoRef.current) {
- await videoRef.current.requestPictureInPicture();
- }
- } catch (error) {
- console.error("❌ Failed to enter Picture in Picture:", error);
- setPipMode(false);
- chrome.runtime.sendMessage({ type: "pip-ended" });
+// The copy inside the floating window never opens a video PiP of its own.
+export const IS_WINDOW_COPY =
+ typeof window !== "undefined" &&
+ new URLSearchParams(window.location.search).get("pip") === "1";
+
+// The floating window is opened inside the click that starts the recording.
+// Entering the browser's video PiP on its own replaces the bubble with a black
+// "Picture in picture mode" card, so only the bubble's own button may.
+export const surfaceHandler = async (request) => {
+ if (process.env.NODE_ENV !== "production") {
+ console.debug("[Screenity][pip] bubble surface", request?.surface);
}
};
diff --git a/src/pages/CloudRecorder/CloudRecorder.jsx b/src/pages/CloudRecorder/CloudRecorder.jsx
index 039dd28..50b3390 100644
--- a/src/pages/CloudRecorder/CloudRecorder.jsx
+++ b/src/pages/CloudRecorder/CloudRecorder.jsx
@@ -5,17 +5,53 @@ import {
sendStopRecording,
} from "../utils/recorderMessaging";
import { getBitrates, getResolutionForQuality } from "./recorderConfig";
+import { avcCodecForSize } from "../../media/avcLevel";
import { pickEncodedDims, scaleClickEvents } from "./encodedDims";
+import { resolveInsertTarget } from "./blankSceneTarget";
+import {
+ CAP_1080P,
+ cloudBitrateForCap,
+ smallerCap,
+ uploadChunkSizeForCap,
+} from "./cloudEncodeCap";
+import {
+ loadCloudEncodeCapForClick,
+ prewarmCloudEncodeCap,
+} from "./loadSustainedCloudCap";
+import {
+ requestedScreenFps,
+ chosenScreenFps,
+ smootherMotionActive,
+} from "./screenFps";
import { planGapResend } from "./uploadGapRecovery";
+import {
+ describeTrack,
+ canDeferFinalize,
+ createFinalizeSettle,
+ evaluateFinalizeSettle,
+ planFinalizeRetry,
+ canReapLocalCopy,
+} from "./deferredFinalize";
import { getClientSessionId } from "./clientSessionId";
import BunnyTusUploader from "./bunnyTusUploader";
import localforage from "localforage";
import { createVideoProject } from "./createVideoProject";
import { notifyRecordingStarted } from "./notifyRecordingStarted";
import { getUserMediaWithFallback } from "../utils/mediaDeviceFallback";
-import { startAudioStream as acquireMicStream } from "../utils/startAudioStream";
+import {
+ startAudioStream as acquireMicStream,
+ describeMicSettings,
+ RAW_MIC_PROCESSING,
+} from "../utils/startAudioStream";
import { shouldAcquireMicAtStart } from "../utils/micAcquisitionPolicy";
import { attachAudioContextWatchdog } from "../utils/audioContextWatchdog";
+import {
+ createSourceProbe,
+ snapshotProbes,
+ flattenProbeDiag,
+} from "../Recorder/audioSourceProbe";
+import { attachGapDetector, flattenGapDiag } from "../Recorder/audioGapDetector";
+import { longTasks, readDevice, flattenPerfStats } from "../Recorder/perfTelemetry";
import { startTabKeepalive, stopTabKeepalive } from "../utils/tabKeepalive";
import { traceStep } from "../utils/startFlowTrace";
import { markStartProgress } from "../utils/startProgress";
@@ -34,6 +70,7 @@ import { acquireDisplayMediaWithFocusRetry } from "../utils/acquireDisplayMedia"
import {
resolveCaptureSurface,
setCapturedSurface,
+ setCapturedRegion,
} from "../utils/captureSurface";
import { startPrewarm, stopPrewarm } from "../Recorder/streamWarmup";
import { preloadWebCodecsModules } from "../Recorder/webcodecs/WebCodecsRecorder";
@@ -42,19 +79,22 @@ import {
closeActiveEncoderPrewarm,
} from "../Recorder/encoderPrewarm";
import { perfMark, perfSpan } from "../utils/perfMarks";
+import { createWriteCoalescer } from "../utils/writeCoalescer";
import {
chooseChunksStore,
openExistingChunksStore,
} from "./recorderStorage/chooseChunksStore";
import { destroySessionDir } from "./recorderStorage/opfsKvStore";
-import { createTrackStallState, sweepTrackStalls } from "./trackStallSweep";
+import {
+ createTrackStallState,
+ sweepTrackStalls,
+ findHeaderOnlyTracks,
+} from "./trackStallSweep";
import {
chooseTrackEncoder,
resetEncoderProbeCache,
computeEncodedDimensions,
computeCameraBitrate,
- WEBCODECS_CAP_WIDTH,
- WEBCODECS_CAP_HEIGHT,
} from "./encoder/chooseEncoder";
import {
computeCaptureCap,
@@ -81,10 +121,12 @@ localforage.config({
});
import { shouldSeparateAudio } from "./shouldSeparateAudio";
+import { createLiveTap, waitBounded } from "./liveTranscription/liveTap";
import {
shouldMuxBusAudio,
needsContextResume,
isBusSilentFault,
+ rebuildBusSources,
} from "./audioBusPolicy";
import {
setPendingMicRecovery,
@@ -134,6 +176,14 @@ const GAP_RESEND_BUDGET_MS = 45000;
// prepareGapResend refuses to rewind under an in-flight PATCH, and the call
// site quiesces the queue before reading the offset it plans against.
const GAP_RESEND_ENABLED = true;
+// Offscreen only: the previous-recorder gate holds the next take while this one
+// is still stopping, and nothing reuses the document. The tab host opts in only
+// for the mocked harness, which can't route offscreen requests.
+const deferFinalizeHostAllowed = () =>
+ IS_OFFSCREEN_HOST ||
+ (!IS_IFRAME_CONTEXT &&
+ typeof window !== "undefined" &&
+ window.SCREENITY_DEFER_FINALIZE_ON_TAB === true);
const SCREEN_CHUNK_MEMORY_WINDOW = 8;
const CAMERA_CHUNK_MEMORY_WINDOW = 8;
const AUDIO_CHUNK_MEMORY_WINDOW = 8;
@@ -161,6 +211,9 @@ const resolveExtVersion = () => {
}
};
const SESSION_STATE_INDEX_KEY = "cloudRecorderSessionStateIndex";
+// Chunk and upload-progress snapshots share one write per window. Recovery
+// counts chunks on disk and resumes from uploadJournal, not these counters.
+const SESSION_PROGRESS_PERSIST_MS = 5000;
// stale-cleared and crashed are what a toolbar click or a closed recorder tab
// rewrite a crashed take to.
const RECOVERABLE_SESSION_STATUSES = new Set([
@@ -237,6 +290,8 @@ const captureSessionDiag = () => {
const urlParams = new URLSearchParams(window.location.search);
const IS_INJECTED_IFRAME = urlParams.has("injected");
+// Run the encode speed test while the hidden iframe loads, so the click finds it cached.
+if (IS_INJECTED_IFRAME) prewarmCloudEncodeCap();
const IS_IFRAME_CONTEXT =
IS_INJECTED_IFRAME ||
(window.top !== window.self &&
@@ -264,6 +319,10 @@ const CloudRecorder = () => {
const stopFlowRef = useRef(null);
const simulateFinalizeFailureConsumedRef = useRef(false);
const [retryingFinalize, setRetryingFinalize] = useState(false);
+ // Set when a close that settled after the scene POST failed. Its retry only
+ // re-closes those tracks: the scene and the mic are already out.
+ const deferredFinalizeRef = useRef(null);
+ const deferredSettleRef = useRef(null);
const retryFinalize = async () => {
setRetryingFinalize(true);
@@ -272,6 +331,10 @@ const CloudRecorder = () => {
finalizeFailureRef.current = null;
setFinalizeFailure(null);
try {
+ if (deferredFinalizeRef.current) {
+ await deferredFinalizeRef.current.retry();
+ return;
+ }
await stopRecording(true, "retry-finalize");
if (!finalizeFailureRef.current && IS_OFFSCREEN_HOST) {
chrome.runtime
@@ -295,6 +358,10 @@ const CloudRecorder = () => {
// What the capture was asked for, so a MediaRecorder fallback can constrain a
// supersampled track back down before it encodes at 2x the intended size.
const captureCapRef = useRef(null);
+ // Null means CAP_1080P; set only when the display-media branch resolved a larger box.
+ const encodeCapRef = useRef(null);
+ // Encoder fps: 60 only when requested and the capture delivered it.
+ const screenFpsRef = useRef(30);
const prewarmRef = useRef(null);
const cameraStream = useRef(null);
const micStream = useRef(null);
@@ -313,6 +380,11 @@ const CloudRecorder = () => {
const screenUploader = useRef(null);
const cameraUploader = useRef(null);
const audioUploader = useRef(null);
+ // Live transcription sidecar: needs the build flag and a single MediaRecorder
+ // mic stream feeding audioUploader.
+ const liveTapRef = useRef(null);
+ const liveIdsRef = useRef(null);
+ const liveStopRef = useRef(null);
const uploadMetaRef = useRef(null);
const localScreenPlaybackOfferRef = useRef(null);
const emptyCleanupRef = useRef(false);
@@ -412,6 +484,8 @@ const CloudRecorder = () => {
const purgeInFlightRef = useRef({ screen: false, camera: false });
const sessionStateIndexedRef = useRef(false);
const sessionHeartbeat = useRef(null);
+ const sessionPersistCoalescer = useRef(null);
+ const pendingSessionOverrides = useRef({});
const chunkStallTimer = useRef(null);
const uploadHeartbeatTimer = useRef(null);
const trackSweepTicks = useRef(0);
@@ -533,6 +607,15 @@ const CloudRecorder = () => {
ctxStateAtStart: null,
});
const busTap = useRef(null);
+ // The source nodes feeding audioInputGain / audioOutputGain, kept so a take
+ // starting on a suspended graph can swap them for fresh ones.
+ const busSourceNodes = useRef({ mic: null, system: null });
+ const sourceProbes = useRef({});
+ // Separated mic only: gap detector on a second tap of the raw track, and
+ // what Chrome applied to it at acquisition.
+ const micGapDetector = useRef(null);
+ const micSettingsRef = useRef(null);
+ const sourceProbeTimer = useRef(null);
const destination = useRef(null);
const keepAliveInterval = useRef(null);
@@ -1232,6 +1315,54 @@ const CloudRecorder = () => {
} catch {}
};
+ // Sends recorder failure code and counters (no first chunk, zero frames, stall) to the session.
+ const reportRecorderFailure = (err, track) => {
+ try {
+ const d = err?.detail || {};
+ const sw = d.swRetry ? d.swRetry.reason || 1 : 0;
+ logForensicEvent("recorder-failure", {
+ trackType: track,
+ reason: String(err?.code || "unknown").slice(0, 120),
+ errMsg: `frames=${d.framesEncoded ?? "?"} mstp=${
+ d.framesFromMSTP ?? "?"
+ } chunk=${d.firstChunkSeen ? 1 : 0} sw=${sw} vis=${
+ d.visibility?.changes ?? "?"
+ } q=${d.peakEncodeQueueSize?.video ?? "?"} drop=${
+ d.droppedForBackpressure?.video ?? "?"
+ }`,
+ });
+ } catch {}
+ };
+
+ // Host health for the zip and, when signed in, the telemetry. The tier sits
+ // beside the fps it achieved, since the ladder only measures an idle encoder.
+ const collectPerf = () => {
+ const recorder = screenRecorder.current || cameraRecorder.current;
+ const snap = recorder?.getPerfSnapshot?.() || null;
+ return {
+ device: readDevice(),
+ fps: snap?.fps || null,
+ longTask: longTasks.snapshot(),
+ encodeHardware: snap?.encodeHardware ?? null,
+ tier: encodeCapRef.current?.tier ?? null,
+ targetFps: screenFpsRef.current ?? null,
+ };
+ };
+
+ // Screen stats win over camera, as before. The perf keys ride only with a
+ // token: signed-out takes keep them in the diagnostic zip.
+ const buildEncodeStats = () => {
+ const screenStats = screenRecorder.current?.getEncodeStats?.() || null;
+ const cameraStats = cameraRecorder.current?.getEncodeStats?.() || null;
+ const base = screenStats
+ ? { ...screenStats, track: "screen" }
+ : cameraStats
+ ? { ...cameraStats, track: "camera" }
+ : null;
+ if (!base || !uploadTelemetryTokenRef.current) return base;
+ return { ...base, ...flattenPerfStats(collectPerf()) };
+ };
+
const emitRecordingOutcome = (outcome, extra = {}) => {
const session = recorderSession.current;
const startedAt = session?.startedAt || null;
@@ -1254,13 +1385,7 @@ const CloudRecorder = () => {
// the only fleet-wide read on whether the steady cap fits hardware we
// can't test. Tagged by track, since a hardware screen encoder and a
// software camera encoder queue very differently.
- const screenStats = screenRecorder.current?.getEncodeStats?.() || null;
- const cameraStats = cameraRecorder.current?.getEncodeStats?.() || null;
- const encodeStats = screenStats
- ? { ...screenStats, track: "screen" }
- : cameraStats
- ? { ...cameraStats, track: "camera" }
- : null;
+ const encodeStats = buildEncodeStats();
void emitUploadTelemetry("recording_outcome", {
outcome,
durationMs,
@@ -2145,6 +2270,17 @@ const CloudRecorder = () => {
mode
) => {
const isScreen = trackLabel === "screen";
+ // A deferred close needs the whole camera file on disk, so keep it like the
+ // screen's opening until headroom runs low or the same 8 GB bound is hit.
+ if (
+ !isScreen &&
+ mode !== "all" &&
+ storageBackends.camera === "opfs" &&
+ deferFinalizeHostAllowed() &&
+ (Number(uploader.totalBytes) || 0) <= LOCAL_SCREEN_PLAYBACK_MAX_BYTES
+ ) {
+ return;
+ }
// One reading per pass. A PATCH landing mid-pass would otherwise widen the
// deletes past the mark just saved.
const confirmedOffset = Number(uploader.lastServerOffset) || 0;
@@ -2496,6 +2632,8 @@ const CloudRecorder = () => {
const persistSessionState = async (overrides = {}) => {
if (!recorderSession.current) return;
+ sessionPersistCoalescer.current?.noteWrite();
+ pendingSessionOverrides.current = {};
const tracks = buildTrackSnapshot();
const sessionStateKey = getSessionStateKey(recorderSession.current.id);
const nextState = {
@@ -2564,6 +2702,25 @@ const CloudRecorder = () => {
}
};
+ // For per-chunk and upload-progress refreshes only. Any persistSessionState
+ // call in between carries the same state and drops the pending one.
+ const requestSessionPersist = (overrides = {}) => {
+ if (!recorderSession.current) return;
+ pendingSessionOverrides.current = {
+ ...pendingSessionOverrides.current,
+ ...overrides,
+ };
+ if (!sessionPersistCoalescer.current) {
+ sessionPersistCoalescer.current = createWriteCoalescer({
+ minIntervalMs: SESSION_PROGRESS_PERSIST_MS,
+ run: () => {
+ void persistSessionState(pendingSessionOverrides.current);
+ },
+ });
+ }
+ sessionPersistCoalescer.current.request();
+ };
+
const startRecorderSession = async (meta = {}) => {
let recorderOwnerTabId = null;
try {
@@ -2776,6 +2933,12 @@ const CloudRecorder = () => {
audioCtxWallMs: aCtxCreatedAtRef.current
? Date.now() - aCtxCreatedAtRef.current
: null,
+ // Raw per-source levels, tapped ahead of the bus. Silent bus with a
+ // live raw source means we lost it; silent raw means we never got it.
+ ...flattenProbeDiag(
+ snapshotProbes(sourceProbes.current, { resetWindow: true })
+ ),
+ ...flattenGapDiag(micGapDetector.current?.snapshot()),
...(muxAudioDiag || {}),
};
} catch {
@@ -2783,11 +2946,74 @@ const CloudRecorder = () => {
}
};
+ const stopSourceProbes = ({ summarize = false } = {}) => {
+ if (sourceProbeTimer.current) {
+ clearInterval(sourceProbeTimer.current);
+ sourceProbeTimer.current = null;
+ }
+ const probes = sourceProbes.current;
+ const gaps = micGapDetector.current?.finish() || null;
+ if (summarize && Object.keys(probes).length) {
+ diagForward("cloudrecorder-audio-sources-summary", {
+ sources: snapshotProbes(probes),
+ micSettings: micSettingsRef.current,
+ micGaps: gaps,
+ });
+ }
+ micGapDetector.current?.dispose();
+ micGapDetector.current = null;
+ Object.values(probes).forEach((p) => p.dispose());
+ sourceProbes.current = {};
+ };
+
+ const startSourceProbes = () => {
+ stopSourceProbes();
+ try {
+ const sysTrack = screenStream.current?.getAudioTracks?.()[0];
+ if (sysTrack) {
+ sourceProbes.current.sys = createSourceProbe(aCtx.current, sysTrack);
+ }
+ const micTrack = rawMicStream.current?.getAudioTracks?.()[0];
+ if (micTrack) {
+ sourceProbes.current.mic = createSourceProbe(aCtx.current, micTrack);
+ if (separatedAudio.current) {
+ micGapDetector.current = attachGapDetector(aCtx.current, micTrack, {
+ isPaused: () => pausedStateRef.current,
+ onGap: (gap) => diagForward("separated-mic-gap", gap),
+ });
+ }
+ }
+ } catch {}
+ if (!Object.keys(sourceProbes.current).length) return;
+ sourceProbeTimer.current = setInterval(() => {
+ if (isFinishing.current || aCtx.current?.state !== "running") return;
+ Object.values(sourceProbes.current).forEach((p) => {
+ try {
+ p.sample();
+ } catch {}
+ });
+ }, 500);
+ navigator.mediaDevices
+ ?.enumerateDevices?.()
+ .then((devices) => {
+ diagForward("cloudrecorder-audio-output-devices", {
+ outputs: devices
+ .filter((d) => d.kind === "audiooutput")
+ .map((d) => String(d.label || "").slice(0, 80))
+ .slice(0, 8),
+ });
+ })
+ .catch(() => {});
+ };
+
const finalizeRecorderSession = async (
status = "completed",
{ keepOpfsSession = false } = {}
) => {
if (!recorderSession.current) return;
+ // Folds a batched snapshot into recorderSession.current before the final
+ // write copies it, and leaves nothing to land after it.
+ sessionPersistCoalescer.current?.flush();
const sessionId = recorderSession.current.id;
// Final snapshot before the recorders get cleared, emitted even on
// cancel/failed so a recording that never finalizes is still
@@ -2824,20 +3050,15 @@ const CloudRecorder = () => {
} catch {}
}
// The server accepts encodeStats on any event type, so attach it here too.
- const screenStats = screenRecorder.current?.getEncodeStats?.() || null;
- const cameraStats = cameraRecorder.current?.getEncodeStats?.() || null;
void emitUploadTelemetry(eventType, {
status,
screenDiag,
cameraDiag,
audioDiag,
lifecycleBundle,
- encodeStats: screenStats
- ? { ...screenStats, track: "screen" }
- : cameraStats
- ? { ...cameraStats, track: "camera" }
- : null,
+ encodeStats: buildEncodeStats(),
});
+ diagForward("recorder-perf", collectPerf());
}
} catch {}
const opfsSessionId =
@@ -3075,6 +3296,37 @@ const CloudRecorder = () => {
}
};
+ const resendGapsWithinBudget = async (tracks = ["screen", "camera", "audio"]) => {
+ const args = {
+ screen: [screenUploader, chunksStore, "chunk_", screenChunkByteRangesRef],
+ camera: [
+ cameraUploader,
+ cameraChunksStore,
+ "camera_chunk_",
+ cameraChunkByteRangesRef,
+ ],
+ audio: [
+ audioUploader,
+ audioChunksStore,
+ "audio_chunk_",
+ audioChunkByteRangesRef,
+ ],
+ };
+ gapResendAbortRef.current = false;
+ const budgetTimer = setTimeout(() => {
+ gapResendAbortRef.current = true;
+ }, GAP_RESEND_BUDGET_MS);
+ await Promise.race([
+ Promise.allSettled(
+ tracks.map((track) => resendUploadGap(track, ...args[track]))
+ ),
+ new Promise((r) => setTimeout(r, GAP_RESEND_BUDGET_MS)),
+ ]);
+ // Stops stragglers at their next step, before finalize declares a length.
+ gapResendAbortRef.current = true;
+ clearTimeout(budgetTimer);
+ };
+
// A camera held by another app records nothing while screen keeps going, and
// 4 chunk periods is long enough that a healthy camera has always delivered.
const CAMERA_SILENCE_CHECK_MS = 8000;
@@ -3729,6 +3981,7 @@ const CloudRecorder = () => {
.connect(destination.current);
if (busTap.current) audioInputGain.current.connect(busTap.current);
busSources.current.mic = true;
+ busSourceNodes.current.mic = micSource;
}
// Set either way, matching the eager path: later consumers read
// micStream as the audio bus.
@@ -3823,6 +4076,13 @@ const CloudRecorder = () => {
});
};
+ const cancelLiveTap = () => {
+ const tap = liveTapRef.current;
+ liveTapRef.current = null;
+ liveStopRef.current = null;
+ tap?.cancel();
+ };
+
const cleanupIfEmptyUploads = async (reason) => {
if (emptyCleanupRef.current) return;
const screenOffset = screenUploader.current?.offset ?? null;
@@ -3838,6 +4098,7 @@ const CloudRecorder = () => {
if (!isEmpty) return;
emptyCleanupRef.current = true;
+ cancelLiveTap();
console.warn(
`[Screenity] empty upload cleanup reason=${reason} screenOffset=${screenOffset} cameraOffset=${cameraOffset}`
@@ -3905,6 +4166,7 @@ const CloudRecorder = () => {
const dismissRecording = async (restarting = false, reason = "dismiss") => {
clearPendingStart();
+ cancelLiveTap();
await markSessionDiscarded();
setInitProject(false);
await cleanupIfEmptyUploads(restarting ? "restart" : "dismiss");
@@ -4118,6 +4380,7 @@ const CloudRecorder = () => {
sceneId,
});
logDebugEvent("uploaders-init-start", { projectId, sceneId });
+ liveIdsRef.current = projectId ? { videoId: projectId, sceneId } : null;
if (!projectId) {
throw new Error("Missing projectId");
@@ -4141,7 +4404,9 @@ const CloudRecorder = () => {
lastUploadOffset: state?.offset || 0,
uploaderUpdatedAt: Date.now(),
});
- persistSessionState();
+ // The journal itself is already durable; this only mirrors its offset.
+ if (state?.reason === "journal-persisted") requestSessionPersist();
+ else persistSessionState();
if (state?.status === "error" && state?.error) {
persistSessionState({
uploadHealth: "error",
@@ -4196,7 +4461,7 @@ const CloudRecorder = () => {
// Constrain here, not at start(): the dims reported below are read off this
// track, and MediaRecorder has no resize stage. Target the cloud tier, not
// the WebCodecs 1080p cap, or the fallback silently loses its 1440p.
- if (captureCapRef.current?.oversampled) {
+ if (captureCapRef.current?.oversampled || captureCapRef.current?.highRes) {
const screenVideoTrack = screenStream.current?.getVideoTracks?.()[0];
const before = screenVideoTrack?.getSettings?.() || {};
let outcome;
@@ -4219,10 +4484,11 @@ const CloudRecorder = () => {
if (fitted.width > 0) constrainedScreenDims = fitted;
}
} else {
+ const cap = encodeCapRef.current || CAP_1080P;
outcome = await enforceOversampleRatio(
screenVideoTrack,
- WEBCODECS_CAP_WIDTH,
- WEBCODECS_CAP_HEIGHT
+ cap.width,
+ cap.height
);
}
chrome.runtime
@@ -4302,6 +4568,10 @@ const CloudRecorder = () => {
clientSessionId: getClientSessionId(),
sessionId,
trackType: "screen",
+ chunkSize: uploadChunkSizeForCap(
+ encodeCapRef.current,
+ screenFpsRef.current
+ ),
container: trackContainers.screen,
codec: trackCodecs.screen,
encoderKind: encoderKinds.screen,
@@ -4318,7 +4588,7 @@ const CloudRecorder = () => {
});
if (now - (lastUploadProgress.current.lastPersistAt || 0) > 2000) {
lastUploadProgress.current.lastPersistAt = now;
- persistSessionState();
+ requestSessionPersist();
}
},
onStall: onStall("screen"),
@@ -4346,7 +4616,13 @@ const CloudRecorder = () => {
// pixel-math against the encoded video is consistent. MediaRecorder
// path records at native, so dims pass through unchanged.
if (encoderKinds.screen === "webcodecs") {
- const downscaled = computeEncodedDimensions({ width, height });
+ const cap = encodeCapRef.current || CAP_1080P;
+ const downscaled = computeEncodedDimensions({
+ width,
+ height,
+ capWidth: cap.width,
+ capHeight: cap.height,
+ });
if (downscaled.width > 0 && downscaled.height > 0) {
width = downscaled.width;
height = downscaled.height;
@@ -4384,7 +4660,7 @@ const CloudRecorder = () => {
});
if (now - (lastUploadProgress.current.lastPersistAt || 0) > 2000) {
lastUploadProgress.current.lastPersistAt = now;
- persistSessionState();
+ requestSessionPersist();
}
},
onStall: onStall("camera"),
@@ -4980,6 +5256,11 @@ const CloudRecorder = () => {
// Runs once a track captures, not per track: declaring the session live is
// what gives the content UI its toolbar and Stop button.
let setupTrack = null;
+ // Shared take start on performance.now() (see startLeadIn.js); a video track
+ // starting later pads its file to it. The separate mic file is a MediaRecorder
+ // and cannot be padded, so when present the epoch is taken right before it
+ // starts, otherwise before the screen.
+ let startEpochMs = null;
let liveDeclared = false;
let liveDeclaring = false;
const declareRecordingLive = async () => {
@@ -5100,6 +5381,16 @@ const CloudRecorder = () => {
await aCtx.current.resume();
busWarmupRef.current.ctxResumedAtStart = true;
} catch {}
+ // Resuming is not enough after pause and restart: the old source
+ // nodes can stay at zero on live tracks for the whole take.
+ busSourceNodes.current = rebuildBusSources({
+ ctx: aCtx.current,
+ sources: busSourceNodes.current,
+ gains: {
+ mic: audioInputGain.current,
+ system: audioOutputGain.current,
+ },
+ });
diagForward("audio-bus-context-resumed", {
stateBefore: ctxStateAtStart,
stateAfter: aCtx.current?.state ?? null,
@@ -5117,9 +5408,13 @@ const CloudRecorder = () => {
// emit a silent AAC stream into /original.
new MediaStream(screenStream.current.getVideoTracks());
+ const screenEncodeCap = encodeCapRef.current || CAP_1080P;
const screenOptions = {
mimeType: "video/webm;codecs=vp9,opus",
- videoBitsPerSecond: 16000000,
+ videoBitsPerSecond: cloudBitrateForCap(
+ screenEncodeCap,
+ screenFpsRef.current
+ ),
audioBitsPerSecond: 128000,
};
@@ -5133,7 +5428,11 @@ const CloudRecorder = () => {
audioBitsPerSecond: screenOptions.audioBitsPerSecond,
audioChannels: audioBusChannels.current,
enableAudio: screenHasAudio,
+ maxWidth: screenEncodeCap.width,
+ maxHeight: screenEncodeCap.height,
+ fps: screenFpsRef.current,
createMediaRecorder,
+ onRecorderError: reportRecorderFailure,
onDataAvailable: async (blob) => {
checkMaxMemory();
@@ -5227,7 +5526,7 @@ const CloudRecorder = () => {
lastPersistedAt: timestamp,
});
- persistSessionState({ lastChunkIndex: chunkIndex });
+ requestSessionPersist({ lastChunkIndex: chunkIndex });
if (uploadersInitialized.current && screenUploader.current) {
try {
@@ -5322,7 +5621,13 @@ const CloudRecorder = () => {
screenStream.current?.getAudioTracks?.().length || 0,
});
- screenRecorder.current.start(2000);
+ const micFileFollows = Boolean(
+ rawMicStream.current?.getAudioTracks?.().length
+ );
+ if (!micFileFollows && cameraStream.current) {
+ startEpochMs = performance.now();
+ }
+ screenRecorder.current.start(2000, { startEpochMs });
// Fire and forget: the samples take 1.5s and start latency is budgeted.
void measureBusWarmup();
@@ -5372,6 +5677,7 @@ const CloudRecorder = () => {
const timestamp = Date.now();
// Small in-memory window for UI/quick fallback only.
audioChunks.current.push(blob);
+ liveTapRef.current?.push(blob);
const droppedAudio = trimChunkBuffer(
audioChunks,
AUDIO_CHUNK_MEMORY_WINDOW
@@ -5429,6 +5735,8 @@ const CloudRecorder = () => {
AUDIO_MAX_BUFFER_BYTES
) {
audioCaptureDegradedRef.current = true;
+ // The mic file ends here, so live must not seal a longer take.
+ cancelLiveTap();
void emitUploadTelemetry("upload_local_backup_degraded", {
backupType: "audio",
reason: "audio-buffer-limit",
@@ -5505,6 +5813,21 @@ const CloudRecorder = () => {
});
markStartProgress("audio-encoder-probe-done");
audioRecorder.current = audioSelection.recorder;
+ cancelLiveTap();
+ if (
+ (audioUploader.current || separatedAudio.current) &&
+ liveIdsRef.current
+ ) {
+ liveTapRef.current = createLiveTap({
+ ...liveIdsRef.current,
+ mime: audioSelection.recorder?.mimeType || audioSelection.container,
+ recorderSessionId: recorderSession.current?.id,
+ baseUrl: process.env.SCREENITY_API_BASE_URL,
+ getToken: async () =>
+ (await chrome.storage.local.get(["screenityToken"]))
+ .screenityToken,
+ });
+ }
micRecordedThisTake.current = true;
encoderKinds.audio = audioSelection.kind;
trackContainers.audio = audioSelection.container;
@@ -5518,7 +5841,11 @@ const CloudRecorder = () => {
codec: audioSelection.codec,
});
+ startEpochMs = performance.now();
audioRecorder.current.start(2000);
+ // Screen started before this epoch existed: it pads to the epoch if its
+ // first frame has not landed, and reports its signed lag either way.
+ screenRecorder.current?.setStartEpoch?.(startEpochMs);
// Same tick as start(), so the clock covers exactly what the file does.
audioTimer.current.start = Date.now();
audioTimer.current.total = 0;
@@ -5584,6 +5911,7 @@ const CloudRecorder = () => {
audioChannels: audioBusChannels.current,
enableAudio: cameraHasAudio,
createMediaRecorder,
+ onRecorderError: reportRecorderFailure,
probeOptions: {
cameraWidth: Number(cameraSettings.width) || 1280,
cameraHeight: Number(cameraSettings.height) || 720,
@@ -5706,7 +6034,7 @@ const CloudRecorder = () => {
hwSlots: cameraSelection.hwSlots,
});
- cameraRecorder.current.start(2000);
+ cameraRecorder.current.start(2000, { startEpochMs });
// Camera-only muxes the mic too, and the screen call site never runs.
void measureBusWarmup();
scheduleCameraSilenceCheck();
@@ -5856,6 +6184,7 @@ const CloudRecorder = () => {
ref.current = null;
});
tabID.current = null;
+ stopSourceProbes({ summarize: true });
// Close the AudioContext: without this the audio thread keeps
// ticking and back-to-back Pro multi recordings stack contexts.
if (aCtx.current) {
@@ -5871,6 +6200,7 @@ const CloudRecorder = () => {
// any more. Both are rebuilt with the next graph.
busTap.current = null;
busSources.current = { mic: false, system: false };
+ busSourceNodes.current = { mic: null, system: null };
recordersBuilt.current = false;
micRecordedThisTake.current = false;
}
@@ -5945,13 +6275,15 @@ const CloudRecorder = () => {
: {}),
},
credentials: "include",
+ // Fired un-awaited just before the tab closes, and a plain fetch is
+ // cancelled with the document.
+ keepalive: true,
body: JSON.stringify({
output: `transcriptions/${uploadMeta.audio.mediaId}.json`,
videoId: projectId,
sceneId,
inputMediaId: uploadMeta.audio.mediaId,
targetMediaId: transcriptionTarget,
- lang: "en",
model: "tiny",
}),
});
@@ -6248,6 +6580,8 @@ const CloudRecorder = () => {
// recording is visible before the final stop-diag.
useEffect(() => {
if (!started) return;
+ longTasks.reset();
+ longTasks.start();
const intervalId = setInterval(() => {
try {
if (!recorderSession.current?.id) return;
@@ -6267,8 +6601,6 @@ const CloudRecorder = () => {
(trackState.camera?.bytesRecorded || 0) +
(trackState.audio?.bytesRecorded || 0);
const pressure = storagePressureRef.current || {};
- const screenStats = screenRecorder.current?.getEncodeStats?.() || null;
- const cameraStats = cameraRecorder.current?.getEncodeStats?.() || null;
const writeStats = localWriteStatsRef.current || {};
void emitUploadTelemetry("recording_heartbeat", {
screenDiag: screen || null,
@@ -6288,11 +6620,7 @@ const CloudRecorder = () => {
typeof pressure.quota === "number" ? pressure.quota : null,
storageUsageBytes:
typeof pressure.usage === "number" ? pressure.usage : null,
- encodeStats: screenStats
- ? { ...screenStats, track: "screen" }
- : cameraStats
- ? { ...cameraStats, track: "camera" }
- : null,
+ encodeStats: buildEncodeStats(),
localWriteStats: writeStats.count
? {
count: writeStats.count,
@@ -6305,9 +6633,13 @@ const CloudRecorder = () => {
}
: null,
});
+ diagForward("recorder-perf", collectPerf());
} catch {}
}, 30_000);
- return () => clearInterval(intervalId);
+ return () => {
+ clearInterval(intervalId);
+ longTasks.stop();
+ };
}, [started]);
const sendEditorReady = ({
@@ -6388,6 +6720,7 @@ const CloudRecorder = () => {
projectId,
clickEvents = [],
capturedSurface = null,
+ capturedRegion = false,
multiMode,
multiSceneCount = 0,
multiLastSceneId = null,
@@ -6399,6 +6732,7 @@ const CloudRecorder = () => {
"projectId",
"clickEvents",
"capturedSurface",
+ "capturedRegion",
"multiMode",
"multiSceneCount",
"multiLastSceneId",
@@ -6502,6 +6836,24 @@ const CloudRecorder = () => {
micLanded: Boolean(separatedMic?.mediaId),
systemAudioOnScreen: stopAudio.systemAudioOnScreen,
});
+ const transcriptionSourceId = !isSilent
+ ? isSeparated
+ ? separatedMic?.mediaId || null
+ : uploadMeta.audio?.mediaId || separatedMic?.mediaId || null
+ : null;
+ const addsToNewProject =
+ !recordingToScene && (!multiMode || multiSceneCount === 0);
+ if (!addsToNewProject) {
+ const { screenityToken } = await chrome.storage.local.get([
+ "screenityToken",
+ ]);
+ insertAfterSceneId = await resolveInsertTarget({
+ projectId,
+ insertAfterSceneId,
+ apiBase: API_BASE,
+ token: screenityToken,
+ });
+ }
const payload = {
sceneId,
screenMediaId: uploadMeta.screen?.mediaId || null,
@@ -6521,11 +6873,12 @@ const CloudRecorder = () => {
recordingSessionId: recorderSession.current?.id || null,
durations,
captionSource: uploadMeta.screen ? "screen" : "camera",
- transcriptionSourceMediaId: !isSilent
- ? (isSeparated
- ? separatedMic?.mediaId || null
- : uploadMeta.audio?.mediaId || separatedMic?.mediaId || null)
- : null,
+ transcriptionSourceMediaId: transcriptionSourceId,
+ // No separate mic will be transcribed, so the app can stop promising a
+ // title and summary instead of showing "Generating..." until its window closes.
+ ...(!transcriptionSourceId && !declareSeparated
+ ? { transcriptionExpected: false }
+ : {}),
thumbnail: uploadMeta.screen?.thumbnail || null,
dimensions: {
screen: { width: screenEncoded.width, height: screenEncoded.height },
@@ -6541,8 +6894,10 @@ const CloudRecorder = () => {
// Omitted when unknown: the app defaults to monitor, and a
// guess would be worse than that default.
...(capturedSurface ? { surface: capturedSurface } : {}),
+ // A crop still reports surface "browser"; this is how the app tells it apart.
+ ...(capturedRegion === true ? { isRegion: true } : {}),
instantMode: instantMode.current,
- newProject: !recordingToScene && (!multiMode || multiSceneCount === 0),
+ newProject: addsToNewProject,
insertAfterSceneId,
isTab: isTab.current && !regionRef.current,
domain: recordedTabDomain || null,
@@ -6875,6 +7230,8 @@ const CloudRecorder = () => {
// gets a free tab-capture binding.
await stopAllRecorders();
stopFlowRef.current?.tick?.("recorders-drained");
+ if (shouldFinalize) liveStopRef.current = liveTapRef.current?.stop() || null;
+ else cancelLiveTap();
await setRecordingTimingState({
recording: false,
paused: false,
@@ -6963,41 +7320,109 @@ const CloudRecorder = () => {
// Close any server/client byte gap before declaring a length. A track whose
// PATCHes 2xx'd without landing still has its bytes on disk.
if (GAP_RESEND_ENABLED) {
- gapResendAbortRef.current = false;
- const budgetTimer = setTimeout(() => {
- gapResendAbortRef.current = true;
- }, GAP_RESEND_BUDGET_MS);
- await Promise.race([
- Promise.allSettled([
- resendUploadGap(
- "screen",
- screenUploader,
- chunksStore,
- "chunk_",
- screenChunkByteRangesRef
- ),
- resendUploadGap(
- "camera",
- cameraUploader,
- cameraChunksStore,
- "camera_chunk_",
- cameraChunkByteRangesRef
- ),
- resendUploadGap(
- "audio",
- audioUploader,
- audioChunksStore,
- "audio_chunk_",
- audioChunkByteRangesRef
- ),
- ]),
- new Promise((r) => setTimeout(r, GAP_RESEND_BUDGET_MS)),
+ await resendGapsWithinBudget();
+ }
+
+ // The drain above has run, so these offsets are final. A video track that
+ // holds only its init segment would finalize and fail at Bunny with no
+ // message, so end the take here instead.
+ const liveTrack = (uploader, track) => {
+ if (!uploader) return null;
+ const meta = uploader.getMeta?.() || {};
+ return {
+ offset: uploader.offset,
+ queueLength: meta.queueLength,
+ localBytes: sessionTrackState.current[track]?.bytesRecorded || 0,
+ };
+ };
+ const headerCheck = findHeaderOnlyTracks({
+ screen: liveTrack(screenUploader.current, "screen"),
+ camera: liveTrack(cameraUploader.current, "camera"),
+ });
+ if (headerCheck.headerOnly.length > 0) {
+ void emitUploadTelemetry("upload_error", {
+ reason: `header-only-${headerCheck.headerOnly.join("-")}${
+ headerCheck.mixed ? "-sibling-ok" : ""
+ }`,
+ uploaderType: "cloud_recorder",
+ trackType: headerCheck.headerOnly[0],
+ offset: screenUploader.current?.offset || 0,
+ });
+ }
+ if (headerCheck.fire) {
+ emptyCleanupRef.current = true;
+ cancelLiveTap();
+ await Promise.allSettled([
+ screenUploader.current?.abort?.("header-only"),
+ cameraUploader.current?.abort?.("header-only"),
+ audioUploader.current?.abort?.("header-only"),
]);
- // Stops stragglers at their next step, before finalize declares a length.
- gapResendAbortRef.current = true;
- clearTimeout(budgetTimer);
+ try {
+ const { projectId, multiMode, multiSceneCount, recordingToScene } =
+ await chrome.storage.local.get([
+ "projectId",
+ "multiMode",
+ "multiSceneCount",
+ "recordingToScene",
+ ]);
+ if (projectId) {
+ await deleteProject(
+ projectId,
+ uploadMeta,
+ !recordingToScene && (!multiMode || (multiSceneCount || 0) === 0)
+ );
+ }
+ } catch (err) {
+ console.warn("❌ Failed to cleanup header-only upload:", err);
+ }
+ await chunksStore
+ .clear()
+ .catch((e) =>
+ console.warn(
+ "[CloudRecorder] chunksStore.clear failed (header-only):",
+ e
+ )
+ );
+ emitRecordingOutcome("unrecoverable", {
+ reason: `header-only-${headerCheck.headerOnly.join("-")}`,
+ });
+ await finalizeRecorderSession("failed");
+ await clearAudioChunkStore("header-only");
+ await clearCameraChunkStore("header-only");
+ await clearLocalScreenPlaybackOffer("header-only");
+ await setPipelineState("failed", { details: "header-only" });
+ sendRecordingError(
+ "This recording was captured empty and could not be saved. Please try recording again."
+ );
+ return;
}
+ const deferredUploaders = {
+ screen: screenUploader.current,
+ camera: cameraUploader.current,
+ };
+ const deferTracks = () => [
+ describeTrack("screen", deferredUploaders.screen, {
+ backend: storageBackends.screen,
+ storeReady: idbReadyRef.current,
+ writeFailed: fatalErrorRef.current,
+ purgedChunks: screenChunksPurgedCountRef.current,
+ durableChunkCount:
+ sessionTrackState.current.screen?.durableChunkCount || 0,
+ }),
+ describeTrack("camera", deferredUploaders.camera, {
+ backend: storageBackends.camera,
+ storeReady: cameraChunkStoreReadyRef.current,
+ purgedChunks: cameraChunksPurgedCountRef.current,
+ durableChunkCount:
+ sessionTrackState.current.camera?.durableChunkCount || 0,
+ }),
+ ];
+ const deferDecision = canDeferFinalize({
+ hostAllowed: reason !== "retry-finalize" && deferFinalizeHostAllowed(),
+ tracks: deferTracks(),
+ });
+
const finalizeCalls = [
screenUploader.current?.finalize?.(),
cameraUploader.current?.finalize?.(),
@@ -7013,11 +7438,31 @@ const CloudRecorder = () => {
);
}
- const settledResults = await Promise.allSettled(finalizeCalls);
- stopFlowRef.current?.tick?.("video-uploaders-finalized", {
- count: finalizeCalls.length,
- rejected: settledResults.filter((r) => r.status === "rejected").length,
- });
+ // Bunny already holds the bytes; the close can take seconds on a long take,
+ // so the scene goes out first and the close is joined after it.
+ const deferredSettle = deferDecision.defer
+ ? createFinalizeSettle(finalizeCalls)
+ : null;
+ if (deferredSettle) {
+ deferredSettleRef.current = deferredSettle;
+ stopFlowRef.current?.tick?.("video-uploaders-finalize-deferred", {
+ count: finalizeCalls.length,
+ });
+ logDebugEvent("finalize-deferred", { stage });
+ } else {
+ stopFlowRef.current?.tick?.("video-uploaders-finalize-blocking", {
+ reason: deferDecision.reason,
+ });
+ }
+ const settledResults = deferredSettle
+ ? []
+ : await Promise.allSettled(finalizeCalls);
+ if (!deferredSettle) {
+ stopFlowRef.current?.tick?.("video-uploaders-finalized", {
+ count: finalizeCalls.length,
+ rejected: settledResults.filter((r) => r.status === "rejected").length,
+ });
+ }
const rejectedResults = settledResults.filter(
(result) => result.status === "rejected"
);
@@ -7042,13 +7487,23 @@ const CloudRecorder = () => {
const audioMeta = audioUploader.current?.getMeta?.() || null;
uploadMeta.audio =
audioFinalizeOk && audioMeta?.status === "completed" ? audioMeta : null;
+ if (!uploadMeta.audio) cancelLiveTap();
+ }
+ if (liveStopRef.current) {
+ await waitBounded(liveStopRef.current);
+ liveStopRef.current = null;
+ liveTapRef.current = null;
}
const screenMeta = screenUploader.current?.getMeta?.() || null;
const cameraMeta = cameraUploader.current?.getMeta?.() || null;
const incompleteUploaders = [];
- if (screenUploader.current && screenMeta?.status !== "completed") {
+ if (
+ !deferredSettle &&
+ screenUploader.current &&
+ screenMeta?.status !== "completed"
+ ) {
incompleteUploaders.push({
uploader: "screen",
status: screenMeta?.status || "unknown",
@@ -7057,7 +7512,11 @@ const CloudRecorder = () => {
});
}
- if (cameraUploader.current && cameraMeta?.status !== "completed") {
+ if (
+ !deferredSettle &&
+ cameraUploader.current &&
+ cameraMeta?.status !== "completed"
+ ) {
incompleteUploaders.push({
uploader: "camera",
status: cameraMeta?.status || "unknown",
@@ -7080,7 +7539,7 @@ const CloudRecorder = () => {
diagnostics,
});
finalizeError = new Error("uploader-finalize-incomplete");
- } else {
+ } else if (!deferredSettle) {
if (DEBUG_START_FLOW) {
console.info("[CloudRecorder][Finalize] Finalization complete", {
stage,
@@ -7133,8 +7592,18 @@ const CloudRecorder = () => {
return;
}
- const hasAnyScreenData = (uploadMeta.screen?.offset || 0) > 0;
- const hasAnyCameraData = (uploadMeta.camera?.offset || 0) > 0;
+ // uploadMeta was copied before the drain and finalize, so a short take can
+ // read 0 there with its bytes already on Bunny. The live offset only grows.
+ const hasAnyScreenData =
+ Math.max(
+ uploadMeta.screen?.offset || 0,
+ screenUploader.current?.offset || 0
+ ) > 0;
+ const hasAnyCameraData =
+ Math.max(
+ uploadMeta.camera?.offset || 0,
+ cameraUploader.current?.offset || 0
+ ) > 0;
const hasValidScreen =
hasAnyScreenData &&
uploadMeta.screen?.mediaId &&
@@ -7342,6 +7811,197 @@ const CloudRecorder = () => {
isInit.current = false;
+ const finishTake = async ({ deferred = false, complete = true } = {}) => {
+ // The local copy is all a failed close can be recovered from.
+ if (
+ !canReapLocalCopy({
+ deferred,
+ settled: deferredSettle?.isSettled?.() === true,
+ complete,
+ })
+ ) {
+ console.warn("[CloudRecorder] close not settled; keeping local copy");
+ return;
+ }
+ if (localScreenPlaybackOfferRef.current?.offerId) {
+ console.info(
+ "[CloudRecorder] Retaining local screen chunks for editor local-first playback",
+ {
+ offerId: localScreenPlaybackOfferRef.current.offerId,
+ projectId,
+ sceneId: uploadMeta.sceneId,
+ chunkCount: localScreenPlaybackOfferRef.current.chunkCount || 0,
+ }
+ );
+ } else {
+ await chunksStore.clear().catch(() => {});
+ }
+ if (micRecoveryPending.current) {
+ console.info(
+ "[CloudRecorder] retaining mic chunks for recovery; upload did not attach"
+ );
+ } else {
+ await clearAudioChunkStore("success");
+ }
+ await clearCameraChunkStore("success");
+ await setPipelineState("completed", {
+ projectId,
+ sceneId: uploadMeta.sceneId,
+ });
+ emitRecordingOutcome("completed", {
+ projectId,
+ sceneId: uploadMeta.sceneId,
+ mediaId:
+ uploadMeta.screen?.mediaId || uploadMeta.camera?.mediaId || null,
+ });
+ await finalizeRecorderSession("completed", {
+ // destroySessionDir removes audio/ too, so a pending recovery must hold
+ // the session open or its chunks are gone milliseconds later.
+ keepOpfsSession:
+ Boolean(localScreenPlaybackOfferRef.current?.offerId) ||
+ micRecoveryPending.current,
+ });
+ void emitUploadTelemetry("upload_complete_client", {
+ projectId,
+ sceneId: uploadMeta.sceneId,
+ uploaderType: "cloud_recorder",
+ mediaId:
+ uploadMeta.screen?.mediaId || uploadMeta.camera?.mediaId || null,
+ });
+
+ // Flush any pending telemetry IPCs to BG so events landed by
+ // the previous emit calls don't get torn off by window.close()
+ // below. 1.5s hard cap.
+ await flushInflightTelemetry();
+ if (deferred) {
+ chrome.runtime.sendMessage({ type: "video-ready", uploadMeta });
+ }
+ stopFlowRef.current?.tick?.("tab-closing");
+
+ if (!IS_IFRAME_CONTEXT) {
+ try {
+ window.close();
+ } catch {}
+ } else {
+ window.location.reload();
+ }
+ };
+
+ const failDeferredFinalize = async ({
+ settledResults: results,
+ exportCopy,
+ }) => {
+ const tracks = deferTracks();
+ const diagnostics = buildFinalizeDiagnostics({
+ stage,
+ settledResults: results,
+ rejectedResults: results.filter((r) => r.status === "rejected"),
+ incompleteUploaders: tracks
+ .filter((t) => t.present && t.status !== "completed")
+ .map((t) => ({
+ uploader: t.track,
+ status: t.status || "unknown",
+ offset: t.offset,
+ error: deferredUploaders[t.track]?.error || null,
+ stillClosing: t.stillClosing,
+ })),
+ reason: "deferred-finalize-incomplete",
+ });
+ diagnostics.deferred = true;
+ diagnostics.retryPlan = planFinalizeRetry(tracks);
+ // Set before the modal goes up, so its Retry routes here and not into a
+ // second stopRecording that would re-POST the scene.
+ deferredFinalizeRef.current = { retry: retryDeferredFinalize };
+ await markFinalizeFailure(diagnostics);
+ logDebugEvent("finalize-failed", { stage, diagnostics });
+ void emitUploadTelemetry("upload_error", {
+ reason: "deferred-finalize-incomplete",
+ uploaderType: "cloud_recorder",
+ projectId,
+ sceneId: uploadMeta.sceneId,
+ });
+ if (exportCopy) await exportLocalRecovery("finalize-error");
+ };
+
+ const settleDeferredFinalize = async () => {
+ const results = await deferredSettle.promise;
+ deferredSettleRef.current = null;
+ const verdict = evaluateFinalizeSettle({
+ settledResults: results,
+ tracks: deferTracks(),
+ });
+ stopFlowRef.current?.tick?.("video-uploaders-finalized", {
+ count: results.length,
+ rejected: verdict.rejected,
+ deferred: true,
+ complete: verdict.complete,
+ });
+ if (verdict.complete) {
+ logDebugEvent("finalize-complete", {
+ stage,
+ deferred: true,
+ screen: deferredUploaders.screen?.getMeta?.() || null,
+ camera: deferredUploaders.camera?.getMeta?.() || null,
+ });
+ return true;
+ }
+ try {
+ await failDeferredFinalize({ settledResults: results, exportCopy: true });
+ } catch (err) {
+ console.warn("[CloudRecorder] deferred finalize failure handling:", err);
+ }
+ return false;
+ };
+
+ const runDeferredRetry = async () => {
+ const plan = planFinalizeRetry(deferTracks());
+ stopFlowRef.current?.tick?.("deferred-finalize-retry", { plan });
+ logDebugEvent("finalize-retry-deferred", { stage, plan });
+ const resendTracks = plan
+ .filter((p) => p.action === "resend-and-finalize")
+ .map((p) => p.track);
+ if (GAP_RESEND_ENABLED && resendTracks.length) {
+ await resendGapsWithinBudget(resendTracks);
+ }
+ const results = await Promise.allSettled(
+ plan
+ .filter(
+ (p) =>
+ p.action === "resend-and-finalize" || p.action === "finalize-only"
+ )
+ .map((p) => deferredUploaders[p.track].finalize())
+ );
+ const verdict = evaluateFinalizeSettle({
+ settledResults: results,
+ tracks: deferTracks(),
+ });
+ stopFlowRef.current?.tick?.("deferred-finalize-retried", {
+ complete: verdict.complete,
+ rejected: verdict.rejected,
+ });
+ if (!verdict.complete) {
+ await failDeferredFinalize({ settledResults: results, exportCopy: false });
+ return;
+ }
+ deferredFinalizeRef.current = null;
+ if (IS_OFFSCREEN_HOST) {
+ chrome.runtime
+ .sendMessage({ type: "finalize-recovered" })
+ .catch(() => {});
+ }
+ await finishTake({ deferred: true, complete: true });
+ };
+
+ let deferredRetryInFlight = null;
+ const retryDeferredFinalize = () => {
+ if (!deferredRetryInFlight) {
+ deferredRetryInFlight = runDeferredRetry().finally(() => {
+ deferredRetryInFlight = null;
+ });
+ }
+ return deferredRetryInFlight;
+ };
+
if (!sentLast.current) {
sentLast.current = true;
try {
@@ -7416,7 +8076,17 @@ const CloudRecorder = () => {
.catch(() => {});
}
- chrome.runtime.sendMessage({ type: "video-ready", uploadMeta });
+ // video-ready makes the BG close this document, so a deferred close
+ // sends it from finishTake once the close has settled.
+ if (deferredSettle) {
+ await setPipelineState("finalizing", {
+ projectId,
+ sceneId: uploadMeta.sceneId,
+ details: "after-scene",
+ });
+ } else {
+ chrome.runtime.sendMessage({ type: "video-ready", uploadMeta });
+ }
// The marker and the upload were both claimed before the POST, so there
// are only two cases left: the scene already names the mic, or it does
@@ -7540,66 +8210,11 @@ const CloudRecorder = () => {
}
}
- if (localScreenPlaybackOfferRef.current?.offerId) {
- console.info(
- "[CloudRecorder] Retaining local screen chunks for editor local-first playback",
- {
- offerId: localScreenPlaybackOfferRef.current.offerId,
- projectId,
- sceneId: uploadMeta.sceneId,
- chunkCount: localScreenPlaybackOfferRef.current.chunkCount || 0,
- }
- );
- } else {
- await chunksStore.clear().catch(() => {});
- }
- if (micRecoveryPending.current) {
- console.info(
- "[CloudRecorder] retaining mic chunks for recovery; upload did not attach"
- );
- } else {
- await clearAudioChunkStore("success");
- }
- await clearCameraChunkStore("success");
- await setPipelineState("completed", {
- projectId,
- sceneId: uploadMeta.sceneId,
- });
- emitRecordingOutcome("completed", {
- projectId,
- sceneId: uploadMeta.sceneId,
- mediaId:
- uploadMeta.screen?.mediaId || uploadMeta.camera?.mediaId || null,
- });
- await finalizeRecorderSession("completed", {
- // destroySessionDir removes audio/ too, so a pending recovery must hold
- // the session open or its chunks are gone milliseconds later.
- keepOpfsSession:
- Boolean(localScreenPlaybackOfferRef.current?.offerId) ||
- micRecoveryPending.current,
- });
- void emitUploadTelemetry("upload_complete_client", {
- projectId,
- sceneId: uploadMeta.sceneId,
- uploaderType: "cloud_recorder",
- mediaId:
- uploadMeta.screen?.mediaId || uploadMeta.camera?.mediaId || null,
- });
-
- // Flush any pending telemetry IPCs to BG so events landed by
- // the previous emit calls don't get torn off by window.close()
- // below. 1.5s hard cap.
- await flushInflightTelemetry();
- stopFlowRef.current?.tick?.("tab-closing");
-
- if (!IS_IFRAME_CONTEXT) {
- try {
- window.close();
- } catch {}
- } else {
- window.location.reload();
- }
+ if (deferredSettle && !(await settleDeferredFinalize())) return;
+ await finishTake({ deferred: Boolean(deferredSettle) });
} catch (err) {
+ // Nothing below may clear the local copy while the close is in flight.
+ if (deferredSettle) await deferredSettle.promise;
console.error("❌ Failed to create scene:", err);
let userMessage = "Failed to save recording: ";
@@ -7680,9 +8295,10 @@ const CloudRecorder = () => {
}
};
- const startAudioStream = (id) =>
+ const startAudioStream = (id, { separatedMic = false } = {}) =>
acquireMicStream(id, {
toastOnBlocked: true,
+ separatedMic,
logger: { warn: console.warn },
});
@@ -7779,9 +8395,12 @@ const CloudRecorder = () => {
// Only the screen branch supersamples; clear it so a later take can't
// inherit a previous recording's value.
captureCapRef.current = null;
+ encodeCapRef.current = null;
+ screenFpsRef.current = 30;
// Same for the reported surface: unknown until this attempt's
// stream is up, and a camera take never sets one.
await setCapturedSurface(null);
+ await setCapturedRegion(false);
const prewarmedStream = streamOpts.prewarmedStream || null;
const { width = 1920, height = 1080 } = getResolutionForQuality() || {};
@@ -7944,6 +8563,7 @@ const CloudRecorder = () => {
if (target.current) {
const track = screenStream.current.getVideoTracks()[0];
await track.cropTo(target.current);
+ await setCapturedRegion(true);
} else {
sendRecordingError(
"No crop target set for region capture. Please select a region."
@@ -8058,26 +8678,58 @@ const CloudRecorder = () => {
// Region is excluded because it crops instead of downscaling. The
// kill-switch restores the tier, not the encode cap, to keep 1440p.
const isRegionRequest = data.recordingType === "region";
+ // Above 1080p only with cloud4kRecording on and the hardware probe
+ // passed; region stays at 1080p.
+ // Smoother motion tries the 60 fps tiers first; 60 is requested only if one passed.
+ const smootherStored = await chrome.storage.local.get([
+ "smootherMotion",
+ "fpsValue",
+ ]);
+ const smootherMotion = smootherMotionActive(smootherStored);
+ const encodeCap = isRegionRequest
+ ? CAP_1080P
+ : await loadCloudEncodeCapForClick({
+ smootherMotion,
+ trackFps: smootherMotion ? 60 : targetFps,
+ });
+ encodeCapRef.current = encodeCap;
+ const captureFps = requestedScreenFps(encodeCap, {
+ isRegion: isRegionRequest,
+ });
+ const highRes = encodeCap.width > CAP_1080P.width;
+ // The 60 fps speed test only measured the encode box, so capture 1:1
+ // against it rather than supersampling to a size never measured.
+ const captureOneToOne = highRes || captureFps > 30;
const screenCap =
isRegionRequest || (await isOversampleDisabled())
? null
- : computeCaptureCap(WEBCODECS_CAP_WIDTH, WEBCODECS_CAP_HEIGHT);
- const cloudCap = screenCap || {
- width: targetWidth,
- height: targetHeight,
- oversampled: false,
- };
+ : computeCaptureCap(encodeCap.width, encodeCap.height);
+ const cloudCap =
+ captureFps > 30
+ ? {
+ width: encodeCap.width,
+ height: encodeCap.height,
+ oversampled: false,
+ }
+ : screenCap || {
+ width: targetWidth,
+ height: targetHeight,
+ oversampled: false,
+ };
+ // A 2x supersample of a larger box does not fit, so highRes captures
+ // 1:1 against it (max-only constraint, as in the supersample path).
+ cloudCap.highRes = captureOneToOne;
captureCapRef.current = cloudCap;
const displayConstraints = {
audio: data.systemAudio ? true : false,
video: {
- frameRate: { ideal: targetFps, max: targetFps },
+ frameRate: { ideal: captureFps, max: captureFps },
// Not oversampling (region, or the kill-switch): keep the tier as
// `ideal` so those requests look exactly like they always did.
- width: cloudCap.oversampled
+ width: cloudCap.oversampled || cloudCap.highRes
? { max: cloudCap.width }
: { ideal: cloudCap.width, max: cloudCap.width },
- height: cloudCap.oversampled
+ height: cloudCap.oversampled || cloudCap.highRes
? { max: cloudCap.height }
: { ideal: cloudCap.height, max: cloudCap.height },
// Open the picker on Entire Screen for screen, Chrome Tab for
@@ -8140,6 +8792,34 @@ const CloudRecorder = () => {
});
}
console.log("[CloudRecorder] offscreen getDisplayMedia OK");
+ // 60 was only a request: if the track delivers less, fall back to the 30 fps
+ // ladder within the constrained capture box.
+ const deliveredFps = Number(
+ screenStream.current?.getVideoTracks?.()[0]?.getSettings?.()
+ .frameRate
+ );
+ screenFpsRef.current = chosenScreenFps(captureFps, deliveredFps);
+ if (captureFps === 60 && screenFpsRef.current !== 60) {
+ const fallbackCap = await loadCloudEncodeCapForClick({
+ smootherMotion: false,
+ trackFps: deliveredFps || 30,
+ });
+ encodeCapRef.current = smallerCap(fallbackCap, encodeCap);
+ }
+ if (captureFps === 60) {
+ chrome.runtime
+ .sendMessage({
+ type: "diag-forward",
+ event: "cloudrecorder-screen-fps",
+ data: {
+ requested: captureFps,
+ delivered: Number.isFinite(deliveredFps) ? deliveredFps : null,
+ chosen: screenFpsRef.current,
+ tier: encodeCapRef.current?.tier ?? null,
+ },
+ })
+ .catch(() => {});
+ }
} else {
if (!id) {
console.error(
@@ -8252,11 +8932,14 @@ const CloudRecorder = () => {
try {
const rawW = Number(settings.width) || 0;
const rawH = Number(settings.height) || 0;
- // The screen encoder is hard-capped at 1080p (WEBCODECS_CAP) and
- // WCR downscales onto its resize canvas, so warm at the encode
- // size rather than the capture size.
+ // The screen encoder is capped (1080p unless cloudEncodeCap raised
+ // it) and WCR downscales onto its resize canvas, so warm at the
+ // encode size, not the capture size.
+ const prewarmCap = encodeCapRef.current || CAP_1080P;
const hasSize = rawW > 0 && rawH > 0;
- const capFit = hasSize ? Math.min(1920 / rawW, 1080 / rawH, 1) : 1;
+ const capFit = hasSize
+ ? Math.min(prewarmCap.width / rawW, prewarmCap.height / rawH, 1)
+ : 1;
const w = hasSize
? Math.max(2, Math.round((rawW * capFit) / 2) * 2)
: 0;
@@ -8269,10 +8952,18 @@ const CloudRecorder = () => {
]);
const probeConfig =
fastRecorderProbe?.details?.selectedVideoConfig || null;
+ // The probe's codec was chosen at 1080p; lift its level for a
+ // warm frame bigger than L4.2 allows.
+ const prewarmCodec = avcCodecForSize(
+ probeConfig?.codec || "avc1.64002A",
+ w,
+ h,
+ screenFpsRef.current
+ );
perfMark("CloudRecorder.encoderPrewarm.fired", {
w,
h,
- codec: probeConfig?.codec || "avc1.64002A",
+ codec: prewarmCodec,
framerate:
Number(settings.frameRate) ||
Number(probeConfig?.framerate) ||
@@ -8281,7 +8972,7 @@ const CloudRecorder = () => {
void startEncoderPrewarm({
width: w,
height: h,
- codec: probeConfig?.codec || "avc1.64002A",
+ codec: prewarmCodec,
bitrate: Number(probeConfig?.bitrate) || 4_000_000,
framerate:
Number(settings.frameRate) ||
@@ -8588,6 +9279,7 @@ const CloudRecorder = () => {
// looked like no mic requested. offscreen-diag is the only channel that
// prints into the BG console from here.
micStream.current = await startAudioStream(data.defaultAudioInput, {
+ separatedMic: separatedAudio.current,
bluetoothDiag: true,
logger: {
debug: () => {},
@@ -8606,6 +9298,12 @@ const CloudRecorder = () => {
});
rawMicStream.current = micStream.current;
const micTrack = rawMicStream.current?.getAudioTracks?.()[0] || null;
+ micSettingsRef.current = separatedAudio.current
+ ? describeMicSettings(rawMicStream.current, RAW_MIC_PROCESSING)
+ : null;
+ if (micSettingsRef.current) {
+ diagForward("separated-mic-settings", micSettingsRef.current);
+ }
chrome.runtime
.sendMessage({
type: "offscreen-diag",
@@ -8623,6 +9321,7 @@ const CloudRecorder = () => {
} else {
micStream.current = null;
rawMicStream.current = null;
+ micSettingsRef.current = null;
}
// Mic track death mid-recording (unplug, OS revoke, BT disconnect): toast only,
@@ -8695,6 +9394,7 @@ const CloudRecorder = () => {
// Parallel tap so the warm-up check can read the mixed bus. A
// MediaStreamDestination is a sink and cannot be analysed directly.
busSources.current = { mic: false, system: false };
+ busSourceNodes.current = { mic: null, system: null };
recordersBuilt.current = false;
micRecordedThisTake.current = false;
try {
@@ -8742,6 +9442,7 @@ const CloudRecorder = () => {
.connect(destination.current);
if (busTap.current) audioInputGain.current.connect(busTap.current);
busSources.current.mic = true;
+ busSourceNodes.current.mic = micSource;
micStream.current = destination.current.stream;
const { micActive } = await chrome.storage.local.get(["micActive"]);
@@ -8761,6 +9462,7 @@ const CloudRecorder = () => {
.connect(destination.current);
if (busTap.current) audioOutputGain.current.connect(busTap.current);
busSources.current.system = true;
+ busSourceNodes.current.system = screenSource;
// Diagnostic only: system/tab audio can die mid-recording (tab closed,
// OS mute, BT disconnect). Log it, don't stop; video/mic continue.
@@ -8791,6 +9493,8 @@ const CloudRecorder = () => {
}
}
+ startSourceProbes();
+
// Say it, or they find out in the editor.
if (captureAudioDropped === true && data.systemAudio) {
chrome.runtime
@@ -8830,6 +9534,7 @@ const CloudRecorder = () => {
if (multiMode) {
await chrome.storage.local.set({
multiSceneCount: multiSceneCount || 0,
+ multiProjectId: videoId,
});
}
} else {
@@ -8858,9 +9563,14 @@ const CloudRecorder = () => {
}
await chrome.storage.local.set({ projectId: videoId });
- // Fresh projects already carry hasRecordingSession, so only
- // reused ones need the hint.
- if (reusedProject) notifyRecordingStarted(videoId);
+ // Fresh projects already carry hasRecordingSession, so only reused ones
+ // need the hint. A 60 fps take also says so here, before any scene
+ // exists: the capture's real fps is settled and the project is still
+ // the 30 fps shell it was created as. Never awaited.
+ const encodeFps = screenFpsRef.current === 60 ? 60 : undefined;
+ if (reusedProject || encodeFps) {
+ notifyRecordingStarted(videoId, { fps: encodeFps });
+ }
traceStep("apiProjectCreated", {
projectCreateMs,
projectReused: reusedProject,
@@ -9345,6 +10055,10 @@ const CloudRecorder = () => {
// Don't stop capture tracks here: it raced a slow start (isInit not
// yet flipped, tracks live) and killed the capture mid-start.
const drainPromise = Promise.all([
+ // A deferred close in flight is part of the upload: wait for it.
+ (request.shouldFinalize !== false &&
+ deferredSettleRef.current?.promise) ||
+ Promise.resolve(),
screenUploader.current?.waitForPendingUploads?.() ??
Promise.resolve(),
cameraUploader.current?.waitForPendingUploads?.() ??
diff --git a/src/pages/CloudRecorder/audioBusPolicy.js b/src/pages/CloudRecorder/audioBusPolicy.js
index 16a3505..b4370b8 100644
--- a/src/pages/CloudRecorder/audioBusPolicy.js
+++ b/src/pages/CloudRecorder/audioBusPolicy.js
@@ -16,6 +16,35 @@ export const shouldMuxBusAudio = ({ mic = false, system = false } = {}) =>
export const needsContextResume = ({ state, paused = false } = {}) =>
state === "suspended" && !paused;
+// After pause suspended the graph and restart tore the take down, the old
+// source nodes can keep feeding zeros once it resumes, while a fresh node on
+// the same live track carries signal. Swap each for a fresh one into the same
+// gain. The fresh node is connected before the old one is dropped, and a
+// failure keeps the old node rather than leaving the gain without a source.
+export const rebuildBusSources = ({ ctx, sources = {}, gains = {} } = {}) => {
+ const next = { ...sources };
+ for (const key of ["mic", "system"]) {
+ const old = sources[key];
+ const gain = gains[key];
+ if (!ctx || !old?.mediaStream || !gain) continue;
+ let fresh = null;
+ try {
+ fresh = ctx.createMediaStreamSource(old.mediaStream);
+ fresh.connect(gain);
+ } catch {
+ try {
+ fresh?.disconnect();
+ } catch {}
+ continue;
+ }
+ try {
+ old.disconnect();
+ } catch {}
+ next[key] = fresh;
+ }
+ return next;
+};
+
// Below this the bus is digital silence rather than a quiet room. Measured
// against float samples, so it sits far under any real noise floor.
export const BUS_SILENCE_RMS = 1e-5;
diff --git a/src/pages/CloudRecorder/blankSceneTarget.js b/src/pages/CloudRecorder/blankSceneTarget.js
new file mode 100644
index 0000000..7565050
--- /dev/null
+++ b/src/pages/CloudRecorder/blankSceneTarget.js
@@ -0,0 +1,52 @@
+// Mirrors the server's empty-scene test in POST /videos/:id/scenes: a
+// project's first scene stays blank until a take fills it.
+export const isBlankScene = (scene) =>
+ Boolean(scene) &&
+ !scene.screen &&
+ !scene.camera &&
+ scene.type !== "template" &&
+ (!Array.isArray(scene.overlays) || scene.overlays.length === 0);
+
+// The server fills insertAfterSceneId in place when it is blank, else appends.
+// An unknown target (a scene only the editor holds) or none appends too,
+// leaving a blank scene beside the take.
+export const pickInsertTarget = ({ project, insertAfterSceneId }) => {
+ const order = project?.data?.sceneOrder;
+ const scenes = project?.data?.scenes;
+ if (!Array.isArray(order) || !scenes || typeof scenes !== "object") {
+ return insertAfterSceneId ?? null;
+ }
+ if (insertAfterSceneId && scenes[insertAfterSceneId])
+ return insertAfterSceneId;
+ return order.find((id) => isBlankScene(scenes[id])) ?? null;
+};
+
+// Fails open: any miss keeps the caller's target.
+export const resolveInsertTarget = async ({
+ projectId,
+ insertAfterSceneId = null,
+ apiBase,
+ token,
+ fetchImpl = fetch,
+ timeoutMs = 3000,
+}) => {
+ if (!projectId || !apiBase) return insertAfterSceneId;
+ const controller = new AbortController();
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
+ try {
+ const res = await fetchImpl(`${apiBase}/videos/${projectId}/`, {
+ headers: token ? { Authorization: `Bearer ${token}` } : {},
+ signal: controller.signal,
+ });
+ if (!res.ok) return insertAfterSceneId;
+ const body = await res.json();
+ return pickInsertTarget({
+ project: body?.video || body,
+ insertAfterSceneId,
+ });
+ } catch {
+ return insertAfterSceneId;
+ } finally {
+ clearTimeout(timer);
+ }
+};
diff --git a/src/pages/CloudRecorder/bunnyTusUploader.js b/src/pages/CloudRecorder/bunnyTusUploader.js
index 5bac0b2..7fbc957 100644
--- a/src/pages/CloudRecorder/bunnyTusUploader.js
+++ b/src/pages/CloudRecorder/bunnyTusUploader.js
@@ -850,6 +850,7 @@ export default class BunnyTusUploader {
height = null,
linkedMediaId = null,
reuse = null,
+ fresh = false,
sceneId = null,
sessionId = null,
},
@@ -889,13 +890,17 @@ export default class BunnyTusUploader {
});
this.fingerprint = fingerprint;
- const resumeJournal = await this.getResumeJournal({
- projectId,
- sceneId,
- type,
- fingerprint,
- reuse,
- });
+ // fresh: the old video is known gone, so neither the journal nor the video
+ // map may hand its ids back.
+ const resumeJournal = fresh
+ ? null
+ : await this.getResumeJournal({
+ projectId,
+ sceneId,
+ type,
+ fingerprint,
+ reuse,
+ });
if (reuse) {
if (!reuse.videoId || !reuse.mediaId) {
@@ -937,7 +942,7 @@ export default class BunnyTusUploader {
mediaId: this.mediaId,
sessionId: this.sessionId,
});
- } else {
+ } else if (!fresh) {
const existingMap = await this.getVideoMap(projectId, sceneId, type);
if (existingMap?.videoId && existingMap?.mediaId) {
this.videoId = existingMap.videoId;
diff --git a/src/pages/CloudRecorder/cloudEncodeCap.js b/src/pages/CloudRecorder/cloudEncodeCap.js
new file mode 100644
index 0000000..90d6589
--- /dev/null
+++ b/src/pages/CloudRecorder/cloudEncodeCap.js
@@ -0,0 +1,76 @@
+// Cloud screen encode cap. 1080p by default; above that needs the cloud4kRecording
+// flag and a hardware encoder that passed the gate's large-frame probe (software
+// 4K on a weak CPU drops frames, and smooth 1080p beats stuttering 4K).
+// The cap is a box, never an upscale: a 14" MacBook lands near 1964 tall.
+// Tests: tests/unit/cloudEncodeCap.test.mjs
+
+export const CLOUD_4K_FLAG_KEY = "cloud4kRecording";
+
+export const CAP_1080P = { width: 1920, height: 1080 };
+export const CAP_1440P = { width: 2560, height: 1440 };
+export const CAP_2160P = { width: 3840, height: 2160 };
+
+// Matches the probe in fastRecorderGate.ts (LARGE_FRAME_PROBES).
+export const CLOUD_BITRATE_1080P = 16_000_000;
+export const CLOUD_BITRATE_1440P = 20_000_000;
+export const CLOUD_BITRATE_2160P = 24_000_000;
+
+// Only an explicit prefer-hardware config counts; a software pass does not.
+const hardwarePassed = (support, key) => {
+ const config = support?.[`${key}Config`];
+ return support?.[key] === true && config?.hardwareAcceleration === "prefer-hardware";
+};
+
+export const resolveCloudEncodeCap = ({ enabled, support } = {}) => {
+ if (!enabled) return { ...CAP_1080P, tier: "1080p" };
+ if (hardwarePassed(support, "supports4k")) return { ...CAP_2160P, tier: "2160p" };
+ if (hardwarePassed(support, "supports1440p")) return { ...CAP_1440P, tier: "1440p" };
+ return { ...CAP_1080P, tier: "1080p" };
+};
+
+// Smaller cap by area: the probe says what the encoder accepts, the sustained
+// test what it keeps up with.
+export const smallerCap = (a, b) =>
+ Number(a?.width) * Number(a?.height) <= Number(b?.width) * Number(b?.height) ? a : b;
+
+// Twice the frames need roughly 1.5x the bits. Must equal bitrateAtFps in
+// sustainedEncode.js (a test enforces it) so the speed test and encoder agree.
+export const FPS_BITRATE_FACTOR = 1.5;
+
+export const cloudBitrateForCap = (cap, fps = 30) => {
+ const area = Number(cap?.width) * Number(cap?.height);
+ let bitrate = CLOUD_BITRATE_1080P;
+ if (area > CAP_1440P.width * CAP_1440P.height) bitrate = CLOUD_BITRATE_2160P;
+ else if (area > CAP_1080P.width * CAP_1080P.height) bitrate = CLOUD_BITRATE_1440P;
+ return fps > 30 ? Math.round(bitrate * FPS_BITRATE_FACTOR) : bitrate;
+};
+
+// PATCH size above 1080p; the uploader's 512 KB default stays at 1080p and below.
+// Each PATCH is a serial round trip, so a high-latency link falls behind a 24 Mbps
+// stream. 2 MB keeps a 20 s PATCH timeout reachable down to about 0.8 Mbps.
+// 60 fps takes the same chunk at any size: 1080p60 is 24 Mbps, the 4K figure.
+export const UPLOAD_CHUNK_SIZE_4K = 2 * 1024 * 1024;
+
+export const uploadChunkSizeForCap = (cap, fps = 30) =>
+ Number(cap?.width) * Number(cap?.height) >
+ CAP_1080P.width * CAP_1080P.height || fps > 30
+ ? UPLOAD_CHUNK_SIZE_4K
+ : undefined;
+
+export const loadCloudEncodeCap = async () => {
+ try {
+ if (typeof chrome === "undefined" || !chrome.storage?.local) {
+ return resolveCloudEncodeCap({ enabled: false });
+ }
+ const stored = await chrome.storage.local.get([
+ CLOUD_4K_FLAG_KEY,
+ "fastRecorderProbe",
+ ]);
+ return resolveCloudEncodeCap({
+ enabled: stored[CLOUD_4K_FLAG_KEY] === true,
+ support: stored.fastRecorderProbe?.details,
+ });
+ } catch {
+ return resolveCloudEncodeCap({ enabled: false });
+ }
+};
diff --git a/src/pages/CloudRecorder/deferredFinalize.js b/src/pages/CloudRecorder/deferredFinalize.js
new file mode 100644
index 0000000..b08c63e
--- /dev/null
+++ b/src/pages/CloudRecorder/deferredFinalize.js
@@ -0,0 +1,109 @@
+// Whether Stop can create the scene before the video uploaders finish closing
+// their TUS resources, and what may happen to a track once that close settles.
+// Pure functions, no browser deps, so tests/unit can exercise them.
+
+export const VIDEO_TRACKS = ["screen", "camera"];
+
+// Only an OPFS copy counts: it lives in this session's own directory, while the
+// IDB stores are shared and the next take's start clears them.
+export const isFullDurableCopy = (durable) =>
+ Boolean(durable) &&
+ durable.backend === "opfs" &&
+ durable.storeReady === true &&
+ durable.writeFailed !== true &&
+ Number(durable.purgedChunks) === 0 &&
+ Number(durable.durableChunkCount) > 0;
+
+export const describeTrack = (track, uploader, durable = null) => ({
+ track,
+ present: Boolean(uploader),
+ uploadUrl: uploader?.uploadUrl || null,
+ mediaId: uploader?.mediaId || null,
+ videoId: uploader?.videoId || null,
+ offset: Number(uploader?.offset) || 0,
+ status: uploader?.status || null,
+ stillClosing: isStillClosing(uploader),
+ durable,
+});
+
+// Read off the live uploader, never a saved meta snapshot: the snapshot taken at
+// Stop says "uploading" for a track whose close is still in flight.
+export const isStillClosing = (uploader) =>
+ Boolean(uploader) &&
+ (uploader.isFinalizing === true || uploader.status === "finalizing");
+
+// All or nothing: one track that can't be recovered keeps the blocking join.
+export const canDeferFinalize = ({ hostAllowed, tracks = [] }) => {
+ if (!hostAllowed) return { defer: false, reason: "host" };
+ const present = tracks.filter((t) => t?.present);
+ if (!present.length) return { defer: false, reason: "no-video-tracks" };
+ for (const t of present) {
+ if (!t.uploadUrl || !t.mediaId || !t.videoId) {
+ return { defer: false, reason: `${t.track}-no-tus-resource` };
+ }
+ if (!(t.offset > 0)) return { defer: false, reason: `${t.track}-no-bytes` };
+ if (t.status === "error" || t.status === "aborted") {
+ return { defer: false, reason: `${t.track}-${t.status}` };
+ }
+ if (!isFullDurableCopy(t.durable)) {
+ return { defer: false, reason: `${t.track}-no-full-local-copy` };
+ }
+ }
+ return { defer: true, reason: "ok" };
+};
+
+// Resolves with the allSettled results and never rejects.
+export const createFinalizeSettle = (calls = []) => {
+ let settled = false;
+ const promise = Promise.allSettled(calls).then((results) => {
+ settled = true;
+ return results;
+ });
+ return { promise, isSettled: () => settled };
+};
+
+export const evaluateFinalizeSettle = ({
+ settledResults = [],
+ tracks = [],
+}) => {
+ const rejected = settledResults.filter(
+ (r) => r?.status === "rejected"
+ ).length;
+ const closing = [];
+ const incomplete = [];
+ for (const t of tracks) {
+ if (!t?.present) continue;
+ if (t.stillClosing) closing.push(t.track);
+ else if (t.status !== "completed") incomplete.push(t.track);
+ }
+ return {
+ complete: rejected === 0 && !closing.length && !incomplete.length,
+ rejected,
+ closing,
+ incomplete,
+ };
+};
+
+// "resend" re-sends only bytes past the server's offset, read from the full
+// local copy. Nothing ever aborts or re-sends a track that is still closing.
+export const planFinalizeRetry = (tracks = []) =>
+ tracks
+ .filter((t) => t?.present)
+ .map((t) => {
+ if (t.stillClosing) return { track: t.track, action: "wait" };
+ if (t.status === "completed" || t.status === "aborted") {
+ return { track: t.track, action: "none" };
+ }
+ if (isFullDurableCopy(t.durable)) {
+ return { track: t.track, action: "resend-and-finalize" };
+ }
+ return {
+ track: t.track,
+ action: "finalize-only",
+ warning: "no-full-local-copy",
+ };
+ });
+
+// The local copy is the only thing a failed close can be recovered from.
+export const canReapLocalCopy = ({ deferred, settled, complete }) =>
+ !deferred || (settled === true && complete === true);
diff --git a/src/pages/CloudRecorder/encoder/WebCodecsTrackRecorder.js b/src/pages/CloudRecorder/encoder/WebCodecsTrackRecorder.js
index d7df075..7771812 100644
--- a/src/pages/CloudRecorder/encoder/WebCodecsTrackRecorder.js
+++ b/src/pages/CloudRecorder/encoder/WebCodecsTrackRecorder.js
@@ -31,6 +31,13 @@ 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);
+ // Larger caps come from cloudEncodeCap.js. WCR fits the source inside, never upscales.
+ this.maxWidth = Number(options.maxWidth) > 0 ? Number(options.maxWidth) : 1920;
+ this.maxHeight = Number(options.maxHeight) > 0 ? Number(options.maxHeight) : 1080;
+ // Frame rate the capture really delivers. Without it WebCodecsRecorder
+ // encodes on a 30 fps clock and drops the frames in between, so a 60 fps
+ // capture would come out at 30 with no error. Null keeps that 30 default.
+ this.fps = Number(options.fps) > 0 ? Number(options.fps) : null;
// Namespaces the decoderConfig sidecar so dual-track keys don't collide.
this.trackKind = options.trackKind || "default";
this.encodeStats = null;
@@ -94,7 +101,17 @@ export class WebCodecsTrackRecorder {
}
}
- start(_timeslice) {
+ getPerfSnapshot() {
+ try {
+ return this._recorder?.getPerfSnapshot?.() || null;
+ } catch {
+ return null;
+ }
+ }
+
+ // startOptions.startEpochMs: shared take start on this page's performance.now()
+ // clock (see startLeadIn.js). Without it the file starts at its first frame.
+ start(_timeslice, startOptions = {}) {
// timeslice is a no-op: Mp4MuxerWrapper emits on its own ~1s cadence.
if (this._state !== "inactive") {
throw new Error(
@@ -199,11 +216,13 @@ export class WebCodecsTrackRecorder {
audioBitrate: this.audioBitsPerSecond,
audioChannels: this.audioChannels,
preferSoftware: this.preferSoftware,
- // Cap at 1080p; retina captures exceed AVC L4.2 (~2.2MP) and
- // throw on first frame, leaving Bunny with the 28-byte init.
- // Bunny tier caps at 1080p anyway. WCR downscales via canvas.
- width: 1920,
- height: 1080,
+ // 1080p default: a retina capture at L4.2 (~2.2MP) throws on the first
+ // frame and leaves Bunny with the 28-byte init. Larger caps (cloudEncodeCap)
+ // make WCR raise the AVC level.
+ width: this.maxWidth,
+ height: this.maxHeight,
+ ...(this.fps ? { fps: this.fps } : {}),
+ startEpochMs: startOptions?.startEpochMs,
});
this._state = "recording";
@@ -221,6 +240,13 @@ export class WebCodecsTrackRecorder {
.catch((err) => handleError(err));
}
+ // For a track whose epoch was resolved after start(). No-op before start().
+ setStartEpoch(epochMs) {
+ try {
+ this._recorder?.setStartEpoch?.(epochMs);
+ } catch {}
+ }
+
pause() {
if (this._state !== "recording") return;
try {
diff --git a/src/pages/CloudRecorder/encoder/chooseEncoder.js b/src/pages/CloudRecorder/encoder/chooseEncoder.js
index d246685..1a65706 100644
--- a/src/pages/CloudRecorder/encoder/chooseEncoder.js
+++ b/src/pages/CloudRecorder/encoder/chooseEncoder.js
@@ -292,7 +292,11 @@ export const chooseTrackEncoder = async ({
enableAudio,
createMediaRecorder,
onDataAvailable,
+ onRecorderError,
probeOptions,
+ maxWidth,
+ maxHeight,
+ fps,
}) => {
const plan = await inspectTrackPlan({ track, probeOptions, stream, separated });
@@ -351,6 +355,9 @@ export const chooseTrackEncoder = async ({
Boolean(plan.cameraPreferSoftware) ||
Boolean(plan.screenPreferSoftware),
trackKind: track,
+ maxWidth,
+ maxHeight,
+ fps,
});
recorder.ondataavailable = (event) => {
if (event.data && event.data.size > 0) {
@@ -378,6 +385,9 @@ export const chooseTrackEncoder = async ({
`[chooseEncoder] WebCodecs ${track} runtime error:`,
err,
);
+ try {
+ onRecorderError?.(err, track);
+ } catch {}
// Pro marks failures per-session (in-memory) instead of persisting
// useWebCodecsRecorder=false; fresh HW probes run each session.
void markFastRecorderFailure(`cloud-${track}-runtime`, {
diff --git a/src/pages/CloudRecorder/liveTranscription/liveAudioSession.js b/src/pages/CloudRecorder/liveTranscription/liveAudioSession.js
new file mode 100644
index 0000000..ff7221f
--- /dev/null
+++ b/src/pages/CloudRecorder/liveTranscription/liveAudioSession.js
@@ -0,0 +1,457 @@
+// Segment sizing; must match what the server expects.
+const SEGMENT_CHUNKS = 15
+const MIN_CHUNKS_TO_START = 60
+const devLog = () => {}
+
+// Sidecar to the mic recorder: sends its 2 s chunks in 30 s segments so
+// transcription can start before the take ends. The whole-file mic flow stays
+// the source of truth, so nothing here may ever hurt the recording: public
+// methods catch, and any problem ends in `degraded` (server falls back to the file).
+
+// States: buffering -> creating -> streaming -> degraded | sealed | cancelled
+const BACKOFF_MS = [1000, 3000, 8000, 20000]
+const ATTEMPTS = BACKOFF_MS.length + 1
+// About 7 MB at 15 KB/s of Opus. Past this the connection is not keeping up.
+const MAX_PENDING_SEGMENTS = 16
+// Browser online but server unwell: 'online' never fires.
+const OFFLINE_RECHECK_MS = 60000
+const DRAIN_TIMEOUT_MS = 120000
+// A create that gets no answer would hold the session in `creating` until the
+// buffer cap; each attempt gets this long before it counts as failed.
+const CREATE_TIMEOUT_MS = 15000
+
+// Rejected for the request itself: retrying the same bytes cannot change it.
+const TERMINAL_STATUS = new Set([400, 401, 403, 404, 409, 410, 413])
+// Session closed server-side: nothing to seal.
+const SESSION_CLOSED_STATUS = new Set([404, 409, 410])
+
+const hex = (buf) =>
+ Array.from(new Uint8Array(buf), (b) => b.toString(16).padStart(2, '0')).join('')
+
+export class LiveAudioSession {
+ constructor(opts = {}) {
+ this.videoId = opts.videoId
+ this.sceneId = opts.sceneId
+ this.mime = opts.mime
+ this.recorderSessionId = opts.recorderSessionId || null
+ this._baseUrl = (opts.baseUrl || '').replace(/\/+$/, '')
+ this._getToken = opts.getToken || null
+ this._fetch = opts.fetch || null
+ this._crypto = opts.crypto || null
+ this._timers = { set: opts.setTimeout || null, clear: opts.clearTimeout || null }
+ this._onlineTarget =
+ opts.onlineTarget ?? (typeof window !== 'undefined' ? window : null)
+ this._drainTimeoutMs = opts.drainTimeoutMs ?? DRAIN_TIMEOUT_MS
+ this._createTimeoutMs = opts.createTimeoutMs ?? CREATE_TIMEOUT_MS
+ this._log = opts.devLog || devLog
+
+ this._state = 'buffering'
+ this._id = null
+ this._degradedReason = null
+ this._serverClosed = false
+
+ this._current = []
+ this._chunkCount = 0
+ this._cutChunks = 0
+ this._totalBytes = 0
+ this._nextSeq = 0
+ this._queue = [] // cut but not yet acknowledged
+ this._uploading = false
+ this._idleWaiters = []
+ this._abort = null
+ this._waitTimer = null
+ this._waitResolve = null
+ this._stopPromise = null
+ this._createPromise = null
+ this._onlineHandler = null
+ }
+
+ get id() {
+ return this._id
+ }
+
+ get state() {
+ return this._state
+ }
+
+ push(blob) {
+ try {
+ if (!blob || blob.size === 0) return
+ if (this._stopPromise || this._state === 'cancelled' || this._state === 'sealed') return
+ this._chunkCount += 1
+ this._totalBytes += blob.size
+ if (this._state === 'degraded') return
+ this._current.push(blob)
+ if (this._current.length >= SEGMENT_CHUNKS) this._cut()
+ if (this._state === 'buffering' && this._chunkCount >= MIN_CHUNKS_TO_START) {
+ this._begin()
+ }
+ } catch (err) {
+ this._degrade('push-error', err)
+ }
+ }
+
+ /**
+ * Flush, drain, seal. Idempotent: every call returns the same promise.
+ * Resolves { liveSessionId } (null when live never ran or the server closed
+ * the session). The work outlives the caller's wait, so a late seal still lands.
+ */
+ stop() {
+ if (!this._stopPromise) {
+ this._stopPromise = this._stop().catch((err) => {
+ this._log('[live-audio] stop failed:', err)
+ return { liveSessionId: null }
+ })
+ }
+ return this._stopPromise
+ }
+
+ cancel() {
+ try {
+ if (this._state === 'cancelled') return
+ const wasCreated = !!this._id
+ this._state = 'cancelled'
+ this._shutdown()
+ this._releaseIdleWaiters()
+ if (wasCreated) this._sendCancel(this._id)
+ else if (this._createPromise) {
+ // The create request may still land: cancel whatever id it returns.
+ this._createPromise.then((id) => id && this._sendCancel(id)).catch(() => {})
+ }
+ } catch (err) {
+ this._log('[live-audio] cancel failed:', err)
+ }
+ }
+
+ _cut() {
+ const n = this._current.length
+ if (n === 0) return
+ const seg = {
+ seq: this._nextSeq++,
+ chunkFrom: this._cutChunks,
+ chunkTo: this._cutChunks + n - 1,
+ blob: new Blob(this._current),
+ sha256: null,
+ }
+ this._cutChunks += n
+ this._current = []
+ this._queue.push(seg)
+ if (this._queue.length > MAX_PENDING_SEGMENTS) {
+ this._degrade('buffer-cap')
+ return
+ }
+ this._pump()
+ }
+
+ _begin() {
+ this._state = 'creating'
+ this._createPromise = this._create()
+ .then((id) => {
+ if (this._state === 'cancelled') return id
+ if (this._state !== 'creating') {
+ // Degraded while the create was in flight: it must not come back to
+ // streaming with its first segments missing.
+ if (id) this._sendCancel(id)
+ return null
+ }
+ if (!id) {
+ this._degrade(this._degradedReason || 'create-failed')
+ return null
+ }
+ this._id = id
+ this._state = 'streaming'
+ this._pump()
+ return id
+ })
+ .catch((err) => {
+ this._degrade('create-error', err)
+ return null
+ })
+ }
+
+ async _create() {
+ for (let attempt = 1; attempt <= 3; attempt++) {
+ // Cancelled, or degraded while this was still retrying (a hung create
+ // reaches the buffer cap): do not try again.
+ if (this._state !== 'creating') return null
+ let res
+ try {
+ res = await this._request('/live-audio/sessions/', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({
+ videoId: this.videoId,
+ sceneId: this.sceneId,
+ mime: this.mime,
+ recorderSessionId: this.recorderSessionId,
+ }),
+ }, this._createTimeoutMs)
+ } catch {
+ res = null
+ }
+ if (res?.ok) {
+ const body = await res.json().catch(() => null)
+ if (body?.live && typeof body.liveSessionId === 'string') return body.liveSessionId
+ // live:false is the server declining (capacity, mime): not a failure.
+ this._degradedReason = `declined-${body?.reason || 'unknown'}`
+ return null
+ }
+ if (res && TERMINAL_STATUS.has(res.status)) {
+ this._degradedReason = `create-${res.status}`
+ return null
+ }
+ if (attempt < 3) await this._sleep(BACKOFF_MS[attempt - 1])
+ }
+ this._degradedReason = 'create-unreachable'
+ return null
+ }
+
+ _pump() {
+ if (this._state !== 'streaming' || this._uploading || this._queue.length === 0) {
+ this._maybeIdle()
+ return
+ }
+ this._uploading = true
+ this._uploadHead()
+ .catch((err) => this._degrade('upload-error', err))
+ .finally(() => {
+ this._uploading = false
+ this._pump()
+ })
+ }
+
+ async _uploadHead() {
+ const seg = this._queue[0]
+ if (!seg.sha256) seg.sha256 = await this._sha256(seg.blob)
+ for (let attempt = 1; ; attempt++) {
+ if (this._state !== 'streaming') return
+ let status = 0
+ try {
+ const res = await this._request(
+ `/live-audio/segment/?session=${encodeURIComponent(this._id)}&seq=${seg.seq}`,
+ {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/octet-stream',
+ 'x-live-sha256': seg.sha256,
+ 'x-live-chunks': `${seg.chunkFrom}-${seg.chunkTo}`,
+ },
+ body: seg.blob,
+ }
+ )
+ status = res.status
+ if (res.ok) {
+ this._queue.shift()
+ return
+ }
+ } catch {
+ status = 0
+ }
+ if (this._state !== 'streaming') return
+ if (TERMINAL_STATUS.has(status)) {
+ if (SESSION_CLOSED_STATUS.has(status)) this._serverClosed = true
+ this._degrade(`segment-${status}`)
+ return
+ }
+ if (attempt % ATTEMPTS === 0) await this._waitForOnline()
+ else await this._sleep(BACKOFF_MS[(attempt - 1) % BACKOFF_MS.length])
+ }
+ }
+
+ async _authHeaders() {
+ const token = this._getToken ? await this._getToken() : null
+ return token ? { Authorization: `Bearer ${token}` } : {}
+ }
+
+ async _request(path, init, timeoutMs) {
+ const f = this._fetch || globalThis.fetch
+ this._abort = this._abort || new AbortController()
+ const headers = { ...(init.headers || {}), ...(await this._authHeaders()) }
+ const url = this._baseUrl + path
+ if (!timeoutMs) return f(url, { ...init, headers, signal: this._abort.signal })
+ return this._withTimeout(timeoutMs, (signal) => f(url, { ...init, headers, signal }))
+ }
+
+ // Aborts one request after `ms`, or with the session. The timer stops once
+ // headers arrive, so a body being read is not cut short.
+ async _withTimeout(ms, run) {
+ const local = new AbortController()
+ const session = this._abort.signal
+ const onAbort = () => local.abort()
+ session.addEventListener('abort', onAbort, { once: true })
+ const t = this._setTimer(onAbort, ms)
+ try {
+ return await run(local.signal)
+ } finally {
+ this._clearTimer(t)
+ session.removeEventListener('abort', onAbort)
+ }
+ }
+
+ async _sha256(blob) {
+ const subtle = (this._crypto || globalThis.crypto).subtle
+ return hex(await subtle.digest('SHA-256', await blob.arrayBuffer()))
+ }
+
+ async _stop() {
+ if (this._state === 'cancelled') return { liveSessionId: null }
+ if (this._state === 'buffering') {
+ // Under MIN_CHUNKS_TO_START: nothing was sent.
+ this._state = 'sealed'
+ this._shutdown()
+ return { liveSessionId: null }
+ }
+ if (this._state !== 'degraded') this._cut()
+ if (this._state === 'creating') await this._createPromise
+ if (this._state === 'streaming') await this._drain()
+ if (this._state === 'cancelled' || this._serverClosed || !this._id) {
+ this._shutdown()
+ return { liveSessionId: null }
+ }
+ const degraded = this._state === 'degraded' || this._queue.length > 0
+ const reason = degraded ? this._degradedReason || 'incomplete' : null
+ if (this._state === 'streaming' && degraded) this._state = 'degraded'
+ await this._seal(degraded, reason)
+ const id = this._id
+ if (!this._serverClosed) this._state = this._state === 'degraded' ? 'degraded' : 'sealed'
+ this._shutdown()
+ return { liveSessionId: this._serverClosed ? null : id }
+ }
+
+ _drain() {
+ return new Promise((resolve) => {
+ const done = () => resolve()
+ this._idleWaiters.push(done)
+ const t = this._setTimer(() => resolve(), this._drainTimeoutMs)
+ this._idleWaiters.push(() => this._clearTimer(t))
+ this._maybeIdle()
+ })
+ }
+
+ _maybeIdle() {
+ const settled =
+ this._state !== 'streaming' || (this._queue.length === 0 && !this._uploading)
+ if (settled) this._releaseIdleWaiters()
+ }
+
+ _releaseIdleWaiters() {
+ const waiters = this._idleWaiters
+ this._idleWaiters = []
+ waiters.forEach((w) => w())
+ }
+
+ async _seal(degraded, degradedReason) {
+ const body = JSON.stringify({
+ lastSeq: this._nextSeq - 1,
+ totalBytes: this._totalBytes,
+ chunkCount: this._chunkCount,
+ degraded,
+ ...(degradedReason ? { degradedReason } : {}),
+ })
+ for (let attempt = 1; attempt <= 3; attempt++) {
+ try {
+ const res = await this._request(`/live-audio/${encodeURIComponent(this._id)}/seal/`, {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body,
+ })
+ if (res.ok) return true
+ if (SESSION_CLOSED_STATUS.has(res.status)) {
+ this._serverClosed = true
+ return false
+ }
+ if (TERMINAL_STATUS.has(res.status)) return false
+ } catch {}
+ if (this._state === 'cancelled') return false
+ if (attempt < 3) await this._sleep(BACKOFF_MS[attempt - 1])
+ }
+ return false
+ }
+
+ _degrade(reason, err) {
+ if (this._state === 'degraded' || this._state === 'cancelled' || this._state === 'sealed') return
+ this._log(`[live-audio] degraded (${reason})`, err || '')
+ this._state = 'degraded'
+ this._degradedReason = reason
+ this._queue = []
+ this._current = []
+ this._abortInFlight()
+ this._clearWait()
+ this._releaseIdleWaiters()
+ }
+
+ _sendCancel(id) {
+ try {
+ const f = this._fetch || globalThis.fetch
+ Promise.resolve(this._authHeaders())
+ .then((auth) =>
+ f(`${this._baseUrl}/live-audio/${encodeURIComponent(id)}/cancel/`, {
+ method: 'POST',
+ headers: auth,
+ keepalive: true,
+ })
+ )
+ .catch(() => {})
+ } catch {
+ // best effort: the sweeper deletes an abandoned session
+ }
+ }
+
+ _abortInFlight() {
+ try {
+ this._abort?.abort()
+ } catch {}
+ this._abort = null
+ }
+
+ _shutdown() {
+ this._queue = []
+ this._current = []
+ this._abortInFlight()
+ this._clearWait()
+ }
+
+ _setTimer(fn, ms) {
+ return (this._timers.set || globalThis.setTimeout)(fn, ms)
+ }
+
+ _clearTimer(t) {
+ ;(this._timers.clear || globalThis.clearTimeout)(t)
+ }
+
+ _sleep(ms) {
+ return new Promise((resolve) => {
+ this._waitResolve = resolve
+ this._waitTimer = this._setTimer(resolve, ms)
+ })
+ }
+
+ _waitForOnline() {
+ return new Promise((resolve) => {
+ const target = this._onlineTarget
+ const finish = () => {
+ this._clearWait()
+ resolve()
+ }
+ this._waitResolve = resolve
+ this._waitTimer = this._setTimer(finish, OFFLINE_RECHECK_MS)
+ if (target?.addEventListener) {
+ this._onlineHandler = finish
+ target.addEventListener('online', finish, { once: true })
+ }
+ })
+ }
+
+ // Also wakes the upload loop, which then sees the state changed and ends.
+ _clearWait() {
+ if (this._waitTimer) this._clearTimer(this._waitTimer)
+ this._waitTimer = null
+ const wake = this._waitResolve
+ this._waitResolve = null
+ wake?.()
+ if (this._onlineHandler && this._onlineTarget?.removeEventListener) {
+ this._onlineTarget.removeEventListener('online', this._onlineHandler)
+ }
+ this._onlineHandler = null
+ }
+}
diff --git a/src/pages/CloudRecorder/liveTranscription/liveTap.js b/src/pages/CloudRecorder/liveTranscription/liveTap.js
new file mode 100644
index 0000000..fd27a9c
--- /dev/null
+++ b/src/pages/CloudRecorder/liveTranscription/liveTap.js
@@ -0,0 +1,80 @@
+import { LiveAudioSession } from "./liveAudioSession";
+
+// Default ON: only the string "false" disables it. Bare process.env read so
+// webpack's DefinePlugin inlines it.
+export const isLiveTranscriptionEnabled = () =>
+ process.env.ENABLE_LIVE_TRANSCRIPTION !== "false";
+
+const NONE = Object.freeze({ liveSessionId: null });
+
+const isSupportedMime = (mime) => /^audio\/(webm|mp4)/i.test(mime || "");
+
+// Returns null whenever live should not run, so callers do `tap?.push(blob)`.
+// Nothing here may throw into the recorder or the upload path.
+export const createLiveTap = ({
+ enabled = isLiveTranscriptionEnabled(),
+ videoId,
+ sceneId,
+ mime,
+ recorderSessionId,
+ baseUrl,
+ getToken,
+ fetch,
+ SessionClass = LiveAudioSession,
+}) => {
+ if (!enabled || !videoId || !sceneId) return null;
+ // A base without a scheme (localhost:3000/api) would resolve against the
+ // extension origin and every request would miss.
+ if (!/^https?:\/\//i.test(baseUrl || "")) return null;
+ if (!isSupportedMime(mime)) return null;
+ let session;
+ try {
+ session = new SessionClass({
+ videoId: String(videoId),
+ sceneId,
+ mime,
+ recorderSessionId,
+ baseUrl,
+ getToken,
+ fetch,
+ });
+ } catch {
+ return null;
+ }
+ return {
+ push(blob) {
+ try {
+ session.push(blob);
+ } catch {}
+ },
+ stop() {
+ try {
+ return Promise.resolve(session.stop()).catch(() => NONE);
+ } catch {
+ return Promise.resolve(NONE);
+ }
+ },
+ cancel() {
+ try {
+ session.cancel();
+ } catch {}
+ },
+ };
+};
+
+// The seal keeps going in the background if it outlasts ms.
+export const waitBounded = (promise, ms = 5000) =>
+ new Promise((resolve) => {
+ if (!promise) return resolve(NONE);
+ const t = setTimeout(() => resolve(NONE), ms);
+ promise.then(
+ (v) => {
+ clearTimeout(t);
+ resolve(v);
+ },
+ () => {
+ clearTimeout(t);
+ resolve(NONE);
+ }
+ );
+ });
diff --git a/src/pages/CloudRecorder/loadSustainedCloudCap.js b/src/pages/CloudRecorder/loadSustainedCloudCap.js
new file mode 100644
index 0000000..ee9240b
--- /dev/null
+++ b/src/pages/CloudRecorder/loadSustainedCloudCap.js
@@ -0,0 +1,95 @@
+// Cloud encode cap bounded by what the device sustains (sustainedEncode.js).
+// Separate from cloudEncodeCap.js so that file stays importable by the unit tests.
+import {
+ CAP_1080P,
+ CAP_1440P,
+ CAP_2160P,
+ loadCloudEncodeCap,
+ smallerCap,
+} from "./cloudEncodeCap";
+import { resolveSustainedTier, measureEncodeRate } from "./sustainedEncode";
+import { avcCodecForSize } from "../../media/avcLevel";
+import { prewarmSustainedEncode, prewarmSpeedTest } from "../Recorder/prewarmSustained";
+import { smootherMotionActive } from "./screenFps";
+
+const CAP_BY_TIER = { "2160p": CAP_2160P, "1440p": CAP_1440P, "1080p": CAP_1080P };
+
+// What CloudRecorder asks getDisplayMedia for by default. The 60 fps rungs run
+// only with smoother motion on, and need a capture track delivering >= 50 fps.
+export const CLOUD_CAPTURE_FPS = 30;
+
+// One run per frame rate and tier ceiling, shared by the prewarm and the click.
+const sustained = new Map();
+
+const readSmootherMotion = async () => {
+ try {
+ return smootherMotionActive(
+ await chrome.storage.local.get(["smootherMotion", "fpsValue"])
+ );
+ } catch {
+ return false;
+ }
+};
+
+export const loadCloudEncodeCapSustained = async ({
+ smootherMotion = false,
+ trackFps = CLOUD_CAPTURE_FPS,
+} = {}) => {
+ const base = await loadCloudEncodeCap();
+ const preferFps = smootherMotion === true && Number(trackFps) >= 50 ? 60 : 30;
+ // At 30 fps 1080p is the floor and needs no test. 60 fps is tested at every
+ // tier the account may use, 1080p included.
+ if (base.tier === "1080p" && preferFps === 30) return { ...base, fps: 30 };
+ try {
+ const runKey = `${preferFps}:${base.tier}`;
+ if (!sustained.has(runKey)) {
+ sustained.set(
+ runKey,
+ resolveSustainedTier({
+ preferFps,
+ maxTier: base.tier,
+ measure: (tier, opts) =>
+ measureEncodeRate(tier, { ...opts, codecFor: avcCodecForSize }),
+ })
+ );
+ }
+ const { tier, fps } = await sustained.get(runKey);
+ const cap = { ...CAP_BY_TIER[tier], tier };
+ return { ...smallerCap(base, cap), fps };
+ } catch {
+ return { ...base, fps: 30 };
+ }
+};
+
+// getDisplayMedia needs a recent user gesture and a cold speed test runs up to
+// 6 s, so wait briefly: a cold cache records this take at 1080p, the test
+// finishes for the next.
+const COLD_CAP_WAIT_MS = 250;
+
+export const loadCloudEncodeCapForClick = async (opts) => {
+ const measured = loadCloudEncodeCapSustained(opts);
+ const cold = new Promise((resolve) =>
+ setTimeout(
+ () => resolve({ ...CAP_1080P, tier: "1080p", fps: 30 }),
+ COLD_CAP_WAIT_MS
+ )
+ );
+ return Promise.race([measured, cold]);
+};
+
+// With cloud4kRecording off and smoother motion off the cloud part is a no-op
+// (the loader returns before measuring).
+export const prewarmCloudEncodeCap = () =>
+ prewarmSpeedTest(async () => {
+ try {
+ const smootherMotion = await readSmootherMotion();
+ await loadCloudEncodeCapSustained({
+ smootherMotion,
+ // Smoother motion asks for 60 at the click, so warm the 60 fps tiers.
+ trackFps: smootherMotion ? 60 : CLOUD_CAPTURE_FPS,
+ });
+ } catch {}
+ // After the cloud run, not beside it: two flat-out encodes skew each
+ // other's rates. Local Auto reads the same cache.
+ await prewarmSustainedEncode();
+ });
diff --git a/src/pages/CloudRecorder/micRecovery.js b/src/pages/CloudRecorder/micRecovery.js
index 5c836e1..12b70cc 100644
--- a/src/pages/CloudRecorder/micRecovery.js
+++ b/src/pages/CloudRecorder/micRecovery.js
@@ -178,7 +178,6 @@ const queueTranscription = async ({
sceneId,
inputMediaId: audioMediaId,
targetMediaId,
- lang: "en",
model: "tiny",
}),
});
diff --git a/src/pages/CloudRecorder/notifyRecordingStarted.js b/src/pages/CloudRecorder/notifyRecordingStarted.js
index b23963c..805c4ad 100644
--- a/src/pages/CloudRecorder/notifyRecordingStarted.js
+++ b/src/pages/CloudRecorder/notifyRecordingStarted.js
@@ -1,19 +1,31 @@
const API_BASE = process.env.SCREENITY_API_BASE_URL;
+// What the server is told about the take, besides that it started. Only a 60 fps
+// take says anything: 30 is what every project is created with, so sending it
+// would change nothing. Tests: tests/unit/notifyRecordingStarted.test.mjs
+export const recordingStartedBody = (fps) =>
+ fps === 60 ? JSON.stringify({ fps: 60 }) : null;
+
// Tells app-web a capture is running so its auto-render sweep skips
-// this project. Scheduling hint only, so failures stay silent.
-export const notifyRecordingStarted = (projectId) => {
+// this project, and, for a 60 fps take, the frame rate it encodes at so the
+// project is not left at the 30 it was created with. The server only raises an
+// empty project, so a reused one with media keeps its fps. Scheduling hint
+// only: fire and forget, failures stay silent.
+export const notifyRecordingStarted = (projectId, { fps } = {}) => {
if (!projectId || !API_BASE) return;
(async () => {
try {
const { screenityToken } = await chrome.storage.local.get([
"screenityToken",
]);
+ const body = recordingStartedBody(fps);
await fetch(`${API_BASE}/videos/${projectId}/recording-started/`, {
method: "POST",
- headers: screenityToken
- ? { Authorization: `Bearer ${screenityToken}` }
- : {},
+ headers: {
+ ...(body ? { "Content-Type": "application/json" } : {}),
+ ...(screenityToken ? { Authorization: `Bearer ${screenityToken}` } : {}),
+ },
+ ...(body ? { body } : {}),
});
} catch {}
})();
diff --git a/src/pages/CloudRecorder/screenFps.js b/src/pages/CloudRecorder/screenFps.js
new file mode 100644
index 0000000..bfbb2f5
--- /dev/null
+++ b/src/pages/CloudRecorder/screenFps.js
@@ -0,0 +1,22 @@
+// Frame rate decisions for the cloud screen capture. Kept apart from
+// CloudRecorder.jsx so the rules can be unit tested on their own.
+// Tests: tests/unit/screenFps.test.mjs
+
+// A 60 fps request only counts if the capture track really delivers this much.
+// Displays at 30 Hz, throttled tabs and some capture paths hand back 30.
+export const MIN_DELIVERED_60 = 50
+
+// The checkbox is disabled under a fixed fps, so a stored smootherMotion is
+// stale then. Same rule as getFreeCaptureCaps in Recorder/recorderConfig.js.
+export const smootherMotionActive = ({ smootherMotion, fpsValue } = {}) =>
+ smootherMotion === true && !(Number.parseInt(fpsValue, 10) > 0)
+
+// What to ask getDisplayMedia for: 60 only when the speed test passed a 60 fps
+// tier (encodeCap.fps) and it is not a region capture.
+export const requestedScreenFps = (encodeCap, { isRegion = false } = {}) =>
+ !isRegion && encodeCap?.fps === 60 ? 60 : 30
+
+// The frame rate the encoder is configured for: 60 only when it was requested and
+// the track delivers it. Never claims 60 on a 30 fps capture.
+export const chosenScreenFps = (requestedFps, trackFrameRate) =>
+ requestedFps === 60 && Number(trackFrameRate) >= MIN_DELIVERED_60 ? 60 : 30
diff --git a/src/pages/CloudRecorder/sustainedEncode.js b/src/pages/CloudRecorder/sustainedEncode.js
new file mode 100644
index 0000000..a8d17e6
--- /dev/null
+++ b/src/pages/CloudRecorder/sustainedEncode.js
@@ -0,0 +1,307 @@
+/*
+ * Which encode tier a device can SUSTAIN. isConfigSupported only says the
+ * encoder accepts a config, not that it keeps up (a laptop can accept 4K and
+ * still drop a third of its frames), so each tier gets one flat-out synthetic
+ * encode, cached per device. Largest tier first, first pass wins.
+ *
+ * Warm-up frames are excluded from the rate: the startup grace buffer covers the
+ * cold-start ramp, and counting it would fail every device on its first run.
+ * Imports nothing so the unit tests can load it alone.
+ */
+export const TARGET_FPS = 30
+export const SUSTAIN_FACTOR = 1.25
+export const WARMUP_FRAMES = 15
+export const MEASURE_FRAMES = 60
+export const CACHE_KEY = "screenity_encode_ladder_v1"
+export const CACHE_TTL_MS = 14 * 24 * 60 * 60 * 1000
+
+// A passing tier takes about 2 s (an M1 Pro measured 1.6 s for 4K), so one
+// still running at 4 s is failing. The ladder gives up at 6 s; unmeasured tiers
+// land on 1080p.
+export const TIER_TIMEOUT_MS = 4_000
+export const TOTAL_BUDGET_MS = 6_000
+
+// Not a verdict on the device: a freshly launched Chrome's hardware encoder
+// emits nothing for the first 4 to 5 s, so a 4K-capable machine can time out
+// and would be cached as rate 0, stuck below 4K for the cache lifetime.
+export const TIMED_OUT = -1
+
+// A runtime encoder error or failed flush. Unlike unsupported (0, a stable
+// property of the device) it can be transient, e.g. the hardware encoder slot
+// held by a starting recording, so it fails this load and is never cached.
+export const RUN_FAILED = -2
+
+// Timeouts get a short negative cache so a marginal device does not rerun a
+// 4 to 6 s speed test on every injected iframe load. It is only ever read as
+// "failed", never as a pass. The key hangs off CACHE_KEY so a version bump
+// invalidates both.
+export const TIMEOUT_CACHE_KEY = `${CACHE_KEY}_timeouts`
+export const TIMEOUT_TTL_MS = 6 * 60 * 60 * 1000
+
+export const TIERS = [
+ { tier: "2160p", width: 3840, height: 2160, bitrate: 24_000_000 },
+ { tier: "1440p", width: 2560, height: 1440, bitrate: 20_000_000 },
+ { tier: "1080p", width: 1920, height: 1080, bitrate: 16_000_000 },
+]
+
+// Tiers no larger than maxTier; no maxTier means all of them. A 1080p-capped
+// account has no use for a 4K or 1440p test.
+export const tiersUpTo = (maxTier) => {
+ const i = TIERS.findIndex((t) => t.tier === maxTier)
+ return i < 0 ? TIERS : TIERS.slice(i)
+}
+
+// 30 fps keeps the bare tier name so results cached before 60 fps stay valid.
+export const rateKey = (tier, fps = TARGET_FPS) =>
+ fps === TARGET_FPS ? tier : `${tier}@${fps}`
+
+// Twice the frames need roughly 1.5x the bits.
+export const bitrateAtFps = (bitrate, fps = TARGET_FPS) =>
+ fps > TARGET_FPS ? Math.round(bitrate * 1.5) : bitrate
+
+export const passes = (rate, fps = TARGET_FPS, factor = SUSTAIN_FACTOR) =>
+ Number.isFinite(rate) && rate >= fps * factor
+
+// At 30 fps 1080p is the floor, returned even when unmeasured or failing (a slow
+// 1080p beats refusing to record). Above 30 there is no floor: null means use
+// the 30 fps ladder.
+export const pickTier = (rates = {}, opts = {}) => {
+ const fps = opts.fps ?? TARGET_FPS
+ for (const t of tiersUpTo(opts.maxTier)) {
+ if (fps === TARGET_FPS && t.tier === "1080p") break
+ if (passes(rates[rateKey(t.tier, fps)], fps, opts.factor)) {
+ return { ...t, fps }
+ }
+ }
+ return fps === TARGET_FPS ? { ...TIERS[TIERS.length - 1], fps } : null
+}
+
+// A new GPU, driver or browser build changes what the encoder can do, so any of
+// them invalidates a cached result.
+export const deviceKey = () => {
+ if (typeof navigator === "undefined") return "unknown"
+ return [navigator.userAgent, navigator.hardwareConcurrency].join("|")
+}
+
+export const readCache = (storage, now = Date.now(), key = deviceKey()) => {
+ try {
+ const raw = storage?.getItem(CACHE_KEY)
+ if (!raw) return null
+ const v = JSON.parse(raw)
+ if (v?.key !== key || !(now - v.at < CACHE_TTL_MS)) return null
+ return v.rates && typeof v.rates === "object" ? v.rates : null
+ } catch {
+ return null
+ }
+}
+
+export const writeCache = (storage, rates, now = Date.now(), key = deviceKey()) => {
+ try {
+ storage?.setItem(CACHE_KEY, JSON.stringify({ key, at: now, rates }))
+ } catch {}
+}
+
+// Rate in fps; 0 means unsupported, RUN_FAILED a runtime error, TIMED_OUT out of
+// time. Never throws.
+export const measureEncodeRate = async (
+ { width, height, bitrate },
+ { fps = TARGET_FPS, timeoutMs = 15_000, codecFor } = {}
+) => {
+ try {
+ if (
+ typeof VideoEncoder === "undefined" ||
+ typeof VideoFrame === "undefined" ||
+ typeof OffscreenCanvas === "undefined"
+ ) {
+ return 0
+ }
+ const config = {
+ // codecFor lifts the AVC level for large frames (media/avcLevel); the
+ // fallback is level 5.1, which every tier fits.
+ codec: codecFor ? codecFor("avc1.64002A", width, height, fps) : "avc1.640033",
+ width,
+ height,
+ bitrate,
+ framerate: fps,
+ hardwareAcceleration: "prefer-hardware",
+ latencyMode: "realtime",
+ }
+ const support = await VideoEncoder.isConfigSupported(config)
+ if (!support?.supported) return 0
+
+ // Two distinct frames keep the encoder off a static image; each 4K canvas is
+ // about 33 MB.
+ const sources = Array.from({ length: 2 }, (_, i) => {
+ const c = new OffscreenCanvas(width, height)
+ const g = c.getContext("2d")
+ g.fillStyle = `hsl(${(i * 47) % 360},70%,50%)`
+ g.fillRect(0, 0, width, height)
+ g.fillStyle = "#fff"
+ for (let k = 0; k < 30; k += 1) {
+ g.fillRect(
+ (i * 53 + k * 97) % width,
+ (k * 71 + i * 29) % height,
+ width / 8,
+ height / 12
+ )
+ }
+ return c
+ })
+
+ let failed = false
+ const encoder = new VideoEncoder({
+ output: () => {},
+ error: () => {
+ failed = true
+ },
+ })
+ encoder.configure(config)
+
+ const frameUs = Math.round(1_000_000 / fps)
+ const total = WARMUP_FRAMES + MEASURE_FRAMES
+ let sent = 0
+ let measureStart = 0
+ const deadline = performance.now() + timeoutMs
+ // flush() can hang on a struggling encoder, so race it. Resolves true
+ // (flushed), false (encoder error) or null (deadline).
+ const flushBy = async () => {
+ const done = encoder.flush().then(
+ () => true,
+ () => false
+ )
+ const late = new Promise((r) =>
+ setTimeout(() => r(null), Math.max(0, deadline - performance.now()))
+ )
+ return Promise.race([done, late])
+ }
+ try {
+ while (sent < total && !failed) {
+ if (performance.now() > deadline) return TIMED_OUT
+ if (encoder.encodeQueueSize > 6) {
+ await new Promise((r) => setTimeout(r, 1))
+ continue
+ }
+ if (sent === WARMUP_FRAMES) {
+ const warmFlush = await flushBy()
+ if (warmFlush === null) return TIMED_OUT
+ if (!warmFlush) return RUN_FAILED
+ measureStart = performance.now()
+ }
+ const frame = new VideoFrame(sources[sent % sources.length], {
+ timestamp: sent * frameUs,
+ })
+ encoder.encode(frame, { keyFrame: sent % 60 === 0 })
+ frame.close()
+ sent += 1
+ }
+ const finalFlush = await flushBy()
+ if (finalFlush === null) return TIMED_OUT
+ if (!finalFlush) return RUN_FAILED
+ } finally {
+ try {
+ encoder.close()
+ } catch {}
+ }
+ if (failed || !measureStart) return RUN_FAILED
+ const seconds = (performance.now() - measureStart) / 1000
+ return seconds > 0 ? MEASURE_FRAMES / seconds : RUN_FAILED
+ } catch {
+ return RUN_FAILED
+ }
+}
+
+// Rate keys that timed out within the TTL for this device.
+export const readTimeouts = (storage, now = Date.now(), key = deviceKey()) => {
+ try {
+ const raw = storage?.getItem(TIMEOUT_CACHE_KEY)
+ if (!raw) return {}
+ const v = JSON.parse(raw)
+ if (v?.key !== key || !v.at || typeof v.at !== "object") return {}
+ return Object.fromEntries(
+ Object.entries(v.at).filter(
+ ([, t]) => Number.isFinite(t) && t <= now && now - t < TIMEOUT_TTL_MS
+ )
+ )
+ } catch {
+ return {}
+ }
+}
+
+export const writeTimeouts = (storage, at, now = Date.now(), key = deviceKey()) => {
+ try {
+ storage?.setItem(TIMEOUT_CACHE_KEY, JSON.stringify({ key, at }))
+ } catch {}
+}
+
+// Measures only what the cache lacks; a capable machine runs one test. With
+// preferFps above 30 it tries those tiers first, then the 30 fps ladder.
+export const resolveSustainedTier = async ({
+ measure = measureEncodeRate,
+ storage = typeof localStorage === "undefined" ? null : localStorage,
+ now = Date.now(),
+ key = deviceKey(),
+ preferFps = TARGET_FPS,
+ maxTier,
+ budgetMs = TOTAL_BUDGET_MS,
+ tierTimeoutMs = TIER_TIMEOUT_MS,
+ clock = () => performance.now(),
+} = {}) => {
+ const budgetEnd = clock() + budgetMs
+ const rates = { ...(readCache(storage, now, key) || {}) }
+ let changed = false
+ // Timed out or failed at runtime: counts as failed this load, never cached.
+ const skipped = new Set()
+ const timeouts = readTimeouts(storage, now, key)
+ let timeoutsChanged = false
+ const sweep = async (fps) => {
+ for (const t of tiersUpTo(maxTier)) {
+ if (fps === TARGET_FPS && t.tier === "1080p") break
+ const k = rateKey(t.tier, fps)
+ if (!(k in rates) && k in timeouts) {
+ // Timed out recently: failed without re-measuring.
+ rates[k] = 0
+ skipped.add(k)
+ } else if (!(k in rates)) {
+ const left = budgetEnd - clock()
+ if (left <= 0) break
+ const timeoutMs = Math.min(tierTimeoutMs, left)
+ const rate = await measure(
+ { ...t, bitrate: bitrateAtFps(t.bitrate, fps) },
+ { fps, timeoutMs }
+ )
+ if (rate === TIMED_OUT || rate === RUN_FAILED) {
+ rates[k] = 0
+ skipped.add(k)
+ // A run cut short by the total budget says nothing about the tier.
+ const cutShort = timeoutMs < tierTimeoutMs
+ if (rate === TIMED_OUT && !cutShort) {
+ timeouts[k] = now
+ timeoutsChanged = true
+ }
+ if (rate === TIMED_OUT && cutShort) break
+ continue
+ }
+ rates[k] = rate
+ changed = true
+ }
+ if (passes(rates[k], fps)) break
+ }
+ }
+ let picked = null
+ if (preferFps > TARGET_FPS) {
+ await sweep(preferFps)
+ picked = pickTier(rates, { fps: preferFps, maxTier })
+ }
+ if (!picked) {
+ await sweep(TARGET_FPS)
+ picked = pickTier(rates, { fps: TARGET_FPS, maxTier })
+ }
+ if (timeoutsChanged) writeTimeouts(storage, timeouts, now, key)
+ if (changed) {
+ const cacheable = Object.fromEntries(
+ Object.entries(rates).filter(([k]) => !skipped.has(k))
+ )
+ writeCache(storage, cacheable, now, key)
+ }
+ return { ...picked, rates }
+}
diff --git a/src/pages/CloudRecorder/trackStallSweep.js b/src/pages/CloudRecorder/trackStallSweep.js
index bcf557a..18fd6d7 100644
--- a/src/pages/CloudRecorder/trackStallSweep.js
+++ b/src/pages/CloudRecorder/trackStallSweep.js
@@ -63,3 +63,29 @@ export const sweepTrackStalls = ({
}
return reports;
};
+
+// Stop-time check: a track whose upload holds only the muxer's init segment.
+// `offset` must be the live uploader offset after the final drain, not the
+// getMeta() copy taken at stop, which is routinely stale on short takes.
+// Fires only when no track carries real media, so a header-only sibling of a
+// healthy track is reported as `mixed` and left alone.
+export const findHeaderOnlyTracks = (tracks, initOnlyOffset = INIT_ONLY_OFFSET) => {
+ const headerOnly = [];
+ let carriesMedia = false;
+ for (const [track, t] of Object.entries(tracks)) {
+ if (!t) continue;
+ const offset = Number(t.offset) || 0;
+ if (offset === 0) continue;
+ const initOnly =
+ offset <= initOnlyOffset &&
+ (Number(t.queueLength) || 0) === 0 &&
+ (Number(t.localBytes) || 0) <= initOnlyOffset;
+ if (initOnly) headerOnly.push(track);
+ else carriesMedia = true;
+ }
+ return {
+ headerOnly,
+ fire: headerOnly.length > 0 && !carriesMedia,
+ mixed: headerOnly.length > 0 && carriesMedia,
+ };
+};
diff --git a/src/pages/Components/Warning.jsx b/src/pages/Components/Warning.jsx
index c1f651d..8ece1b0 100644
--- a/src/pages/Components/Warning.jsx
+++ b/src/pages/Components/Warning.jsx
@@ -11,6 +11,7 @@ import { ReactSVG } from "react-svg";
import * as ToastEl from "@radix-ui/react-toast";
import { shouldUseDisplayMediaForScreen } from "../utils/screenCaptureMode";
+import { hasComputerAudioToShare } from "../utils/systemAudioGuidance";
// shared between CloudRecorder and Recorder; alwaysInteractive keeps the viewport clickable (CloudRecorder) vs pass-through-until-open (Recorder)
const Warning = ({ alwaysInteractive = false }) => {
@@ -30,8 +31,9 @@ const Warning = ({ alwaysInteractive = false }) => {
// macOS + Chrome 141+ captures system audio via getDisplayMedia, so show Windows-style guidance; read the same flags the capture path uses
const isMac = navigator.userAgent.indexOf("Mac") !== -1;
chrome.storage.local.get(
- ["forceDisplayMediaScreen", "macSystemAudioCapture"],
- ({ forceDisplayMediaScreen, macSystemAudioCapture }) => {
+ ["forceDisplayMediaScreen", "macSystemAudioCapture", "recordingType"],
+ ({ forceDisplayMediaScreen, macSystemAudioCapture, recordingType }) => {
+ if (!hasComputerAudioToShare(recordingType)) return;
const useDisplayMedia = shouldUseDisplayMediaForScreen({
forceDisplayMediaScreen,
macSystemAudioCapture,
diff --git a/src/pages/Content/Wrapper.jsx b/src/pages/Content/Wrapper.jsx
index 7d3d217..0928ba3 100644
--- a/src/pages/Content/Wrapper.jsx
+++ b/src/pages/Content/Wrapper.jsx
@@ -14,6 +14,7 @@ import Modal from "./modal/Modal";
import Warning from "./warning/Warning";
import Region from "./region/Region";
+import TeleprompterController from "./teleprompter/TeleprompterController";
// Using ShadowDOM
import root from "react-shadow";
@@ -146,6 +147,7 @@ const Wrapper = () => {
// (stream acquired) closes it; that's the pre-acquisition feedback, so
// don't stack the loader on top. Only fill the post-popup → countdown gap.
!contentState.showPopup &&
+ !contentState.startGateOpen &&
!contentState.countdownActive &&
!contentState.isCountdownVisible &&
!contentState.recording &&
@@ -172,6 +174,7 @@ const Wrapper = () => {
!contentState.countdownActive &&
!contentState.isCountdownVisible &&
!contentState.recording &&
+ !contentState.startGateOpen &&
contentState.useOffscreenCloud !== false;
const waitActive =
inPreCountdownWait || inPostStopWait || inRestartWait || inPreparingWait;
@@ -336,6 +339,7 @@ const Wrapper = () => {
return (
<div ref={parentRef}>
+ <TeleprompterController />
{contentState.showExtension && (
<iframe
className="screenity-iframe"
diff --git a/src/pages/Content/camera/layout/CameraToolbar.jsx b/src/pages/Content/camera/layout/CameraToolbar.jsx
index f3997a1..40dc29c 100644
--- a/src/pages/Content/camera/layout/CameraToolbar.jsx
+++ b/src/pages/Content/camera/layout/CameraToolbar.jsx
@@ -7,11 +7,43 @@ import TooltipWrap from "../../toolbar/components/TooltipWrap";
import { CameraCloseIcon, Pip } from "../../toolbar/components/SVG";
import { contentStateContext } from "../../context/ContentState";
+import {
+ cameraCanLiveInWindow,
+ prompterCaptureStatus,
+} from "../../teleprompter/prompterRules";
+import {
+ closePipLayer,
+ getPipLayers,
+ isPrompterWindowSupported,
+ openPipLayer,
+ setCameraManual,
+} from "../../teleprompter/prompterWindow";
const CameraToolbar = () => {
const [contentState, setContentState] = useContext(contentStateContext);
- const pipSupported =
- typeof document !== "undefined" && document.pictureInPictureEnabled;
+ const eligible = cameraCanLiveInWindow({
+ cloud: process.env.SCREENITY_ENABLE_CLOUD_FEATURES === "true",
+ subscribed: contentState.isSubscribed,
+ instantMode: contentState.instantMode,
+ });
+ // Burnt-in camera: only a full-screen capture can move it to PiP, elsewhere it
+ // would drop out of the video. Own track: any capture that leaves the window out.
+ const captureOk =
+ prompterCaptureStatus({
+ recordingType: contentState.recordingType,
+ surface: contentState.surface,
+ }) === "ok";
+ const fullScreenNow =
+ Boolean(contentState.recording) &&
+ contentState.recordingType === "screen" &&
+ contentState.surface === "monitor";
+ const docSupported = isPrompterWindowSupported();
+ const showPip =
+ contentState.recordingType === "camera"
+ ? false
+ : eligible
+ ? (!contentState.recording || captureOk) && docSupported
+ : docSupported && fullScreenNow;
return (
<Toolbar.Root className="camera-toolbar">
@@ -30,14 +62,28 @@ const CameraToolbar = () => {
{/* Manual toggle, deliberately not gated on surface or recordingType.
Auto-PiP is decided in surfaceHandler; this is the way back into PiP
after closing it, and `surface` is not reliably set on every flow. */}
- {pipSupported && (
+ {showPip && (
<TooltipWrap
content={chrome.i18n.getMessage("togglePictureinPictureModeTooltip")}
>
<Toolbar.Button
className="CameraToolbarButton CameraMore"
onClick={() => {
- chrome.runtime.sendMessage({ type: "toggle-pip" });
+ if (getPipLayers().camera) {
+ closePipLayer("camera", "bubble button");
+ return;
+ }
+ const allowed = eligible
+ ? !contentState.recording || captureOk
+ : fullScreenNow;
+ if (docSupported && allowed && !contentState.pipActive) {
+ setCameraManual(true);
+ // A burnt-in camera can't sit beside the script.
+ if (!eligible) closePipLayer("prompter", "camera takes over");
+ openPipLayer("camera", "bubble button").then((opened) => {
+ if (!opened) setCameraManual(false);
+ });
+ }
}}
>
<Pip />
diff --git a/src/pages/Content/camera/layout/CameraWrap.jsx b/src/pages/Content/camera/layout/CameraWrap.jsx
index 0ff6600..8df337b 100644
--- a/src/pages/Content/camera/layout/CameraWrap.jsx
+++ b/src/pages/Content/camera/layout/CameraWrap.jsx
@@ -122,15 +122,25 @@ const CameraWrap = (props) => {
};
}, []);
- const idle = !contentState.recording && !contentState.pendingRecording;
+ // Starting spans the Start click to the end of the take (picker, preparing,
+ // start prompt, countdown), so the bubble leaves with the click and stays gone.
+ const idle =
+ !contentState.recording &&
+ !contentState.pendingRecording &&
+ !contentState.preparingRecording &&
+ !contentState.startGateOpen &&
+ !contentState.countdownActive &&
+ !contentState.isCountdownVisible;
// Keyed off the real PiP window, not `surface`, which arrives only after an
// auth round-trip. pipActive false until "pip-started" keeps the bubble.
const hidden =
- !idle &&
- (contentState.pipActive ||
- (contentState.isSubscribed &&
- (!contentState.instantMode || contentState.multiMode)) ||
- contentState.onboarding);
+ contentState.cameraInWindow ||
+ (!idle &&
+ !contentState.cameraOnPage &&
+ (contentState.pipActive ||
+ (contentState.isSubscribed &&
+ (!contentState.instantMode || contentState.multiMode)) ||
+ contentState.onboarding));
return (
<div
diff --git a/src/pages/Content/context/ContentState.jsx b/src/pages/Content/context/ContentState.jsx
index a0accad..b34c5ed 100644
--- a/src/pages/Content/context/ContentState.jsx
+++ b/src/pages/Content/context/ContentState.jsx
@@ -20,6 +20,7 @@ import { setupHandlers } from "./messaging/handlers";
import { checkAuthStatus } from "./utils/checkAuthStatus";
import {
initStartFlowTrace,
+ reportIgnoredStartClick,
traceStep,
setStartFlowOutcome,
} from "../../utils/startFlowTrace";
@@ -70,10 +71,10 @@ const ContentState = (props) => {
process.env.SCREENITY_ENABLE_CLOUD_FEATURES === "true";
setTimer = setTimerInternal;
const [URL] = useState(
- "https://help.screenity.io/getting-started/77KizPC8MHVGfpKpqdux9D/why-does-screenity-ask-for-permissions/9AAE8zJ6iiUtCAtjn4SUT1",
+ "https://help.screenity.io/getting-started/77KizPC8MHVGfpKpqdux9D/why-does-screenity-ask-for-permissions/9AAE8zJ6iiUtCAtjn4SUT1"
);
const [URL2] = useState(
- "https://help.screenity.io/troubleshooting/9Jy5RGjNrBB42hqUdREQ7W/how-to-grant-screenity-permission-to-record-your-camera-and-microphone/x6U69TnrbMjy5CQ96Er2E9",
+ "https://help.screenity.io/troubleshooting/9Jy5RGjNrBB42hqUdREQ7W/how-to-grant-screenity-permission-to-record-your-camera-and-microphone/x6U69TnrbMjy5CQ96Er2E9"
);
const startBeepRef = useRef(null);
const stopBeepRef = useRef(null);
@@ -143,7 +144,7 @@ const ContentState = (props) => {
s?.countdownActive ||
s?.isCountdownVisible ||
s?.preparingRecording ||
- s?.pendingRecording,
+ s?.pendingRecording
);
let allowed = true;
if (ENABLE_TAB_SCOPED_UI && tabBoundFlow && tabIdRef.current != null) {
@@ -162,7 +163,7 @@ const ContentState = (props) => {
setContentState((prev) => ({ ...prev, recordingUiAllowed: allowed }));
}
},
- [isTargetTab],
+ [isTargetTab]
);
const verifyUser = useCallback(async () => {
@@ -224,7 +225,7 @@ const ContentState = (props) => {
recordingStartTimeRef.current = result.recordingStartTime ?? null;
recordingBeepTabIdRef.current = result.recordingBeepTabId ?? null;
recomputeRecordingUiAllowed("storage-mount");
- },
+ }
);
}, [recomputeRecordingUiAllowed]);
@@ -414,16 +415,16 @@ const ContentState = (props) => {
chrome.runtime.sendMessage(
{ type: "stop-recording-tab", reason: "content-toolbar-stop" },
(res) => {
- if (!res || res.ok !== true) {
- console.warn("Stop command not acknowledged, retrying…");
- setTimeout(() => {
- chrome.runtime.sendMessage({
- type: "stop-recording-tab",
- reason: "content-toolbar-stop-retry",
- });
- }, 200);
+ if (!res || res.ok !== true) {
+ console.warn("Stop command not acknowledged, retrying…");
+ setTimeout(() => {
+ chrome.runtime.sendMessage({
+ type: "stop-recording-tab",
+ reason: "content-toolbar-stop-retry",
+ });
+ }, 200);
+ }
}
- },
);
// Watchdog: clear finalizing if BG never signals editor-open.
// 30s is past worst-case (encoder flush is ~15s cap).
@@ -478,7 +479,7 @@ const ContentState = (props) => {
if (!dismiss) {
contentStateRef.current.openToast(
chrome.i18n.getMessage("pausedRecordingToast"),
- function () {},
+ function () {}
);
}
}, 100);
@@ -602,392 +603,464 @@ const ContentState = (props) => {
{ type: "check-capture-permissions", isLoggedIn, isSubscribed },
(response) => {
resolve(Boolean(response && response.status === "ok"));
- },
+ }
);
});
}, []);
- const startStreaming = useCallback(async () => {
- // Region capture runs getDisplayMedia in our in-page iframe, so a host page
- // that won't delegate display-capture (e.g. facebook.com) rejects it before any
- // picker. The popup disables this, but the shortcut path doesn't, so backstop it.
- // Synchronous, and ahead of the permission call so a blocked site never prompts.
- if (
- contentStateRef.current?.recordingType === "region" &&
- contentStateRef.current?.siteDisplayCaptureBlocked
- ) {
- contentStateRef.current.openToast?.(
- chrome.i18n.getMessage("tabRecordingDisabledToast"),
- 4000,
- );
- return;
- }
-
- // Must fire before any await, including the storage read below: one spends
- // the click's activation, so the SW's request() fails and reads as a denial.
- const isExtensionPage = window.location.href.includes("chrome-extension://");
- const permissionPromise = isExtensionPage
- ? null
- : checkChromeCapturePermissionsSW();
-
- // Double-click guard: a previous start may still be in flight.
- const snap = await chrome.storage.local.get([
- "pendingRecording",
- "recording",
- "restarting",
- ]);
- if (snap.pendingRecording || snap.recording || snap.restarting) {
- return;
- }
-
- const attemptId = `ra-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
- const isPro = Boolean(
- contentStateRef.current.isLoggedIn &&
- contentStateRef.current.isSubscribed &&
- CLOUD_FEATURES_ENABLED,
- );
- await initStartFlowTrace(attemptId, {
- recordingType: contentStateRef.current.recordingType,
- isPro,
- countdown: Boolean(contentStateRef.current.countdown),
- });
- // Fired before the gates below (quota, permissions, memory) can bail,
- // and those gates leave no other trace either side. Only signal that a
- // pro user clicked Start on an attempt that never reached dispatch.
- if (isPro) {
- chrome.runtime
- .sendMessage({
- type: "recording-click-beacon",
- clickId: attemptId,
- recordingType: contentStateRef.current.recordingType,
- })
- .catch(() => {});
- }
- traceStep("startStreaming");
- perfReset();
- perfMark("Content startStreaming.click", {
- recordingType: contentStateRef.current.recordingType,
- });
+ const startStreamingImpl = useCallback(
+ async (attempt, opts = {}) => {
+ // Region capture runs getDisplayMedia in our in-page iframe, so a host page
+ // that won't delegate display-capture (e.g. facebook.com) rejects it before any
+ // picker. The popup disables this, but the shortcut path doesn't, so backstop it.
+ // Synchronous, and ahead of the permission call so a blocked site never prompts.
+ if (
+ contentStateRef.current?.recordingType === "region" &&
+ contentStateRef.current?.siteDisplayCaptureBlocked
+ ) {
+ contentStateRef.current.openToast?.(
+ chrome.i18n.getMessage("tabRecordingDisabledToast"),
+ () => {},
+ 4000
+ );
+ return;
+ }
- // Overlay non-blocking while pending; popup stays open until recorder tab
- // takes focus. Clear countdownCancelled to avoid stale block. Storage
- // write must precede recorder-tab open so the activation listener sees it.
- chrome.storage.local.set({ pendingRecording: true });
- setContentState((prev) => ({
- ...prev,
- pendingRecording: true,
- countdownCancelled: false,
- // Reset the latched loader gate for the new session; the
- // overlay can show during this session's pre-countdown wait
- // until the countdown appears, then it's permanently off.
- countdownEverShown: false,
- }));
+ // Must fire before any await, including the storage read below: one spends
+ // the click's activation, so the SW's request() fails and reads as a denial.
+ const isExtensionPage = window.location.href.includes(
+ "chrome-extension://"
+ );
+ const permissionPromise = isExtensionPage
+ ? null
+ : checkChromeCapturePermissionsSW();
+
+ // Double-click guard: a previous start may still be in flight.
+ const snap = await chrome.storage.local.get([
+ "pendingRecording",
+ "pendingRecordingAt",
+ "recording",
+ "restarting",
+ ]);
+ if (snap.pendingRecording || snap.recording || snap.restarting) {
+ reportIgnoredStartClick({
+ reason: snap.pendingRecording
+ ? "pending"
+ : snap.recording
+ ? "recording"
+ : "restarting",
+ pendingAgeMs:
+ snap.pendingRecording && snap.pendingRecordingAt
+ ? Date.now() - snap.pendingRecordingAt
+ : null,
+ recordingType: contentStateRef.current?.recordingType,
+ });
+ return;
+ }
- let permission = false;
+ const attemptId = `ra-${Date.now().toString(36)}-${Math.random()
+ .toString(36)
+ .slice(2, 8)}`;
+ const isPro = Boolean(
+ contentStateRef.current.isLoggedIn &&
+ contentStateRef.current.isSubscribed &&
+ CLOUD_FEATURES_ENABLED
+ );
+ await initStartFlowTrace(attemptId, {
+ recordingType: contentStateRef.current.recordingType,
+ isPro,
+ countdown: Boolean(contentStateRef.current.countdown),
+ });
+ // Fired before the gates below (quota, permissions, memory) can bail,
+ // and those gates leave no other trace either side. Only signal that a
+ // pro user clicked Start on an attempt that never reached dispatch.
+ if (isPro) {
+ chrome.runtime
+ .sendMessage({
+ type: "recording-click-beacon",
+ clickId: attemptId,
+ recordingType: contentStateRef.current.recordingType,
+ })
+ .catch(() => {});
+ }
+ traceStep("startStreaming");
+ perfReset();
+ perfMark("Content startStreaming.click", {
+ recordingType: contentStateRef.current.recordingType,
+ });
- if (
- contentStateRef.current?.isLoggedIn &&
- contentStateRef.current?.isSubscribed &&
- CLOUD_FEATURES_ENABLED
- ) {
- const storageResponse = await chrome.runtime.sendMessage({
- type: "check-storage-quota",
+ // Overlay non-blocking while pending; popup stays open until recorder tab
+ // takes focus. Clear countdownCancelled to avoid stale block. Storage
+ // write must precede recorder-tab open so the activation listener sees it.
+ attempt.armed = true;
+ chrome.storage.local.set({
+ pendingRecording: true,
+ pendingRecordingAt: Date.now(),
});
+ setContentState((prev) => ({
+ ...prev,
+ pendingRecording: true,
+ countdownCancelled: false,
+ // Reset the latched loader gate for the new session; the
+ // overlay can show during this session's pre-countdown wait
+ // until the countdown appears, then it's permanently off.
+ countdownEverShown: false,
+ }));
- const { success, canUpload, error, reachability } = storageResponse;
+ let permission = false;
- if (reachability) {
- // Always restamp: this verdict is live, and the banner treats an old
- // `at` as unproven and hides itself.
- setContentState((prev) => ({
- ...prev,
- apiReachability: reachability,
- apiReachabilityAt: Date.now(),
- }));
- }
+ if (
+ contentStateRef.current?.isLoggedIn &&
+ contentStateRef.current?.isSubscribed &&
+ CLOUD_FEATURES_ENABLED
+ ) {
+ const storageResponse = await chrome.runtime.sendMessage({
+ type: "check-storage-quota",
+ });
- if (success && canUpload === false) {
- contentStateRef.current.openModal(
- chrome.i18n.getMessage("storageLimitReachedTitle"),
- chrome.i18n.getMessage("storageLimitReachedDescription"),
- chrome.i18n.getMessage("manageStorageButtonLabel"),
- chrome.i18n.getMessage("closeModalLabel"),
- () => {
- window.open(process.env.SCREENITY_APP_BASE, "_blank");
- },
- () => {},
- );
- } else if (!success) {
- const isSubError = error === "Subscription inactive";
- const isAuthError = error === "Not authenticated";
+ const { success, canUpload, error, reachability } = storageResponse;
- if (isSubError) {
- contentStateRef.current.setContentState((prev) => ({
- ...prev,
- isSubscribed: false,
- }));
- } else if (isAuthError) {
- contentStateRef.current.setContentState((prev) => ({
+ if (reachability) {
+ // Always restamp: this verdict is live, and the banner treats an old
+ // `at` as unproven and hides itself.
+ setContentState((prev) => ({
...prev,
- isSubscribed: false,
- isLoggedIn: false,
- screenityUser: null,
- proSubscription: null,
+ apiReachability: reachability,
+ apiReachabilityAt: Date.now(),
}));
}
- // Blaming the storage check for a dead connection or a 502 sends people
- // to look at their storage settings. Name the real problem.
- const issue = isAuthError ? null : apiIssueCopy(reachability);
- const title = issue
- ? issue.title
- : chrome.i18n.getMessage("storageCheckFailTitle");
- const message = isAuthError
- ? chrome.i18n.getMessage("storageCheckFailAuthDescription")
- : issue
+ if (success && canUpload === false) {
+ contentStateRef.current.openModal(
+ chrome.i18n.getMessage("storageLimitReachedTitle"),
+ chrome.i18n.getMessage("storageLimitReachedDescription"),
+ chrome.i18n.getMessage("manageStorageButtonLabel"),
+ chrome.i18n.getMessage("closeModalLabel"),
+ () => {
+ window.open(process.env.SCREENITY_APP_BASE, "_blank");
+ },
+ () => {}
+ );
+ } else if (!success) {
+ const isSubError = error === "Subscription inactive";
+ const isAuthError = error === "Not authenticated";
+
+ if (isSubError) {
+ contentStateRef.current.setContentState((prev) => ({
+ ...prev,
+ isSubscribed: false,
+ }));
+ } else if (isAuthError) {
+ contentStateRef.current.setContentState((prev) => ({
+ ...prev,
+ isSubscribed: false,
+ isLoggedIn: false,
+ screenityUser: null,
+ proSubscription: null,
+ }));
+ }
+
+ // Blaming the storage check for a dead connection or a 502 sends people
+ // to look at their storage settings. Name the real problem.
+ const issue = isAuthError ? null : apiIssueCopy(reachability);
+ const title = issue
+ ? issue.title
+ : chrome.i18n.getMessage("storageCheckFailTitle");
+ const message = isAuthError
+ ? chrome.i18n.getMessage("storageCheckFailAuthDescription")
+ : issue
? issue.description
: chrome.i18n.getMessage("storageCheckFailDescription");
- apiIssueModalRef.current = Boolean(issue);
+ apiIssueModalRef.current = Boolean(issue);
- contentStateRef.current.openModal(
- title,
- message,
- isAuthError
- ? chrome.i18n.getMessage("loginButtonLabel")
- : chrome.i18n.getMessage("retryButtonLabel"),
- chrome.i18n.getMessage("closeModalLabel"),
- () => {
- // Retry the start, not the page: the old reload dropped whatever
- // the user had open and never re-ran the check.
- apiIssueModalRef.current = false;
- if (isAuthError) {
- chrome.runtime.sendMessage({ type: "handle-login" });
- } else {
- startStreaming();
+ contentStateRef.current.openModal(
+ title,
+ message,
+ isAuthError
+ ? chrome.i18n.getMessage("loginButtonLabel")
+ : chrome.i18n.getMessage("retryButtonLabel"),
+ chrome.i18n.getMessage("closeModalLabel"),
+ () => {
+ // Retry the start, not the page: the old reload dropped whatever
+ // the user had open and never re-ran the check.
+ apiIssueModalRef.current = false;
+ if (isAuthError) {
+ chrome.runtime.sendMessage({ type: "handle-login" });
+ } else {
+ startStreaming();
+ }
+ },
+ () => {
+ apiIssueModalRef.current = false;
}
- },
+ );
+ }
+
+ if (!success || (success && canUpload === false)) {
+ setStartFlowOutcome("error", {
+ error:
+ canUpload === false
+ ? "storage-limit"
+ : error || "quota-check-failed",
+ });
+ // Explicit storage write; see note on the removed
+ // contentState→storage useEffect.
+ chrome.storage.local.set({ pendingRecording: false });
+ setContentState((prev) => ({
+ ...prev,
+ pendingRecording: false,
+ preparingRecording: false,
+ }));
+ return;
+ }
+ }
+
+ if (isExtensionPage) {
+ permission = await checkChromeCapturePermissions();
+ } else {
+ permission = await permissionPromise;
+ }
+
+ if (!permission && opts.noPageGesture) {
+ // The click landed in the floating window, so this page had no activation
+ // for request(). Not a denial: ask the user to click here once instead.
+ window.focus();
+ contentStateRef.current.openToast?.(
+ chrome.i18n.getMessage("pressRecordOnPageToast"),
+ () => {},
+ 6000
+ );
+ setStartFlowOutcome("cancelled", { error: "permission-needs-page-click" });
+ chrome.storage.local.set({ pendingRecording: false });
+ setContentState((prevContentState) => ({
+ ...prevContentState,
+ pendingRecording: false,
+ preparingRecording: false,
+ }));
+ return;
+ }
+
+ if (!permission) {
+ contentStateRef.current.openModal(
+ chrome.i18n.getMessage("chromePermissionsModalTitle"),
+ chrome.i18n.getMessage("chromePermissionsModalDescription"),
+ chrome.i18n.getMessage("chromePermissionsModalAction"),
+ chrome.i18n.getMessage("chromePermissionsModalCancel"),
() => {
- apiIssueModalRef.current = false;
+ // Direct call so the click's gesture reaches the sync permission check.
+ startStreaming();
},
+ () => {},
+ null,
+ chrome.i18n.getMessage("learnMoreDot"),
+ URL,
+ true
);
+ setStartFlowOutcome("cancelled", { error: "permission-denied" });
+ chrome.storage.local.set({ pendingRecording: false });
+ setContentState((prevContentState) => ({
+ ...prevContentState,
+ pendingRecording: false,
+ preparingRecording: false,
+ }));
+ return;
}
- if (!success || (success && canUpload === false)) {
- setStartFlowOutcome("error", {
- error: canUpload === false ? "storage-limit" : (error || "quota-check-failed"),
- });
- // Explicit storage write; see note on the removed
- // contentState→storage useEffect.
+ const data = await chrome.runtime.sendMessage({
+ type: "available-memory",
+ });
+
+ if (
+ data.quota < 524288000 &&
+ !contentStateRef.current.isLoggedIn &&
+ !contentStateRef.current.isSubscribed
+ ) {
+ if (typeof contentStateRef.current.openModal === "function") {
+ let clear = null;
+ let clearAction = () => {};
+ const helpURL =
+ "https://help.screenity.io/troubleshooting/9Jy5RGjNrBB42hqUdREQ7W/what-does-%E2%80%9Cmemory-limit-reached%E2%80%9D-mean-when-recording/8WkwHbt3puuXunYqQnyPcb";
+
+ const response = await chrome.runtime.sendMessage({
+ type: "check-restore",
+ });
+ if (response.restore) {
+ clear = chrome.i18n.getMessage("clearSpaceButton");
+ clearAction = () => {
+ chrome.runtime.sendMessage({ type: "clear-recordings" });
+ };
+ }
+
+ contentStateRef.current.openModal(
+ chrome.i18n.getMessage("notEnoughSpaceTitle"),
+ chrome.i18n.getMessage("notEnoughSpaceDescription"),
+ clear,
+ chrome.i18n.getMessage("permissionsModalDismiss"),
+ clearAction,
+ () => {},
+ null,
+ chrome.i18n.getMessage("learnMoreDot"),
+ helpURL,
+ false,
+ chrome.i18n.getMessage("getHelpButton"),
+ () => {
+ triggerSupportDownload({ source: "not-enough-space" });
+ chrome.runtime.sendMessage({
+ type: "report-error",
+ errorCode: "REC_RUN_MEMORY",
+ source: "not-enough-space",
+ zipBundled: true,
+ });
+ }
+ );
+ }
+ setStartFlowOutcome("error", { error: "insufficient-memory" });
chrome.storage.local.set({ pendingRecording: false });
- setContentState((prev) => ({
- ...prev,
+ setContentState((prevContentState) => ({
+ ...prevContentState,
pendingRecording: false,
preparingRecording: false,
}));
return;
}
- }
+ chrome.storage.local.set({
+ tabRecordedID: null,
+ });
- if (isExtensionPage) {
- permission = await checkChromeCapturePermissions();
- } else {
- permission = await permissionPromise;
- }
+ // Sent only after the mic-muted modal is confirmed: this makes the recorder
+ // call getDisplayMedia, so sending it earlier pops the picker behind the modal.
+ const sendRegionCropTarget = () => {
+ if (
+ contentStateRef.current.recordingType === "region" &&
+ contentStateRef.current.cropTarget &&
+ contentStateRef.current.regionCaptureRef?.contentWindow
+ ) {
+ contentStateRef.current.regionCaptureRef.contentWindow.postMessage(
+ {
+ type: "crop-target",
+ target: contentStateRef.current.cropTarget,
+ width: contentStateRef.current.regionWidth,
+ height: contentStateRef.current.regionHeight,
+ },
+ "*"
+ );
+ }
+ };
- if (!permission) {
- contentStateRef.current.openModal(
- chrome.i18n.getMessage("chromePermissionsModalTitle"),
- chrome.i18n.getMessage("chromePermissionsModalDescription"),
- chrome.i18n.getMessage("chromePermissionsModalAction"),
- chrome.i18n.getMessage("chromePermissionsModalCancel"),
- () => {
- // Direct call so the click's gesture reaches the sync permission check.
- startStreaming();
- },
- () => {},
- null,
- chrome.i18n.getMessage("learnMoreDot"),
- URL,
- true,
- );
- setStartFlowOutcome("cancelled", { error: "permission-denied" });
- chrome.storage.local.set({ pendingRecording: false });
setContentState((prevContentState) => ({
...prevContentState,
- pendingRecording: false,
- preparingRecording: false,
+ showOnboardingArrow: false,
}));
- return;
- }
-
- const data = await chrome.runtime.sendMessage({ type: "available-memory" });
-
- if (
- data.quota < 524288000 &&
- !contentStateRef.current.isLoggedIn &&
- !contentStateRef.current.isSubscribed
- ) {
- if (typeof contentStateRef.current.openModal === "function") {
- let clear = null;
- let clearAction = () => {};
- const helpURL =
- "https://help.screenity.io/troubleshooting/9Jy5RGjNrBB42hqUdREQ7W/what-does-%E2%80%9Cmemory-limit-reached%E2%80%9D-mean-when-recording/8WkwHbt3puuXunYqQnyPcb";
-
- const response = await chrome.runtime.sendMessage({
- type: "check-restore",
- });
- if (response.restore) {
- clear = chrome.i18n.getMessage("clearSpaceButton");
- clearAction = () => {
- chrome.runtime.sendMessage({ type: "clear-recordings" });
- };
- }
+ if (
+ !contentStateRef.current.micActive &&
+ contentStateRef.current.askMicrophone
+ ) {
contentStateRef.current.openModal(
- chrome.i18n.getMessage("notEnoughSpaceTitle"),
- chrome.i18n.getMessage("notEnoughSpaceDescription"),
- clear,
- chrome.i18n.getMessage("permissionsModalDismiss"),
- clearAction,
- () => {},
- null,
- chrome.i18n.getMessage("learnMoreDot"),
- helpURL,
- false,
- chrome.i18n.getMessage("getHelpButton"),
+ chrome.i18n.getMessage("micMutedModalTitle"),
+ chrome.i18n.getMessage("micMutedModalDescription"),
+ chrome.i18n.getMessage("micMutedModalAction"),
+ chrome.i18n.getMessage("micMutedModalCancel"),
() => {
- triggerSupportDownload({ source: "not-enough-space" });
+ // Crop target first (after the user confirmed mic-off): this flushes
+ // the recorder's deferred streaming-data and starts getDisplayMedia.
+ sendRegionCropTarget();
chrome.runtime.sendMessage({
- type: "report-error",
- errorCode: "REC_RUN_MEMORY",
- source: "not-enough-space",
- zipBundled: true,
+ type: "desktop-capture",
+ region:
+ contentStateRef.current.recordingType === "region"
+ ? true
+ : false,
+ customRegion: contentStateRef.current.customRegion,
+ offscreenRecording: contentStateRef.current.offscreenRecording,
+ camera:
+ contentStateRef.current.recordingType === "camera"
+ ? true
+ : false,
});
- },
- );
- }
- setStartFlowOutcome("error", { error: "insufficient-memory" });
- chrome.storage.local.set({ pendingRecording: false });
- setContentState((prevContentState) => ({
- ...prevContentState,
- pendingRecording: false,
- preparingRecording: false,
- }));
- return;
- }
- chrome.storage.local.set({
- tabRecordedID: null,
- });
+ setContentState((prevContentState) => ({
+ ...prevContentState,
- // Sent only after the mic-muted modal is confirmed: this makes the recorder
- // call getDisplayMedia, so sending it earlier pops the picker behind the modal.
- const sendRegionCropTarget = () => {
- if (
- contentStateRef.current.recordingType === "region" &&
- contentStateRef.current.cropTarget &&
- contentStateRef.current.regionCaptureRef?.contentWindow
- ) {
- contentStateRef.current.regionCaptureRef.contentWindow.postMessage(
- {
- type: "crop-target",
- target: contentStateRef.current.cropTarget,
- width: contentStateRef.current.regionWidth,
- height: contentStateRef.current.regionHeight,
+ surface: "default",
+ pipEnded: false,
+ pipActive: false,
+ }));
},
- "*",
+ () => {
+ setStartFlowOutcome("cancelled", { error: "mic-muted-cancel" });
+ chrome.storage.local.set({ pendingRecording: false });
+ setContentState((prevContentState) => ({
+ ...prevContentState,
+ pendingRecording: false,
+ preparingRecording: false,
+ }));
+ },
+ false,
+ false,
+ false,
+ false,
+ chrome.i18n.getMessage("noShowAgain"),
+ () => {
+ setContentState((prevContentState) => ({
+ ...prevContentState,
+ askMicrophone: false,
+ }));
+ chrome.storage.local.set({ askMicrophone: false });
+ }
);
- }
- };
-
- setContentState((prevContentState) => ({
- ...prevContentState,
- showOnboardingArrow: false,
- }));
-
- if (
- !contentStateRef.current.micActive &&
- contentStateRef.current.askMicrophone
- ) {
- contentStateRef.current.openModal(
- chrome.i18n.getMessage("micMutedModalTitle"),
- chrome.i18n.getMessage("micMutedModalDescription"),
- chrome.i18n.getMessage("micMutedModalAction"),
- chrome.i18n.getMessage("micMutedModalCancel"),
- () => {
- // Crop target first (after the user confirmed mic-off): this flushes
- // the recorder's deferred streaming-data and starts getDisplayMedia.
- sendRegionCropTarget();
- chrome.runtime.sendMessage({
- type: "desktop-capture",
- region:
- contentStateRef.current.recordingType === "region" ? true : false,
- customRegion: contentStateRef.current.customRegion,
- offscreenRecording: contentStateRef.current.offscreenRecording,
- camera:
- contentStateRef.current.recordingType === "camera" ? true : false,
- });
- setContentState((prevContentState) => ({
- ...prevContentState,
+ } else {
+ // Crop target first: flushes the recorder's deferred streaming-data and
+ // starts getDisplayMedia (no mic modal to gate behind in this branch).
+ sendRegionCropTarget();
+ perfMark("Content desktop-capture.sent");
+ // Sync recordingType to storage so the cloudrecorder tab reads
+ // the current pick, not a stale value from a prior session.
+ // Mismatch causes the CR dispatch to land in the null-tabID
+ // branch and crash with REC_START_CANCEL.
+ chrome.storage.local.set({
+ recordingType: contentStateRef.current.recordingType || "screen",
+ });
+ chrome.runtime.sendMessage({
+ type: "desktop-capture",
+ region:
+ contentStateRef.current.recordingType === "region" ? true : false,
+ customRegion: contentStateRef.current.customRegion,
+ offscreenRecording: contentStateRef.current.offscreenRecording,
+ camera:
+ contentStateRef.current.recordingType === "camera" ? true : false,
+ });
+ traceStep("desktopCaptureSent");
+ setContentState((prevContentState) => ({
+ ...prevContentState,
- surface: "default",
- pipEnded: false,
- pipActive: false,
- }));
- },
- () => {
- setStartFlowOutcome("cancelled", { error: "mic-muted-cancel" });
- chrome.storage.local.set({ pendingRecording: false });
- setContentState((prevContentState) => ({
- ...prevContentState,
- pendingRecording: false,
- preparingRecording: false,
- }));
- },
- false,
- false,
- false,
- false,
- chrome.i18n.getMessage("noShowAgain"),
- () => {
- setContentState((prevContentState) => ({
- ...prevContentState,
- askMicrophone: false,
- }));
- chrome.storage.local.set({ askMicrophone: false });
- },
- );
- } else {
- // Crop target first: flushes the recorder's deferred streaming-data and
- // starts getDisplayMedia (no mic modal to gate behind in this branch).
- sendRegionCropTarget();
- perfMark("Content desktop-capture.sent");
- // Sync recordingType to storage so the cloudrecorder tab reads
- // the current pick, not a stale value from a prior session.
- // Mismatch causes the CR dispatch to land in the null-tabID
- // branch and crash with REC_START_CANCEL.
- chrome.storage.local.set({
- recordingType: contentStateRef.current.recordingType || "screen",
- });
- chrome.runtime.sendMessage({
- type: "desktop-capture",
- region:
- contentStateRef.current.recordingType === "region" ? true : false,
- customRegion: contentStateRef.current.customRegion,
- offscreenRecording: contentStateRef.current.offscreenRecording,
- camera:
- contentStateRef.current.recordingType === "camera" ? true : false,
- });
- traceStep("desktopCaptureSent");
- setContentState((prevContentState) => ({
- ...prevContentState,
+ surface: "default",
+ pipEnded: false,
+ pipActive: false,
+ }));
+ }
+ },
+ [contentStateRef]
+ );
- surface: "default",
- pipEnded: false,
- pipActive: false,
- }));
+ // A throw after pendingRecording is set leaves it true, and the double-click
+ // guard then swallows every later click.
+ const startStreaming = useCallback(async (opts) => {
+ const attempt = { armed: false };
+ try {
+ await startStreamingImpl(attempt, opts);
+ } catch (err) {
+ if (attempt.armed) {
+ chrome.storage.local.set({ pendingRecording: false });
+ setContentState((prev) => ({
+ ...prev,
+ pendingRecording: false,
+ preparingRecording: false,
+ }));
+ }
+ throw err;
}
- }, [contentStateRef]);
+ }, [startStreamingImpl]);
const tryRestartRecording = useCallback(() => {
if (!contentStateRef.current.paused) {
@@ -1003,7 +1076,7 @@ const ContentState = (props) => {
},
() => {
contentStateRef.current.resumeRecording();
- },
+ }
);
}, []);
@@ -1022,7 +1095,7 @@ const ContentState = (props) => {
},
() => {
contentStateRef.current.resumeRecording();
- },
+ }
);
} else {
contentStateRef.current.dismissRecording("user-discard");
@@ -1041,11 +1114,15 @@ const ContentState = (props) => {
setContentState((prevContentState) => ({
...prevContentState,
audioInput:
- microphonePermission && !audioInput?.length && prevContentState.audioInput?.length
+ microphonePermission &&
+ !audioInput?.length &&
+ prevContentState.audioInput?.length
? prevContentState.audioInput
: audioInput,
videoInput:
- cameraPermission && !videoInput?.length && prevContentState.videoInput?.length
+ cameraPermission &&
+ !videoInput?.length &&
+ prevContentState.videoInput?.length
? prevContentState.videoInput
: videoInput,
cameraPermission: cameraPermission,
@@ -1056,12 +1133,12 @@ const ContentState = (props) => {
const audioInputById = Array.isArray(audioInput)
? Object.fromEntries(
- audioInput.map((device) => [device.deviceId, device.label]),
+ audioInput.map((device) => [device.deviceId, device.label])
)
: {};
const videoInputById = Array.isArray(videoInput)
? Object.fromEntries(
- videoInput.map((device) => [device.deviceId, device.label]),
+ videoInput.map((device) => [device.deviceId, device.label])
)
: {};
@@ -1149,7 +1226,7 @@ const ContentState = (props) => {
chrome.i18n.getMessage("cameraMicBlockedTitle"),
chrome.i18n.getMessage("cameraMicBlockedDescription"),
"VideoOffIcon",
- 10000,
+ 10000
);
} else {
contentStateRef.current.openModal(
@@ -1165,7 +1242,7 @@ const ContentState = (props) => {
chrome.i18n.getMessage("learnMoreDot"),
URL2,
true,
- false,
+ false
);
}
}
@@ -1330,6 +1407,7 @@ const ContentState = (props) => {
toggleDrawingModeShortcut: "",
toggleBlurModeShortcut: "",
toggleCursorModeShortcut: "",
+ toggleMicShortcut: "",
cursorMode: "none",
cursorEffects: [],
shape: "rectangle",
@@ -1364,8 +1442,9 @@ const ContentState = (props) => {
systemAudio: true,
openWarning: false,
hasOpenedBefore: false,
- qualityValue: "1080p",
- fpsValue: "30",
+ qualityValue: "auto",
+ fpsValue: "auto",
+ smootherMotion: false,
fastRecorderBeta: null,
fastRecorderStatus: null,
useWebCodecsRecorder: true,
@@ -1376,7 +1455,6 @@ const ContentState = (props) => {
multiSceneCount: 0,
preparingRecording: false,
wasLoggedIn: false,
- hasSeenInstantModeModal: false,
instantMode: false,
onboarding: false,
showProSplash: false,
@@ -1395,7 +1473,9 @@ const ContentState = (props) => {
recording: false,
restarting: false,
});
- chrome.runtime.sendMessage({ type: "diag-countdown-cancelled" }).catch(() => {});
+ chrome.runtime
+ .sendMessage({ type: "diag-countdown-cancelled" })
+ .catch(() => {});
setContentState((prev) => ({
...prev,
countdownActive: false,
@@ -1534,7 +1614,7 @@ const ContentState = (props) => {
const onChanged = (changes, area) => {
if (area !== "local") return;
const entry = Object.keys(changes).find((k) =>
- k.startsWith("freeFinalizeStatus:"),
+ k.startsWith("freeFinalizeStatus:")
);
if (!entry) return;
applyStatus(changes[entry].newValue);
@@ -1587,7 +1667,10 @@ const ContentState = (props) => {
});
};
- if (
+ // A prompt waiting on the user is not a stuck start.
+ if (contentState.startGateOpen) {
+ // no timer
+ } else if (
contentState.pendingRecording &&
!contentState.preparingRecording
) {
@@ -1607,6 +1690,7 @@ const ContentState = (props) => {
contentState.pendingRecording,
contentState.preparingRecording,
contentState.recording,
+ contentState.startGateOpen,
]);
useEffect(() => {
@@ -1711,11 +1795,11 @@ const ContentState = (props) => {
chrome.i18n.getMessage("audioWarningTitle"),
chrome.i18n.getMessage(
"audioWarningDescription",
- chrome.i18n.getMessage("tabType"),
+ chrome.i18n.getMessage("tabType")
),
"AudioIcon",
10000,
- "bottom",
+ "bottom"
);
} else if (
window.location.href.includes("playground.html") &&
@@ -1726,7 +1810,7 @@ const ContentState = (props) => {
chrome.i18n.getMessage("extensionNotSupportedTitle"),
chrome.i18n.getMessage("extensionNotSupportedDescription"),
"NotSupportedIcon",
- 10000,
+ 10000
);
} else if (
!contentState.recording &&
@@ -1740,7 +1824,7 @@ const ContentState = (props) => {
chrome.i18n.getMessage("cameraMicBlockedTitle"),
chrome.i18n.getMessage("cameraMicBlockedDescription"),
"VideoOffIcon",
- 10000,
+ 10000
);
}
}
@@ -1783,7 +1867,7 @@ const ContentState = (props) => {
: 0;
const elapsedSeconds = Math.max(
0,
- Math.floor((now - startTime - basePaused - extraPaused) / 1000),
+ Math.floor((now - startTime - basePaused - extraPaused) / 1000)
);
if (contentStateRef.current?.alarm) {
@@ -1870,7 +1954,7 @@ const ContentState = (props) => {
restartingRecording: false,
recording: false,
}
- : prev,
+ : prev
);
} catch {}
};
@@ -1892,7 +1976,7 @@ const ContentState = (props) => {
setContentState((prev) =>
prev.apiReachability === state && prev.apiReachabilityAt === at
? prev
- : { ...prev, apiReachability: state, apiReachabilityAt: at },
+ : { ...prev, apiReachability: state, apiReachabilityAt: at }
);
};
@@ -1910,10 +1994,13 @@ const ContentState = (props) => {
const onOffline = () => applyState("offline");
const onOnline = () => {
applyState("ok");
- chrome.runtime.sendMessage({ type: "recheck-api-reachability" }, (res) => {
- if (chrome.runtime.lastError) return;
- if (res?.state) applyState(res.state);
- });
+ chrome.runtime.sendMessage(
+ { type: "recheck-api-reachability" },
+ (res) => {
+ if (chrome.runtime.lastError) return;
+ if (res?.state) applyState(res.state);
+ }
+ );
};
window.addEventListener("offline", onOffline);
@@ -1944,7 +2031,7 @@ const ContentState = (props) => {
(prev.apiReachability === state && prev.apiReachabilityAt === at) ||
navigator.onLine === false
? prev
- : { ...prev, apiReachability: state, apiReachabilityAt: at },
+ : { ...prev, apiReachability: state, apiReachabilityAt: at }
);
}
@@ -1975,7 +2062,7 @@ const ContentState = (props) => {
setContentState((prev) =>
prev.restartingRecording
? { ...prev, restartingRecording: false }
- : prev,
+ : prev
);
}
// Recording true → false: clear start-side flow flags the
@@ -1996,7 +2083,7 @@ const ContentState = (props) => {
pendingRecording: false,
restartingRecording: false,
}
- : prev,
+ : prev
);
}
}
@@ -2010,7 +2097,7 @@ const ContentState = (props) => {
setContentState((prev) =>
prev.restartingRecording
? { ...prev, restartingRecording: false }
- : prev,
+ : prev
);
}
if (changes.paused) {
@@ -2112,7 +2199,7 @@ const ContentState = (props) => {
cursorEffects: wasMulti ? prev.cursorEffects : [],
cameraActive: false,
}
- : prev,
+ : prev
);
setTimer(0);
// Match the old stop handler's DOM cleanup; pre-clear blur
@@ -2125,8 +2212,7 @@ const ContentState = (props) => {
if (changes.recording) {
const isRecording = Boolean(changes.recording.newValue);
// Read recordingType from this batch; the React ref may lag.
- const recordingTypeFromChange =
- changes.recordingType?.newValue ?? null;
+ const recordingTypeFromChange = changes.recordingType?.newValue ?? null;
lifecycle("Content.ContentState", "recording-flag-observed", {
isRecording,
isTargetTab: isTargetTab(),
@@ -2138,8 +2224,7 @@ const ContentState = (props) => {
if (isRecording && !isTargetTab()) {
// Tab/region recordings: clear UI flags that preparing-recording set on non-target tabs.
const recordingType =
- recordingTypeFromChange ??
- contentStateRef.current?.recordingType;
+ recordingTypeFromChange ?? contentStateRef.current?.recordingType;
const isTabBound =
recordingType === "tab" || recordingType === "region";
if (isTabBound) {
@@ -2178,8 +2263,7 @@ const ContentState = (props) => {
// the editor is still being prepared. sandboxTab → newValue
// is what clears the finalizing state cleanly.
const isLocallyFinalizing =
- !isRecording &&
- contentStateRef.current?.finalizingRecording === true;
+ !isRecording && contentStateRef.current?.finalizingRecording === true;
if (isLocallyFinalizing) {
// Keep the toolbar-facing `recording` flag true so its
// Recording UI persists during finalize, but expose the
@@ -2190,7 +2274,7 @@ const ContentState = (props) => {
setContentState((prev) =>
prev.encoderActive !== false
? { ...prev, encoderActive: false }
- : prev,
+ : prev
);
shouldUpdateTimer = false;
} else {
@@ -2210,7 +2294,7 @@ const ContentState = (props) => {
}
if (changes.cursorEffects) {
const nextEffects = normalizeCursorEffects(
- changes.cursorEffects.newValue,
+ changes.cursorEffects.newValue
);
const fallbackMode =
changes.cursorMode?.newValue ||
@@ -2293,6 +2377,30 @@ const ContentState = (props) => {
}
}, []);
+ // One-time move of old defaults (1080p, 30) to Auto. A stored default can't be
+ // told from a pick, so only those two move; the rest shows as Custom.
+ useEffect(() => {
+ chrome.storage.local
+ .get(["qualityValue", "fpsValue", "qualityAutoMigrated"])
+ .then((stored) => {
+ if (stored.qualityAutoMigrated) return;
+ const next = { qualityAutoMigrated: true };
+ if (
+ stored.qualityValue === undefined ||
+ stored.qualityValue === "1080p"
+ )
+ next.qualityValue = "auto";
+ if (stored.fpsValue === undefined || stored.fpsValue === "30")
+ next.fpsValue = "auto";
+ chrome.storage.local.set(next);
+ const { qualityAutoMigrated, ...moved } = next;
+ if (Object.keys(moved).length) {
+ setContentState((prev) => ({ ...prev, ...moved }));
+ }
+ })
+ .catch(() => {});
+ }, []);
+
useEffect(() => {
if (contentState.pushToTalk) {
setContentState((prevContentState) => ({
@@ -2403,7 +2511,7 @@ const ContentState = (props) => {
width: s.regionWidth,
height: s.regionHeight,
},
- "*",
+ "*"
);
}, []);
@@ -2439,7 +2547,7 @@ const ContentState = (props) => {
// Timer stays out of this on purpose, so the 1s tick doesn't invalidate it.
const providerValue = useMemo(
() => [contentState, setContentState],
- [contentState],
+ [contentState]
);
const timerValue = useMemo(() => [timer, setTimer], [timer]);
@@ -2450,7 +2558,10 @@ const ContentState = (props) => {
{props.children}
<Shortcuts shortcuts={contentState.shortcuts} />
{process.env.SCREENITY_DEV_MODE === "true" && (
- <DevHUD contentStateRef={contentStateRef} setContentState={setContentState} />
+ <DevHUD
+ contentStateRef={contentStateRef}
+ setContentState={setContentState}
+ />
)}
</timerContext.Provider>
</contentStateContext.Provider>
diff --git a/src/pages/Content/context/messaging/handlers.js b/src/pages/Content/context/messaging/handlers.js
index 1fc3182..1dec4f2 100644
--- a/src/pages/Content/context/messaging/handlers.js
+++ b/src/pages/Content/context/messaging/handlers.js
@@ -6,6 +6,11 @@ import { setContentState, contentStateRef, setTimer } from "../ContentState";
import { updateFromStorage } from "../utils/updateFromStorage";
import { checkAuthStatus } from "../utils/checkAuthStatus";
+import {
+ ABORTED,
+ abortStartGate,
+ runPrompterStartGate,
+} from "../../teleprompter/prompterGate";
import { traceStep, setStartFlowOutcome } from "../../../utils/startFlowTrace";
import { perfMark } from "../../../utils/perfMarks";
import { triggerSupportDownload } from "../../../utils/triggerSupportDownload";
@@ -627,6 +632,13 @@ export const setupHandlers = () => {
pendingRecording: true,
}));
+ // Waits on the user's choice when the capture would record the teleprompter
+ // window. No-op if it isn't open.
+ try {
+ // Ended under the prompt (stop-pending, recording-error): no countdown.
+ if ((await runPrompterStartGate(getState())) === ABORTED) return;
+ } catch {}
+
// BG is source of truth; reading React default would race the user
// setting and produce double beeps.
const { countdown: storedCountdown } = await chrome.storage.local.get([
@@ -711,6 +723,44 @@ export const setupHandlers = () => {
});
});
+ registerMessage("toggle-mic", () => {
+ const state = contentStateRef.current;
+ if (state.pushToTalk || !state.microphonePermission) return;
+ const nextActive = !state.micActive;
+ let patch = { micActive: nextActive };
+ if (state.recording) {
+ if (state.defaultAudioInput === "none") return;
+ } else if (nextActive) {
+ // Same pick as the popup's mic dropdown when it turns the mic back on.
+ const devices = state.audioInput || [];
+ const selected =
+ devices.find((d) => d.deviceId === state.defaultAudioInput) ||
+ devices[0];
+ if (!selected) return;
+ patch = {
+ micActive: true,
+ defaultAudioInput: selected.deviceId,
+ defaultAudioInputLabel: selected.label || "",
+ };
+ }
+ setContentState((prev) => ({ ...prev, ...patch }));
+ chrome.storage.local.set(patch);
+ if (!state.recording) return;
+ chrome.runtime.sendMessage({
+ type: "set-mic-active-tab",
+ active: nextActive,
+ defaultAudioInput: state.defaultAudioInput,
+ });
+ if (typeof getState()?.openToast === "function") {
+ getState().openToast(
+ nextActive
+ ? chrome.i18n.getMessage("micOnToast")
+ : chrome.i18n.getMessage("micOffToast"),
+ () => {}
+ );
+ }
+ });
+
registerMessage("toggle-cursor-mode", () => {
if (contentStateRef.current.recordingType === "camera") return;
const state = getState();
@@ -794,6 +844,7 @@ export const setupHandlers = () => {
}
});
registerMessage("recording-error", (message) => {
+ abortStartGate(getState());
// Sender carries why/errorCode. Dropping them landed every
// error-triggered report with a null cause.
setStartFlowOutcome("error", {
@@ -804,6 +855,7 @@ export const setupHandlers = () => {
...prev,
pendingRecording: false,
preparingRecording: false,
+ startGateOpen: false,
recording: false,
paused: false,
time: 0,
@@ -811,6 +863,15 @@ export const setupHandlers = () => {
pipEnded: false,
pipActive: false,
}));
+ // Cancelling the picker is a choice, not a failure.
+ if (
+ message?.error === "cancel-modal" &&
+ /permission denied|notallowederror|user cancelled/i.test(
+ String(message?.why || ""),
+ )
+ ) {
+ return;
+ }
const state = getState();
if (state && typeof state.openModal === "function") {
state.openModal(
@@ -886,6 +947,9 @@ export const setupHandlers = () => {
const toggleCursorModeCommand = message.commands.find(
(command) => command.name === "toggle-cursor-mode",
);
+ const toggleMicCommand = message.commands.find(
+ (command) => command.name === "toggle-mic"
+ );
setContentState((prev) => ({
...prev,
@@ -894,6 +958,7 @@ export const setupHandlers = () => {
toggleDrawingModeShortcut: toggleDrawingModeCommand?.shortcut || "",
toggleBlurModeShortcut: toggleBlurModeCommand?.shortcut || "",
toggleCursorModeShortcut: toggleCursorModeCommand?.shortcut || "",
+ toggleMicShortcut: toggleMicCommand?.shortcut || "",
}));
});
@@ -1213,9 +1278,11 @@ export const setupHandlers = () => {
});
registerMessage("stop-pending", () => {
+ abortStartGate(getState());
setStartFlowOutcome("error");
setContentState((prev) => ({
...prev,
+ startGateOpen: false,
pendingRecording: false,
preparingRecording: false,
pipEnded: false,
diff --git a/src/pages/Content/context/utils/updateFromStorage.js b/src/pages/Content/context/utils/updateFromStorage.js
index 22a3e78..f264856 100644
--- a/src/pages/Content/context/utils/updateFromStorage.js
+++ b/src/pages/Content/context/utils/updateFromStorage.js
@@ -67,6 +67,7 @@ export const updateFromStorage = (check = true, id = null) => {
"systemAudio",
"qualityValue",
"fpsValue",
+ "smootherMotion",
"fastRecorderBeta",
"fastRecorderStatus",
"useWebCodecsRecorder",
@@ -75,7 +76,6 @@ export const updateFromStorage = (check = true, id = null) => {
"sortBy",
"wasLoggedIn",
"instantMode",
- "hasSeenInstantModeModal",
"hasSubscribedBefore",
],
(result) => {
@@ -299,6 +299,10 @@ export const updateFromStorage = (check = true, id = null) => {
result.fpsValue !== undefined && result.fpsValue !== null
? result.fpsValue
: prevContentState.fpsValue,
+ smootherMotion:
+ result.smootherMotion !== undefined && result.smootherMotion !== null
+ ? result.smootherMotion === true
+ : prevContentState.smootherMotion,
fastRecorderBeta:
result.fastRecorderBeta !== undefined &&
result.fastRecorderBeta !== null
@@ -319,7 +323,6 @@ export const updateFromStorage = (check = true, id = null) => {
wasLoggedIn: result.wasLoggedIn || false,
sortBy: result.sortBy || "newest",
instantMode: result.instantMode || false,
- hasSeenInstantModeModal: result.hasSeenInstantModeModal || false,
onboarding: result.onboarding || false,
hasSubscribedBefore: result.hasSubscribedBefore || false,
showProSplash: result.showProSplash || false,
diff --git a/src/pages/Content/countdown/Countdown.jsx b/src/pages/Content/countdown/Countdown.jsx
index 9d69a32..12ce94f 100644
--- a/src/pages/Content/countdown/Countdown.jsx
+++ b/src/pages/Content/countdown/Countdown.jsx
@@ -138,6 +138,17 @@ const Countdown = () => {
return cleanupTimers;
}, [contentState.countdownActive]);
+ // Mirrored into state for the floating window's countdown.
+ useEffect(() => {
+ const value =
+ contentState.countdownActive && contentState.isCountdownVisible
+ ? count
+ : null;
+ setContentState((prev) =>
+ prev.countdownValue === value ? prev : { ...prev, countdownValue: value }
+ );
+ }, [count, contentState.countdownActive, contentState.isCountdownVisible]);
+
useEffect(() => {
if (!activeRef.current || cancelledRef.current) {
return;
diff --git a/src/pages/Content/modal/Modal.jsx b/src/pages/Content/modal/Modal.jsx
index f3eb9d1..8d7b977 100644
--- a/src/pages/Content/modal/Modal.jsx
+++ b/src/pages/Content/modal/Modal.jsx
@@ -1,4 +1,10 @@
-import React, { useState, useEffect, useContext, useCallback } from "react";
+import React, {
+ useState,
+ useEffect,
+ useContext,
+ useCallback,
+ useRef,
+} from "react";
import * as AlertDialog from "@radix-ui/react-alert-dialog";
// Context
@@ -22,6 +28,9 @@ const Modal = (props) => {
const [colorSafe, setColorSafe] = useState(false);
const [sideButton, setSideButton] = useState(false);
const [sideButtonAction, setSideButtonAction] = useState(() => noop);
+ const [escapeAction, setEscapeAction] = useState(null);
+ const [focusAction, setFocusAction] = useState(false);
+ const actionRef = useRef(null);
const openModal = useCallback(
(
@@ -36,7 +45,9 @@ const Modal = (props) => {
learnMoreLink = null,
colorSafe = false,
sideButton = false,
- sideButtonAction = () => {}
+ sideButtonAction = () => {},
+ escapeAction = null,
+ focusAction = false
) => {
setTitle(title);
setDescription(description);
@@ -53,6 +64,10 @@ const Modal = (props) => {
setSideButtonAction(() =>
typeof sideButtonAction === "function" ? sideButtonAction : noop,
);
+ setEscapeAction(() =>
+ typeof escapeAction === "function" ? escapeAction : null
+ );
+ setFocusAction(Boolean(focusAction));
}
);
@@ -93,11 +108,17 @@ const Modal = (props) => {
<div className="AlertDialogOverlay"></div>
<AlertDialog.Content
className="AlertDialogContent"
+ onOpenAutoFocus={(e) => {
+ // Radix focuses Cancel by default; a safe primary action opts in to take it.
+ if (!focusAction || !actionRef.current) return;
+ e.preventDefault();
+ actionRef.current.focus();
+ }}
onEscapeKeyDown={() => {
// Escape == the cancel/secondary action. For modals that pause the
// recording while open (restart/discard confirm), this resumes it
// instead of leaving it stuck paused with the modal gone.
- trigger2();
+ (escapeAction || trigger2)();
}}
>
<AlertDialog.Title className="AlertDialogTitle">
@@ -152,6 +173,7 @@ const Modal = (props) => {
{button1 && (
<AlertDialog.Action asChild>
<button
+ ref={actionRef}
className={!colorSafe ? "Button red" : "Button blue"}
onClick={() => trigger()}
>
diff --git a/src/pages/Content/popup/layout/RecordingType.jsx b/src/pages/Content/popup/layout/RecordingType.jsx
index c94e91e..b5d16e8 100644
--- a/src/pages/Content/popup/layout/RecordingType.jsx
+++ b/src/pages/Content/popup/layout/RecordingType.jsx
@@ -10,6 +10,8 @@ import TooltipWrap from "../components/TooltipWrap";
import BackgroundEffects from "../components/BackgroundEffects";
import ApiIssueWarning from "../components/ApiIssueWarning";
+import TeleprompterRow from "../../teleprompter/TeleprompterRow";
+import { beginRecording } from "../../utils/beginRecording";
import { AlertIcon, TimeIcon } from "../../toolbar/components/SVG";
@@ -83,53 +85,7 @@ const RecordingType = (props) => {
setTime(minutes + ":" + seconds);
}, [contentState.alarmTime]);
- // An unsaved recording is still in an editor tab and a new one destroys it,
- // so the user acknowledges it first.
- const startStreaming = async () => {
- let unsaved = null;
- try {
- unsaved = await chrome.runtime.sendMessage({
- type: "unsaved-retained-recording",
- });
- } catch {}
- if (
- unsaved?.hasUnsaved &&
- typeof contentState.openModal === "function"
- ) {
- contentState.openModal(
- chrome.i18n.getMessage("unsavedRecordingModalTitle"),
- chrome.i18n.getMessage("unsavedRecordingModalDescription"),
- chrome.i18n.getMessage("unsavedRecordingModalAction"),
- chrome.i18n.getMessage("unsavedRecordingModalCancel"),
- () => {
- contentState.startStreaming();
- },
- () => {
- chrome.runtime
- .sendMessage({
- type: "focus-retained-recording",
- tabId: unsaved.tabId,
- })
- .catch(() => {});
- },
- null,
- null,
- null,
- false,
- chrome.i18n.getMessage("unsavedRecordingModalDismiss"),
- () => {
- // Stops the prompt for good and still starts the recording, so the
- // side button is not a dead end.
- chrome.storage.local
- .set({ unsavedRecordingPromptDismissed: Date.now() })
- .catch(() => {});
- contentState.startStreaming();
- },
- );
- return;
- }
- contentState.startStreaming();
- };
+ const startStreaming = () => beginRecording(contentState);
useEffect(() => {
// Check if CropTarget is null
@@ -204,10 +160,7 @@ const RecordingType = (props) => {
</div>
)}
{!contentState.cameraPermission && (
- <button
- className="permission-button"
- onClick={openPermissionsModal}
- >
+ <button className="permission-button" onClick={openPermissionsModal}>
<img src={CameraOffBlue} />
<span>{chrome.i18n.getMessage("allowCameraAccessButton")}</span>
</button>
@@ -242,10 +195,7 @@ const RecordingType = (props) => {
)}
{!contentState.microphonePermission && (
- <button
- className="permission-button"
- onClick={openPermissionsModal}
- >
+ <button className="permission-button" onClick={openPermissionsModal}>
<img src={MicOffBlue} />
<span>{chrome.i18n.getMessage("allowMicrophoneAccessButton")}</span>
</button>
@@ -281,6 +231,8 @@ const RecordingType = (props) => {
/>
</div>
)}
+ <div className="popup-content-divider"></div>
+ <TeleprompterRow />
{contentState.recordingType === "region" && cropActive && (
<div>
<div className="popup-content-divider"></div>
@@ -293,6 +245,8 @@ const RecordingType = (props) => {
</div>
)}
{contentState.isLoggedIn &&
+ // Instant mode needs the cloud recorder, which only subscribers get.
+ contentState.isSubscribed &&
!contentState.recordingToScene &&
// Instant mode bakes the whole recording into one non-editable
// video, incompatible with multi-scene composition. Hide the
diff --git a/src/pages/Content/popup/layout/SettingsMenu.jsx b/src/pages/Content/popup/layout/SettingsMenu.jsx
index a513162..11add69 100644
--- a/src/pages/Content/popup/layout/SettingsMenu.jsx
+++ b/src/pages/Content/popup/layout/SettingsMenu.jsx
@@ -10,6 +10,7 @@ import TooltipWrap from "../components/TooltipWrap";
import { CheckWhiteIcon, DropdownGroup } from "../../images/popup/images";
import { buildDiagnosticZip } from "../../../utils/buildDiagnosticZip";
+import { physicalScreenSize, screenFits } from "../../../utils/physicalScreenSize";
// Context
import { contentStateContext } from "../../context/ContentState";
@@ -26,13 +27,29 @@ const CLOUD_FEATURES_ENABLED =
process.env.SCREENITY_ENABLE_CLOUD_FEATURES === "true";
const DEV_MODE = process.env.SCREENITY_DEV_MODE === "true";
+// Inline: the portal's inherited stylesheet varies.
+const QUALITY_LABEL_STYLE = {
+ padding: "10px 22px 4px",
+ fontSize: 12,
+ lineHeight: 1,
+ letterSpacing: "0.02em",
+ color: "#6e7684",
+ userSelect: "none",
+};
+const QUALITY_SEPARATOR_STYLE = {
+ height: 1,
+ backgroundColor: "#ececf1",
+ margin: "6px 22px",
+};
+
+const FPS_OPTIONS = ["60", "30", "24", "15", "10", "5"];
+
const SettingsMenu = (props) => {
const [contentState, setContentState] = useContext(contentStateContext);
const [restore, setRestore] = useState(false);
const [cloudRestore, setCloudRestore] = useState(false);
const [openQuality, setOpenQuality] = useState(false);
const [openResize, setOpenResize] = useState(false);
- const [openFPS, setOpenFPS] = useState(false);
const [RAM, setRAM] = useState(0);
const [width, setWidth] = useState(0);
const [height, setHeight] = useState(0);
@@ -103,11 +120,13 @@ const SettingsMenu = (props) => {
};
useEffect(() => {
- // More accurate screen detection
- const w = window.screen.availWidth * window.devicePixelRatio;
- const h = window.screen.availHeight * window.devicePixelRatio;
- setWidth(Math.round(w));
- setHeight(Math.round(h));
+ // Full display, not avail*: the menu bar/taskbar cut would hide 4K on a native 4K monitor.
+ const { width: w, height: h } = physicalScreenSize(
+ window.screen,
+ window.devicePixelRatio
+ );
+ setWidth(w);
+ setHeight(h);
// Fix RAM detection on macOS
const isMac = navigator.userAgent.includes("Macintosh");
@@ -124,12 +143,14 @@ const SettingsMenu = (props) => {
}
};
+ // A probe from before the ladder-v2 gate has no supports4k; count it stale.
const hasLadderFields = (probe) => {
if (!probe || !probe.details) return false;
return (
Array.isArray(probe.details.attemptSummary) &&
probe.details.attemptSummary.length > 0 &&
- Boolean(probe.details.selectedVideoConfig)
+ Boolean(probe.details.selectedVideoConfig) &&
+ typeof probe.details.supports4k === "boolean"
);
};
@@ -260,6 +281,44 @@ const SettingsMenu = (props) => {
};
}, [contentState?.useWebCodecsRecorder]);
+ // Unset reads as auto, matching resolveQualityValue/resolveFps.
+ const qualityChoice = contentState.qualityValue ?? "auto";
+ const fpsChoice = contentState.fpsValue ?? "auto";
+ const qualityIsAuto = qualityChoice === "auto" && fpsChoice === "auto";
+
+ const updateQuality = (patch) => {
+ setContentState((prevContentState) => ({
+ ...prevContentState,
+ ...patch,
+ }));
+ chrome.storage.local.set(patch);
+ };
+
+ // Offered on smaller screens too: 4k is a fit-inside box, never upscaled, and
+ // the screen is only picked later in Chrome's share picker.
+ const supports4k =
+ fastRecorderInfo?.probe?.details?.supports4k === true && RAM >= 8;
+
+ // A saved 4k stays visible and checked while the probe is unknown, and when
+ // RAM now rules it out. Only a definite probe miss hides it: the recorder
+ // drops that pick to 1080p, so 1080p shows as checked.
+ const probeMissed4k = fastRecorderInfo?.probe?.details?.supports4k === false;
+ const show4k = supports4k || (qualityChoice === "4k" && !probeMissed4k);
+ const shownQuality =
+ qualityChoice === "4k" && probeMissed4k ? "1080p" : qualityChoice;
+
+ // When 4k is offered, lower rungs ignore the screen gate for the same reason.
+ const fitsScreen = (w, h) => supports4k || screenFits({ width, height }, w, h);
+
+ const qualityOptions = [
+ ...(show4k ? [{ value: "4k", disabled: !supports4k }] : []),
+ { value: "1080p", disabled: RAM < 4 || !fitsScreen(1920, 1080) },
+ { value: "720p", disabled: RAM < 2 || !fitsScreen(1280, 720) },
+ { value: "480p", disabled: false },
+ { value: "360p", disabled: false },
+ { value: "240p", disabled: false },
+ ];
+
return (
<DropdownMenu.Root
open={props.open}
@@ -313,7 +372,6 @@ const SettingsMenu = (props) => {
open={openResize}
onOpenChange={(open) => {
if (open) {
- setOpenFPS(false);
setOpenQuality(false);
}
setOpenResize(open);
@@ -354,7 +412,7 @@ const SettingsMenu = (props) => {
</TooltipWrap>
<TooltipWrap
content={
- width < 1920 || height < 1080
+ !screenFits({ width, height }, 1920, 1080)
? chrome.i18n.getMessage("screenTooSmallTooltip")
: ""
}
@@ -368,14 +426,14 @@ const SettingsMenu = (props) => {
height: 1080,
});
}}
- disabled={width < 1920 || height < 1080}
+ disabled={!screenFits({ width, height }, 1920, 1080)}
>
1920 x 1080 (1080p)
</DropdownMenu.Item>
</TooltipWrap>
<TooltipWrap
content={
- width < 1280 || height < 720
+ !screenFits({ width, height }, 1280, 720)
? chrome.i18n.getMessage("screenTooSmallTooltip")
: ""
}
@@ -389,14 +447,14 @@ const SettingsMenu = (props) => {
height: 720,
});
}}
- disabled={width < 1280 || height < 720}
+ disabled={!screenFits({ width, height }, 1280, 720)}
>
1280 x 720 (720p)
</DropdownMenu.Item>
</TooltipWrap>
<TooltipWrap
content={
- width < 640 || height < 480
+ !screenFits({ width, height }, 640, 480)
? chrome.i18n.getMessage("screenTooSmallTooltip")
: ""
}
@@ -410,14 +468,14 @@ const SettingsMenu = (props) => {
height: 480,
});
}}
- disabled={width < 640 || height < 480}
+ disabled={!screenFits({ width, height }, 640, 480)}
>
640 x 480 (480p)
</DropdownMenu.Item>
</TooltipWrap>
<TooltipWrap
content={
- width < 480 || height < 360
+ !screenFits({ width, height }, 480, 360)
? chrome.i18n.getMessage("screenTooSmallTooltip")
: ""
}
@@ -431,14 +489,14 @@ const SettingsMenu = (props) => {
height: 360,
});
}}
- disabled={width < 480 || height < 360}
+ disabled={!screenFits({ width, height }, 480, 360)}
>
480 x 360 (360p)
</DropdownMenu.Item>
</TooltipWrap>
<TooltipWrap
content={
- width < 320 || height < 240
+ !screenFits({ width, height }, 320, 240)
? chrome.i18n.getMessage("screenTooSmallTooltip")
: ""
}
@@ -452,7 +510,7 @@ const SettingsMenu = (props) => {
height: 240,
});
}}
- disabled={width < 320 || height < 240}
+ disabled={!screenFits({ width, height }, 320, 240)}
>
320 x 240 (240p)
</DropdownMenu.Item>
@@ -461,22 +519,22 @@ const SettingsMenu = (props) => {
</DropdownMenu.Portal>
</DropdownMenu.Sub>
)}
- {!contentState.isSubscribed && !contentState.isLoggedIn && (
+ {!contentState.isSubscribed && (
<DropdownMenu.Sub
open={openQuality}
onOpenChange={(open) => {
if (open) {
- setOpenFPS(false);
setOpenResize(false);
}
setOpenQuality(open);
}}
>
<DropdownMenu.SubTrigger className="DropdownMenuItem">
- {chrome.i18n.getMessage("maxResolutionLabel") +
- " (" +
- contentState.qualityValue +
- ")"}
+ {chrome.i18n.getMessage("qualityLabel") +
+ ": " +
+ chrome.i18n.getMessage(
+ qualityIsAuto ? "qualityAutoLabel" : "qualityCustomLabel"
+ )}
<div className="ItemIndicatorArrow">
<img src={DropdownGroup} />
</div>
@@ -488,195 +546,112 @@ const SettingsMenu = (props) => {
alignOffset={-3}
>
<DropdownMenu.RadioGroup
- value={contentState.qualityValue}
- onValueChange={(value) => {
- setContentState((prevContentState) => ({
- ...prevContentState,
- qualityValue: value,
- }));
- chrome.storage.local.set({
- qualityValue: value,
- });
- }}
+ value={qualityIsAuto ? "auto" : ""}
+ onValueChange={() =>
+ updateQuality({
+ qualityValue: "auto",
+ fpsValue: "auto",
+ })
+ }
>
- <TooltipWrap
- content={
- RAM < 8 || width < 3840 || height < 2160
- ? chrome.i18n.getMessage("maxResolutionTooltip")
- : ""
- }
- >
- <DropdownMenu.RadioItem
- className="ScreenityDropdownMenuItem"
- value="4k"
- disabled={RAM < 8 || width < 3840 || height < 2160}
- >
- 4k
- <DropdownMenu.ItemIndicator className="ScreenityItemIndicator">
- <img src={CheckWhiteIcon} />
- </DropdownMenu.ItemIndicator>
- </DropdownMenu.RadioItem>
- </TooltipWrap>
- <TooltipWrap
- content={
- RAM < 4 || width < 1920 || height < 1080
- ? chrome.i18n.getMessage("maxResolutionTooltip")
- : ""
- }
- >
- <DropdownMenu.RadioItem
- className="ScreenityDropdownMenuItem"
- value="1080p"
- disabled={RAM < 4 || width < 1920 || height < 1080}
- >
- 1080p
- <DropdownMenu.ItemIndicator className="ScreenityItemIndicator">
- <img src={CheckWhiteIcon} />
- </DropdownMenu.ItemIndicator>
- </DropdownMenu.RadioItem>
- </TooltipWrap>
- <TooltipWrap
- content={
- RAM < 2 || width < 1280 || height < 720
- ? chrome.i18n.getMessage("maxResolutionTooltip")
- : ""
- }
- >
- <DropdownMenu.RadioItem
- className="ScreenityDropdownMenuItem"
- value="720p"
- disabled={RAM < 2 || width < 1280 || height < 720}
- >
- 720p
- <DropdownMenu.ItemIndicator className="ScreenityItemIndicator">
- <img src={CheckWhiteIcon} />
- </DropdownMenu.ItemIndicator>
- </DropdownMenu.RadioItem>
- </TooltipWrap>
<DropdownMenu.RadioItem
className="ScreenityDropdownMenuItem"
- value="480p"
+ value="auto"
>
- 480p
- <DropdownMenu.ItemIndicator className="ScreenityItemIndicator">
- <img src={CheckWhiteIcon} />
- </DropdownMenu.ItemIndicator>
- </DropdownMenu.RadioItem>
- <DropdownMenu.RadioItem
- className="ScreenityDropdownMenuItem"
- value="360p"
- >
- 360p
- <DropdownMenu.ItemIndicator className="ScreenityItemIndicator">
- <img src={CheckWhiteIcon} />
- </DropdownMenu.ItemIndicator>
- </DropdownMenu.RadioItem>
- <DropdownMenu.RadioItem
- className="ScreenityDropdownMenuItem"
- value="240p"
- >
- 240p
+ {chrome.i18n.getMessage("qualityAutoLabel")}
<DropdownMenu.ItemIndicator className="ScreenityItemIndicator">
<img src={CheckWhiteIcon} />
</DropdownMenu.ItemIndicator>
</DropdownMenu.RadioItem>
</DropdownMenu.RadioGroup>
- </DropdownMenu.SubContent>
- </DropdownMenu.Portal>
- </DropdownMenu.Sub>
- )}
- {!contentState.isSubscribed && !contentState.isLoggedIn && (
- <DropdownMenu.Sub
- open={openFPS}
- onOpenChange={(open) => {
- if (open) {
- setOpenQuality(false);
- setOpenResize(false);
- }
- setOpenFPS(open);
- }}
- >
- <DropdownMenu.SubTrigger className="DropdownMenuItem">
- {chrome.i18n.getMessage("maxFPSLabel") +
- " (" +
- contentState.fpsValue +
- " fps)"}
- <div className="ItemIndicatorArrow">
- <img src={DropdownGroup} />
- </div>
- </DropdownMenu.SubTrigger>
- <DropdownMenu.Portal>
- <DropdownMenu.SubContent
- className="ScreenityDropdownMenuContent"
- sideOffset={0}
- alignOffset={-3}
- >
- <DropdownMenu.RadioGroup
- value={contentState.fpsValue}
- onValueChange={(value) => {
- setContentState((prevContentState) => ({
- ...prevContentState,
- fpsValue: value,
- }));
- chrome.storage.local.set({
- fpsValue: value,
- });
+ <DropdownMenu.CheckboxItem
+ className="ScreenityDropdownMenuItem"
+ disabled={fpsChoice !== "auto"}
+ onSelect={(e) => {
+ e.preventDefault();
}}
+ onCheckedChange={(checked) =>
+ updateQuality({ smootherMotion: checked })
+ }
+ checked={contentState.smootherMotion === true}
+ >
+ {chrome.i18n.getMessage("smootherMotionLabel")}
+ <DropdownMenu.ItemIndicator className="ScreenityItemIndicator">
+ <img src={CheckWhiteIcon} />
+ </DropdownMenu.ItemIndicator>
+ </DropdownMenu.CheckboxItem>
+ <DropdownMenu.Separator style={QUALITY_SEPARATOR_STYLE} />
+ <DropdownMenu.Label style={QUALITY_LABEL_STYLE}>
+ {chrome.i18n.getMessage("resolutionGroupLabel")}
+ </DropdownMenu.Label>
+ <DropdownMenu.RadioGroup
+ value={shownQuality}
+ onValueChange={(value) =>
+ updateQuality({ qualityValue: value })
+ }
>
<DropdownMenu.RadioItem
className="ScreenityDropdownMenuItem"
- value="60"
- >
- 60 fps
- <DropdownMenu.ItemIndicator className="ScreenityItemIndicator">
- <img src={CheckWhiteIcon} />
- </DropdownMenu.ItemIndicator>
- </DropdownMenu.RadioItem>
- <DropdownMenu.RadioItem
- className="ScreenityDropdownMenuItem"
- value="30"
- >
- 30 fps
- <DropdownMenu.ItemIndicator className="ScreenityItemIndicator">
- <img src={CheckWhiteIcon} />
- </DropdownMenu.ItemIndicator>
- </DropdownMenu.RadioItem>
- <DropdownMenu.RadioItem
- className="ScreenityDropdownMenuItem"
- value="24"
- >
- 24 fps
- <DropdownMenu.ItemIndicator className="ScreenityItemIndicator">
- <img src={CheckWhiteIcon} />
- </DropdownMenu.ItemIndicator>
- </DropdownMenu.RadioItem>
- <DropdownMenu.RadioItem
- className="ScreenityDropdownMenuItem"
- value="15"
- >
- 15 fps
- <DropdownMenu.ItemIndicator className="ScreenityItemIndicator">
- <img src={CheckWhiteIcon} />
- </DropdownMenu.ItemIndicator>
- </DropdownMenu.RadioItem>
- <DropdownMenu.RadioItem
- className="ScreenityDropdownMenuItem"
- value="10"
+ value="auto"
>
- 10 fps
+ {chrome.i18n.getMessage("qualityAutoLabel")}
<DropdownMenu.ItemIndicator className="ScreenityItemIndicator">
<img src={CheckWhiteIcon} />
</DropdownMenu.ItemIndicator>
</DropdownMenu.RadioItem>
+ {qualityOptions.map(({ value, disabled }) => (
+ <TooltipWrap
+ key={value}
+ content={
+ disabled
+ ? chrome.i18n.getMessage("maxResolutionTooltip")
+ : ""
+ }
+ >
+ <DropdownMenu.RadioItem
+ className="ScreenityDropdownMenuItem"
+ value={value}
+ disabled={disabled}
+ >
+ {value}
+ <DropdownMenu.ItemIndicator className="ScreenityItemIndicator">
+ <img src={CheckWhiteIcon} />
+ </DropdownMenu.ItemIndicator>
+ </DropdownMenu.RadioItem>
+ </TooltipWrap>
+ ))}
+ </DropdownMenu.RadioGroup>
+ <DropdownMenu.Separator style={QUALITY_SEPARATOR_STYLE} />
+ <DropdownMenu.Label style={QUALITY_LABEL_STYLE}>
+ {chrome.i18n.getMessage("frameRateGroupLabel")}
+ </DropdownMenu.Label>
+ <DropdownMenu.RadioGroup
+ value={fpsChoice}
+ onValueChange={(value) =>
+ updateQuality({ fpsValue: value })
+ }
+ >
<DropdownMenu.RadioItem
className="ScreenityDropdownMenuItem"
- value="5"
+ value="auto"
>
- 5 fps
+ {chrome.i18n.getMessage("qualityAutoLabel")}
<DropdownMenu.ItemIndicator className="ScreenityItemIndicator">
<img src={CheckWhiteIcon} />
</DropdownMenu.ItemIndicator>
</DropdownMenu.RadioItem>
+ {FPS_OPTIONS.map((value) => (
+ <DropdownMenu.RadioItem
+ key={value}
+ className="ScreenityDropdownMenuItem"
+ value={value}
+ >
+ {value} fps
+ <DropdownMenu.ItemIndicator className="ScreenityItemIndicator">
+ <img src={CheckWhiteIcon} />
+ </DropdownMenu.ItemIndicator>
+ </DropdownMenu.RadioItem>
+ ))}
</DropdownMenu.RadioGroup>
</DropdownMenu.SubContent>
</DropdownMenu.Portal>
diff --git a/src/pages/Content/popup/styles/components/_Tooltip.scss b/src/pages/Content/popup/styles/components/_Tooltip.scss
index 0a765e7..c15c403 100644
--- a/src/pages/Content/popup/styles/components/_Tooltip.scss
+++ b/src/pages/Content/popup/styles/components/_Tooltip.scss
@@ -3,7 +3,7 @@
.TooltipContent {
border-radius: $container-border-radius;
background-color: $color-text-primary;
- padding: 10px 15px;
+ padding: 8px 13px;
font-size: 12px;
line-height: 1;
font-family: $font-medium;
diff --git a/src/pages/Content/styles/app.css b/src/pages/Content/styles/app.css
index 44c0616..5b76c2f 100644
--- a/src/pages/Content/styles/app.css
+++ b/src/pages/Content/styles/app.css
@@ -824,7 +824,7 @@ body.driver-active .OnboardingArrow {
.TooltipContent {
border-radius: 30px;
background-color: #29292f;
- padding: 10px 15px;
+ padding: 8px 13px;
font-size: 12px;
margin-bottom: 10px;
bottom: 100px;
@@ -3685,7 +3685,7 @@ button {
.TooltipContent {
border-radius: 30px;
background-color: #29292f;
- padding: 10px 15px;
+ padding: 8px 13px;
font-size: 12px;
line-height: 1;
font-family: "Satoshi-Medium", sans-serif;
diff --git a/src/pages/Content/teleprompter/Teleprompter.jsx b/src/pages/Content/teleprompter/Teleprompter.jsx
new file mode 100644
index 0000000..d6b584a
--- /dev/null
+++ b/src/pages/Content/teleprompter/Teleprompter.jsx
@@ -0,0 +1,1315 @@
+import React, {
+ useCallback,
+ useEffect,
+ useLayoutEffect,
+ useRef,
+ useState,
+} from "react";
+
+import {
+ FONT_SIZE_MAX,
+ FONT_SIZE_MIN,
+ FONT_STEP,
+ WPM_MAX,
+ WPM_MIN,
+ WPM_STEP,
+ wpmToPxPerSecond,
+} from "./prompterRules";
+
+// Inline styles throughout: this renders inside the Picture-in-Picture
+// window, which has none of the page's or the extension's stylesheets.
+
+const msg = (key, fallback) => chrome.i18n.getMessage(key) || fallback;
+
+const LEAD_IN_SECONDS = 3;
+const FONT_STACK =
+ '"Satoshi-Medium", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif';
+const SURFACE = "#1b1b1f";
+const HAIRLINE = "rgb(255 255 255 / 8%)";
+const PRIMARY = "#3080f8";
+
+const pill = {
+ position: "absolute",
+ top: 8,
+ right: 8,
+ zIndex: 2,
+ display: "flex",
+ alignItems: "center",
+ gap: 4,
+};
+
+const pillButton = {
+ width: 32,
+ height: 32,
+ padding: 0,
+ display: "inline-flex",
+ alignItems: "center",
+ justifyContent: "center",
+ background: "transparent",
+ color: "#fff",
+ border: "none",
+ borderRadius: 999,
+ cursor: "pointer",
+ flexShrink: 0,
+};
+
+const roundButton = { ...pillButton, width: 40, height: 40 };
+
+const textButton = {
+ ...pillButton,
+ width: "auto",
+ height: 36,
+ padding: "0 14px",
+ borderRadius: 999,
+ fontSize: 13,
+ fontFamily: "inherit",
+ border: `1px solid ${HAIRLINE}`,
+};
+
+const stopButton = {
+ ...roundButton,
+ width: 40,
+ height: 40,
+ padding: 0,
+ background: "transparent",
+ border: "none",
+};
+
+const menuPanel = {
+ position: "absolute",
+ top: 48,
+ right: 8,
+ zIndex: 3,
+ minWidth: 236,
+ boxSizing: "border-box",
+ display: "flex",
+ flexDirection: "column",
+ padding: 6,
+ background: "#141418",
+ border: `1px solid ${HAIRLINE}`,
+ borderRadius: 16,
+ boxShadow: "0 8px 24px rgb(0 0 0 / 35%)",
+ userSelect: "none",
+};
+
+const menuItem = {
+ display: "flex",
+ alignItems: "center",
+ width: "100%",
+ height: 36,
+ padding: "0 12px",
+ background: "transparent",
+ color: "#fff",
+ border: "none",
+ borderRadius: 10,
+ fontSize: 13,
+ fontFamily: "inherit",
+ textAlign: "left",
+ cursor: "pointer",
+};
+
+const CSS = `
+.stp-edit::-webkit-scrollbar{width:6px;background:transparent}
+.stp-edit::-webkit-scrollbar-track{background:transparent;margin:20px 0}
+.stp-edit::-webkit-scrollbar-thumb{background-color:transparent;border-radius:8px;transition:background-color .3s ease}
+.stp-edit:hover::-webkit-scrollbar-thumb{background-color:rgb(255 255 255 / 18%)}
+.stp-edit:hover::-webkit-scrollbar-thumb:hover{background-color:rgb(255 255 255 / 30%)}
+[data-tip]{position:relative}
+[data-tip]::after{content:attr(data-tip);position:absolute;left:50%;top:calc(100% + 8px);transform:translateX(-50%);white-space:nowrap;background:#29292f;color:#fff;font-family:${FONT_STACK};font-size:12px;line-height:1;padding:7px 12px;border-radius:30px;box-shadow:hsl(206 22% 7% / 35%) 0 10px 38px -10px,hsl(206 22% 7% / 20%) 0 10px 20px -15px;pointer-events:none;user-select:none;z-index:10;opacity:0;visibility:hidden}
+[data-tip]:hover::after,[data-tip]:focus-visible::after{visibility:visible;animation:stp-tip .4s cubic-bezier(.16,1,.3,1) .7s both}
+@keyframes stp-tip{from{opacity:0;margin-top:2px}to{opacity:1;margin-top:0}}
+.stp-bar-controls [data-tip]::after{top:auto;bottom:calc(100% + 8px)}
+.stp-pill-top [data-tip]::after{left:auto;right:0;transform:none}
+.stp-pill-dim{opacity:.55;transition:opacity .2s ease}
+.stp-quiet .stp-quiet-hide{opacity:0;transition:opacity .2s ease}
+.stp-quiet:hover .stp-quiet-hide,.stp-quiet .stp-quiet-hide:focus-within{opacity:1}
+.stp-root:hover .stp-pill-dim,.stp-pill-dim:focus-within{opacity:1}
+.stp-viewport:hover .stp-bar{opacity:1 !important}
+.stp-menu-item:hover,.stp-menu-item:focus-visible{background:${HAIRLINE} !important}
+.stp-menu-item:focus-visible{outline:none;box-shadow:0 0 0 2px rgb(48 128 248 / 50%)}
+.stp-pill-button:hover:not(:disabled){background:${HAIRLINE} !important}
+.stp-stop:hover:not(:disabled){filter:brightness(1.12)}
+.stp-stop-record{background:none !important}
+.stp-stop:disabled{cursor:default}
+.stp-stop:disabled>*{opacity:.35}
+.stp-stop:focus-visible{outline:none;box-shadow:0 0 0 2px rgb(255 255 255 / 60%)}
+.stp-pill-button:disabled{cursor:default}
+.stp-pill-button:disabled>*{opacity:.35}
+.stp-pill-button:focus-visible{outline:none;box-shadow:0 0 0 2px rgb(48 128 248 / 50%)}
+`;
+
+const ICONS = {
+ play: <polygon points="6 3 20 12 6 21 6 3" />,
+ pause: (
+ <>
+ <rect x="14" y="4" width="4" height="16" rx="1" />
+ <rect x="6" y="4" width="4" height="16" rx="1" />
+ </>
+ ),
+ scroll: (
+ <>
+ <path d="m7 6 5 5 5-5" />
+ <path d="m7 13 5 5 5-5" />
+ </>
+ ),
+ more: (
+ <>
+ <circle cx="12" cy="12" r="1" />
+ <circle cx="19" cy="12" r="1" />
+ <circle cx="5" cy="12" r="1" />
+ </>
+ ),
+ minus: <path d="M5 12h14" />,
+ plus: <path d="M5 12h14M12 5v14" />,
+ check: <path d="M20 6 9 17l-5-5" />,
+ restart: (
+ <>
+ <path d="M17 1l4 4-4 4" />
+ <path d="M3 11V9a4 4 0 0 1 4-4h14" />
+ <path d="M7 23l-4-4 4-4" />
+ <path d="M21 13v2a4 4 0 0 1-4 4H3" />
+ </>
+ ),
+ discard: (
+ <>
+ <path d="M3 6h18" />
+ <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
+ <path d="M10 11v6" />
+ <path d="M14 11v6" />
+ </>
+ ),
+ mic: (
+ <>
+ <path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z" />
+ <path d="M19 10v2a7 7 0 0 1-14 0v-2" />
+ <path d="M12 19v3" />
+ </>
+ ),
+ micOff: (
+ <>
+ <path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z" />
+ <path d="M19 10v2a7 7 0 0 1-14 0v-2" />
+ <path d="M12 19v3" />
+ <path d="M2 2l20 20" stroke="#ff5c5c" />
+ </>
+ ),
+};
+
+const RecordingIcon = ({ paused, size = 20 }) => (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 16 16"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ aria-hidden="true"
+ >
+ {paused ? (
+ <path strokeWidth="1.5" d="m3.5 2.5 9 5.5-9 5.5v-11Z" />
+ ) : (
+ <path strokeWidth="2" d="M4.922 13.538V2.46m6.156 11.078V2.46" />
+ )}
+ </svg>
+);
+
+const MicLevelIcon = ({ on, level = 0 }) => (
+ <svg
+ width="20"
+ height="20"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ aria-hidden="true"
+ style={{ display: "block" }}
+ >
+ <defs>
+ <clipPath id="stp-mic-clip">
+ <path
+ d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"
+ stroke="black"
+ strokeWidth="2"
+ fill="black"
+ />
+ </clipPath>
+ </defs>
+ {on && (
+ <g clipPath="url(#stp-mic-clip)">
+ <rect
+ x="7"
+ y="5"
+ width="10"
+ height="12"
+ fill="#30A46C"
+ stroke="none"
+ style={{
+ transform: `translateY(${
+ (1 - Math.min(1, Math.max(0, level))) * 12
+ }px)`,
+ transition: "transform 0.08s linear",
+ }}
+ />
+ </g>
+ )}
+ <path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z" />
+ <path d="M19 10v2a7 7 0 0 1-14 0v-2" />
+ <path d="M12 19v3" />
+ {!on && <path d="M2 2l20 20" stroke="#ff5c5c" />}
+ </svg>
+);
+
+const Icon = ({ name, size = 16 }) => (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ aria-hidden="true"
+ >
+ {ICONS[name]}
+ </svg>
+);
+
+/**
+ * The scroll loop runs on the PiP window's animation frame
+ * (`ownerDocument.defaultView`), not the page's: the PiP has its own frame
+ * clock, and the page is usually a background tab while recording a window,
+ * where its frames are throttled.
+ */
+const Teleprompter = ({
+ settings,
+ onSettings,
+ playing,
+ canPlay,
+ onPlayingChange,
+ rewindToken,
+ onRewind,
+ onHide,
+ timerLabel,
+ controls,
+ showScript = true,
+ backdrop = "solid",
+ quiet = false,
+ paused = false,
+ countdown = null,
+ hasCamera = false,
+ onShowScript,
+ canShowScript = true,
+}) => {
+ const { script, fontSize, wpm, autoScroll } = settings;
+
+ const [editingRequested, setEditingRequested] = useState(false);
+ const [menuOpen, setMenuOpen] = useState(false);
+ const restoreFocusRef = useRef(false);
+ const [clearArmed, setClearArmed] = useState(false);
+ const hasScript = script.trim().length > 0;
+ // Typing during a take would be heard in it, so edit only before the take or while paused.
+ const canEdit = !controls || controls.inactive || controls.paused;
+ // No placeholder mid-take: an empty script opens the box only while editing is allowed.
+ const editing = canEdit && (editingRequested || !hasScript);
+
+ const rootRef = useRef(null);
+ const menuRef = useRef(null);
+ const moreRef = useRef(null);
+ const viewportRef = useRef(null);
+ const textRef = useRef(null);
+ const barRef = useRef(null);
+ const dragRef = useRef(null);
+ const offsetRef = useRef(0);
+ const wpmRef = useRef(wpm);
+ const fontRef = useRef(fontSize);
+ wpmRef.current = wpm;
+ fontRef.current = fontSize;
+
+ const apply = useCallback(() => {
+ const text = textRef.current;
+ if (text) text.style.transform = `translateY(${-offsetRef.current}px)`;
+ const viewport = viewportRef.current;
+ const bar = barRef.current;
+ if (viewport && text && bar) {
+ const track = viewport.clientHeight - 40;
+ const total = text.scrollHeight;
+ const ratio = Math.min(1, viewport.clientHeight / Math.max(1, total));
+ const thumb = Math.max(24, track * ratio);
+ const max = Math.max(1, total - viewport.clientHeight * 0.66);
+ const progress = Math.min(1, offsetRef.current / max);
+ bar.style.height = `${thumb}px`;
+ bar.style.transform = `translateY(${progress * (track - thumb)}px)`;
+ bar.style.display = total <= viewport.clientHeight ? "none" : "block";
+ }
+ }, []);
+
+ // The last line stops a third of the way down, so the end is read where the eyes already are.
+ const maxOffset = useCallback(() => {
+ const viewport = viewportRef.current;
+ const text = textRef.current;
+ if (!viewport || !text) return 0;
+ return Math.max(0, text.scrollHeight - viewport.clientHeight * 0.66);
+ }, []);
+
+ useEffect(() => {
+ offsetRef.current = 0;
+ apply();
+ }, [rewindToken, apply]);
+
+ // A shorter script must not leave the text scrolled past its own end.
+ useEffect(() => {
+ if (!viewportRef.current) return;
+ offsetRef.current = Math.min(offsetRef.current, maxOffset());
+ apply();
+ }, [script, fontSize, apply, maxOffset, showScript]);
+
+ useEffect(() => {
+ if (!playing) return undefined;
+ const viewport = viewportRef.current;
+ const win = viewport?.ownerDocument?.defaultView;
+ if (!viewport || !win) return undefined;
+
+ if (offsetRef.current > 0 && offsetRef.current >= maxOffset()) {
+ offsetRef.current = 0;
+ apply();
+ }
+
+ let frame = 0;
+ let last = win.performance.now();
+ // Hold at the top so the first line can be read before it moves.
+ let hold = offsetRef.current === 0 ? LEAD_IN_SECONDS : 0;
+ const tick = (now) => {
+ const dt = Math.min(0.1, (now - last) / 1000);
+ last = now;
+ if (hold > 0) {
+ hold -= dt;
+ frame = win.requestAnimationFrame(tick);
+ return;
+ }
+ const speed = wpmToPxPerSecond(
+ wpmRef.current,
+ fontRef.current,
+ viewport.clientWidth
+ );
+ const limit = maxOffset();
+ offsetRef.current = Math.min(limit, offsetRef.current + speed * dt);
+ apply();
+ if (offsetRef.current >= limit) {
+ onPlayingChange(false);
+ return;
+ }
+ frame = win.requestAnimationFrame(tick);
+ };
+ frame = win.requestAnimationFrame(tick);
+ return () => win.cancelAnimationFrame(frame);
+ }, [playing, apply, maxOffset, onPlayingChange, showScript]);
+
+ useEffect(() => {
+ if (!menuOpen) setClearArmed(false);
+ }, [menuOpen]);
+
+ const closeMenu = useCallback((restoreFocus = true) => {
+ restoreFocusRef.current = restoreFocus;
+ setMenuOpen(false);
+ }, []);
+
+ // Focus moves into the menu on open and back to its button when it closes
+ // by keyboard or a choice, not when the user clicked elsewhere.
+ useEffect(() => {
+ if (menuOpen) {
+ restoreFocusRef.current = false;
+ menuRef.current
+ ?.querySelector("button:not(:disabled)")
+ ?.focus({ preventScroll: true });
+ } else if (restoreFocusRef.current) {
+ restoreFocusRef.current = false;
+ moreRef.current?.focus({ preventScroll: true });
+ }
+ }, [menuOpen]);
+
+ const onMenuKeyDown = (e) => {
+ const items = Array.from(
+ menuRef.current?.querySelectorAll('[role="menuitem"]:not(:disabled)') ||
+ []
+ );
+ if (!items.length) return;
+ const active = e.currentTarget.ownerDocument.activeElement;
+ const i = items.indexOf(active);
+ let next = null;
+ if (e.key === "ArrowDown") next = items[(i + 1) % items.length];
+ else if (e.key === "ArrowUp")
+ next = items[(i - 1 + items.length) % items.length];
+ else if (e.key === "Home") next = items[0];
+ else if (e.key === "End") next = items[items.length - 1];
+ if (!next) return;
+ e.preventDefault();
+ next.focus();
+ };
+
+ // Listeners go on the PiP window's document, not the page's.
+ useEffect(() => {
+ if (!menuOpen) return undefined;
+ const doc = rootRef.current?.ownerDocument;
+ if (!doc) return undefined;
+ const onPointerDown = (e) => {
+ if (
+ menuRef.current?.contains(e.target) ||
+ moreRef.current?.contains(e.target)
+ ) {
+ return;
+ }
+ closeMenu(false);
+ };
+ const win = doc.defaultView;
+ const onBlur = () => closeMenu(false);
+ win?.addEventListener("blur", onBlur);
+ const onKeyDown = (e) => {
+ if (e.key === "Escape") closeMenu();
+ };
+ doc.addEventListener("pointerdown", onPointerDown);
+ doc.addEventListener("keydown", onKeyDown);
+ return () => {
+ doc.removeEventListener("pointerdown", onPointerDown);
+ doc.removeEventListener("keydown", onKeyDown);
+ win?.removeEventListener("blur", onBlur);
+ };
+ }, [menuOpen, closeMenu]);
+
+ // Manual scroll (wheel or drag) pauses auto-scroll; play resumes from there.
+ const nudge = (delta) => {
+ if (playing) onPlayingChange(false);
+ offsetRef.current = Math.max(
+ 0,
+ Math.min(maxOffset(), offsetRef.current + delta)
+ );
+ apply();
+ };
+ const onWheel = (e) => nudge(e.deltaY);
+ const onPointerDown = (e) => {
+ if (editing || e.button !== 0) return;
+ dragRef.current = { y: e.clientY, moved: false };
+ };
+ const onPointerMove = (e) => {
+ const drag = dragRef.current;
+ if (!drag) return;
+ // A press that ended outside the viewport never reached onPointerUp.
+ if (e.buttons === 0 && !drag.moved) {
+ dragRef.current = null;
+ return;
+ }
+ const dy = e.clientY - drag.y;
+ if (!drag.moved && Math.abs(dy) < 4) return;
+ if (!drag.moved) e.currentTarget.setPointerCapture?.(e.pointerId);
+ drag.moved = true;
+ drag.y = e.clientY;
+ nudge(-dy);
+ };
+ const onPointerUp = () => {
+ // Keep `moved` until the click that follows a drag is swallowed.
+ if (dragRef.current && !dragRef.current.moved) dragRef.current = null;
+ };
+ const onPointerCancel = () => {
+ dragRef.current = null;
+ };
+
+ useEffect(() => {
+ const doc = rootRef.current?.ownerDocument;
+ const win = doc?.defaultView;
+ if (!doc || !win) return undefined;
+ const release = () => {
+ if (dragRef.current && !dragRef.current.moved) dragRef.current = null;
+ };
+ const clear = () => {
+ dragRef.current = null;
+ };
+ doc.addEventListener("pointerup", release);
+ doc.addEventListener("pointercancel", clear);
+ win.addEventListener("blur", clear);
+ return () => {
+ doc.removeEventListener("pointerup", release);
+ doc.removeEventListener("pointercancel", clear);
+ win.removeEventListener("blur", clear);
+ };
+ }, []);
+
+ // The toolbar floats over the top 40px, so the script fades out there rather
+ // than scrolling under the buttons.
+ const viewportMask =
+ "linear-gradient(to bottom, transparent 0, transparent 36px, #000 58px, #000 86%, transparent 100%)";
+ const viewportH = viewportRef.current?.clientHeight || 0;
+ // Only a script taller than the window scrolls, and only then does the edit
+ // box need the prompter's extra travel.
+ const overflows =
+ hasScript && (textRef.current?.scrollHeight || 0) > viewportH;
+ const playTip = playing
+ ? msg("teleprompterPause", "Pause scrolling")
+ : canPlay
+ ? msg("teleprompterPlay", "Start scrolling")
+ : msg(
+ "teleprompterPlayDisabled",
+ "Scrolls automatically once you start recording"
+ );
+ const sidePad = "20px";
+ // Shared by prompter text and edit box so switching between them shifts nothing.
+ const textMetrics = {
+ paddingTop: "max(1.6em, 80px)",
+ paddingBottom: "3em",
+ fontSize,
+ lineHeight: 1.5,
+ fontWeight: 500,
+ textAlign: "center",
+ whiteSpace: "pre-wrap",
+ wordBreak: "break-word",
+ };
+
+ // Focus manually with preventScroll: the browser's autofocus scrolls the
+ // caret into view and drags the text back to the top.
+ const editBoxRef = useRef(null);
+ useLayoutEffect(() => {
+ const el = editBoxRef.current;
+ if (!editing || !el) return;
+ el.focus({ preventScroll: true });
+ el.scrollTop = offsetRef.current;
+ }, [editing]);
+
+ const startEditing = () => {
+ if (!canEdit) return;
+ onPlayingChange(false);
+ setEditingRequested(true);
+ };
+
+ const overCamera = backdrop === "none";
+ const quietNow = quiet && overCamera && !paused;
+
+ const stepRows = [
+ {
+ label: msg("teleprompterTextSize", "Text size"),
+ value: fontSize,
+ less: () => onSettings({ fontSize: fontSize - FONT_STEP }),
+ more: () => onSettings({ fontSize: fontSize + FONT_STEP }),
+ lessOff: fontSize <= FONT_SIZE_MIN,
+ moreOff: fontSize >= FONT_SIZE_MAX,
+ lessLabel: msg("teleprompterSmaller", "Smaller text"),
+ moreLabel: msg("teleprompterLarger", "Larger text"),
+ },
+ {
+ label: msg("teleprompterSpeed", "Speed"),
+ value: `${wpm} ${msg("teleprompterWpmUnit", "wpm")}`,
+ less: () => onSettings({ wpm: wpm - WPM_STEP }),
+ more: () => onSettings({ wpm: wpm + WPM_STEP }),
+ lessOff: wpm <= WPM_MIN,
+ moreOff: wpm >= WPM_MAX,
+ lessLabel: msg("teleprompterSlower", "Slower"),
+ moreLabel: msg("teleprompterFaster", "Faster"),
+ },
+ ];
+
+ return (
+ <div
+ className={quietNow ? "stp-root stp-quiet" : "stp-root"}
+ ref={rootRef}
+ style={{
+ position: "relative",
+ display: "flex",
+ flexDirection: "column",
+ width: "100%",
+ height: "100%",
+ boxSizing: "border-box",
+ background:
+ backdrop === "solid"
+ ? SURFACE
+ : backdrop === "scrim"
+ ? "linear-gradient(rgb(27 27 31 / 82%), rgb(27 27 31 / 64%))"
+ : "transparent",
+ color: "#fff",
+ fontFamily: FONT_STACK,
+ }}
+ >
+ <style>{CSS}</style>
+
+ {showScript ? (
+ <div
+ ref={viewportRef}
+ className="stp-viewport"
+ onWheel={editing ? undefined : onWheel}
+ onPointerDown={onPointerDown}
+ onPointerMove={onPointerMove}
+ onPointerUp={onPointerUp}
+ onPointerCancel={onPointerCancel}
+ onClick={() => {
+ if (dragRef.current?.moved) {
+ dragRef.current = null;
+ return;
+ }
+ if (!playing && !editing) startEditing();
+ }}
+ style={{
+ position: "relative",
+ flex: 1,
+ minHeight: 0,
+ overflow: "hidden",
+ padding: `0 ${sidePad}`,
+ cursor: editing ? "text" : "grab",
+ WebkitMaskImage: viewportMask,
+ maskImage: viewportMask,
+ }}
+ >
+ <div
+ ref={textRef}
+ dir="auto"
+ style={{
+ ...textMetrics,
+ visibility: editing ? "hidden" : "visible",
+ willChange: "transform",
+ }}
+ >
+ {script}
+ </div>
+
+ {editing && (
+ <textarea
+ ref={editBoxRef}
+ dir="auto"
+ value={script}
+ readOnly={!canEdit}
+ onChange={(e) => {
+ // Latch editing so the first character in an empty script does
+ // not swap the box for the prompter.
+ setEditingRequested(true);
+ onSettings({ script: e.target.value });
+ }}
+ // The prompter resumes from the box's scroll position on leaving it.
+ onScroll={(e) => {
+ offsetRef.current = Math.min(
+ e.currentTarget.scrollTop,
+ maxOffset()
+ );
+ apply();
+ }}
+ // An empty script stays in the box (editing is also true when !hasScript).
+ // Ignore the blur from the whole window losing focus (copying text elsewhere).
+ onBlur={(e) => {
+ if (
+ !e.relatedTarget &&
+ !e.currentTarget.ownerDocument.hasFocus()
+ )
+ return;
+ setEditingRequested(false);
+ }}
+ onKeyDown={(e) => {
+ if (e.key === "Escape") e.currentTarget.blur();
+ }}
+ placeholder={msg(
+ "teleprompterPlaceholder",
+ "Write or paste your script"
+ )}
+ aria-label={msg("teleprompterLabel", "Teleprompter")}
+ className="stp-edit"
+ style={{
+ ...textMetrics,
+ // Overlays the viewport with matching padding so lines wrap where the prompter draws them.
+ position: "absolute",
+ inset: 0,
+ width: "100%",
+ height: "100%",
+ margin: 0,
+ paddingLeft: sidePad,
+ // The 6px scrollbar lane is reserved (scrollbarGutter) and taken off
+ // this side so lines wrap at the prompter's width.
+ paddingRight: `calc(${sidePad} - 6px)`,
+ paddingBottom: overflows
+ ? `calc(3em + ${viewportH * 0.34}px)`
+ : undefined,
+ scrollbarGutter: "stable",
+ boxSizing: "border-box",
+ resize: "none",
+ background: "transparent",
+ color: "#fff",
+ border: "none",
+ outline: "none",
+ fontFamily: FONT_STACK,
+ overflowY: "auto",
+ }}
+ />
+ )}
+ {!editing && (
+ <div
+ aria-hidden="true"
+ style={{
+ position: "absolute",
+ top: 20,
+ right: 6,
+ bottom: 20,
+ width: 6,
+ }}
+ >
+ <div
+ ref={barRef}
+ className="stp-bar"
+ style={{
+ width: 6,
+ borderRadius: 8,
+ background: "rgb(255 255 255 / 18%)",
+ opacity: 0,
+ transition: "opacity .3s ease",
+ }}
+ />
+ </div>
+ )}
+ </div>
+ ) : (
+ <div style={{ flex: 1 }} />
+ )}
+
+ {controls?.confirm && (
+ <div
+ style={{
+ flexShrink: 0,
+ boxSizing: "border-box",
+ padding: "20px 20px 22px",
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "stretch",
+ gap: 16,
+ background:
+ backdrop === "none"
+ ? "linear-gradient(transparent, rgb(0 0 0 / 70%))"
+ : "linear-gradient(rgb(27 27 31 / 0%), rgb(27 27 31 / 100%) 28px)",
+ }}
+ >
+ <span
+ style={{
+ fontSize: 15,
+ lineHeight: 1.35,
+ textAlign: "center",
+ textWrap: "balance",
+ }}
+ >
+ {controls.confirm.title}
+ </span>
+ <span style={{ display: "flex", gap: 10 }}>
+ <button
+ type="button"
+ className="stp-pill-button"
+ style={{
+ ...textButton,
+ flex: 1,
+ height: 40,
+ justifyContent: "center",
+ padding: "0 12px",
+ }}
+ onClick={controls.confirm.onCancel}
+ autoFocus
+ >
+ {controls.confirm.cancelLabel}
+ </button>
+ <button
+ type="button"
+ className="stp-stop"
+ style={{
+ ...textButton,
+ flex: 1,
+ height: 40,
+ justifyContent: "center",
+ padding: "0 12px",
+ background: "#df4848",
+ border: "none",
+ color: "#fff",
+ fontWeight: 600,
+ }}
+ onClick={controls.confirm.onConfirm}
+ >
+ {controls.confirm.confirmLabel}
+ </button>
+ </span>
+ </div>
+ )}
+ {controls && !controls.confirm && (
+ <div
+ className={
+ overCamera ? "stp-bar-controls stp-quiet-hide" : "stp-bar-controls"
+ }
+ style={{
+ position: "relative",
+ zIndex: 2,
+ flexShrink: 0,
+ height: 72,
+ boxSizing: "border-box",
+ paddingBottom: 8,
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ gap: 14,
+ }}
+ >
+ <button
+ type="button"
+ className="stp-pill-button"
+ style={roundButton}
+ onClick={controls.onMic}
+ disabled={!controls.micAvailable}
+ aria-label={controls.micLabel}
+ aria-pressed={
+ controls.micAvailable ? Boolean(controls.micOn) : undefined
+ }
+ data-tip={controls.micLabel}
+ >
+ <MicLevelIcon
+ on={controls.micOn}
+ level={controls.micAvailable ? controls.micLevel : 0}
+ />
+ </button>
+ <button
+ type="button"
+ className="stp-pill-button"
+ style={roundButton}
+ onClick={controls.paused ? controls.onResume : controls.onPause}
+ disabled={controls.busy || controls.inactive}
+ aria-label={
+ controls.paused ? controls.resumeLabel : controls.pauseLabel
+ }
+ data-tip={
+ controls.paused ? controls.resumeLabel : controls.pauseLabel
+ }
+ >
+ <RecordingIcon paused={controls.paused} />
+ </button>
+ <button
+ type="button"
+ className="stp-stop stp-stop-record"
+ style={stopButton}
+ onClick={controls.inactive ? controls.onRecord : controls.onStop}
+ disabled={
+ controls.inactive ? controls.recordDisabled : controls.busy
+ }
+ aria-label={
+ controls.inactive ? controls.recordLabel : controls.stopLabel
+ }
+ data-tip={
+ controls.inactive ? controls.recordLabel : controls.stopLabel
+ }
+ >
+ <svg
+ width="40"
+ height="40"
+ viewBox="0 0 52 52"
+ fill="none"
+ aria-hidden="true"
+ >
+ <circle cx="26" cy="26" r="25" stroke="#DF4848" strokeWidth="2" />
+ {controls.inactive ? (
+ <circle cx="26" cy="26" r="21" fill="#DF4848" />
+ ) : (
+ <rect
+ x="15.6875"
+ y="15.6875"
+ width="20.627"
+ height="20.627"
+ rx="5"
+ fill="#DF4848"
+ />
+ )}
+ </svg>
+ </button>
+ <button
+ type="button"
+ className="stp-pill-button"
+ style={roundButton}
+ onClick={controls.onRestart}
+ disabled={controls.busy || controls.inactive}
+ aria-label={controls.restartLabel}
+ data-tip={controls.restartLabel}
+ >
+ <Icon name="restart" size={20} />
+ </button>
+ <button
+ type="button"
+ className="stp-pill-button"
+ style={roundButton}
+ onClick={controls.onDiscard}
+ disabled={controls.busy || controls.inactive}
+ aria-label={controls.discardLabel}
+ data-tip={controls.discardLabel}
+ >
+ <Icon name="discard" size={20} />
+ </button>
+ </div>
+ )}
+
+ {overCamera && (
+ <div
+ aria-hidden="true"
+ className="stp-quiet-hide"
+ style={{
+ position: "absolute",
+ bottom: 0,
+ left: 0,
+ right: 0,
+ height: 140,
+ zIndex: 1,
+ pointerEvents: "none",
+ background:
+ "linear-gradient(transparent, rgb(0 0 0 / 22%) 35%, rgb(0 0 0 / 52%) 70%, rgb(0 0 0 / 68%))",
+ }}
+ />
+ )}
+
+ {overCamera && (
+ <div
+ aria-hidden="true"
+ className="stp-quiet-hide"
+ style={{
+ position: "absolute",
+ top: 0,
+ left: 0,
+ right: 0,
+ height: 72,
+ zIndex: 1,
+ pointerEvents: "none",
+ background:
+ "linear-gradient(rgb(0 0 0 / 42%), rgb(0 0 0 / 30%) 22%, rgb(0 0 0 / 14%) 55%, rgb(0 0 0 / 4%) 82%, transparent)",
+ }}
+ />
+ )}
+
+ {timerLabel && (
+ <div
+ className={overCamera ? "stp-quiet-hide" : undefined}
+ style={{
+ position: "absolute",
+ top: 8,
+ left: 0,
+ right: 0,
+ zIndex: 2,
+ height: 32,
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ pointerEvents: "none",
+ fontSize: 14,
+ fontVariantNumeric: "tabular-nums",
+ color: overCamera ? "#fff" : "rgb(255 255 255 / 72%)",
+ }}
+ >
+ {overCamera ? (
+ <span
+ style={{
+ display: "inline-flex",
+ alignItems: "center",
+ height: 26,
+ padding: "0 12px",
+ borderRadius: 999,
+ background: "rgb(20 20 24 / 55%)",
+ WebkitBackdropFilter: "blur(10px)",
+ backdropFilter: "blur(10px)",
+ }}
+ >
+ {timerLabel}
+ </span>
+ ) : (
+ timerLabel
+ )}
+ </div>
+ )}
+
+ {!showScript && (hasCamera || onShowScript) && (
+ <>
+ <div
+ style={pill}
+ className={
+ overCamera ? "stp-pill-top stp-quiet-hide" : "stp-pill-top"
+ }
+ >
+ <button
+ type="button"
+ className="stp-pill-button"
+ style={{
+ ...pillButton,
+ background: menuOpen ? HAIRLINE : "transparent",
+ }}
+ ref={moreRef}
+ onClick={() => (menuOpen ? closeMenu() : setMenuOpen(true))}
+ aria-expanded={menuOpen}
+ aria-haspopup="menu"
+ aria-label={msg("teleprompterMore", "More script options")}
+ data-tip={msg("teleprompterMore", "More script options")}
+ >
+ <Icon name="more" />
+ </button>
+ </div>
+ {menuOpen && (
+ <div
+ ref={menuRef}
+ style={menuPanel}
+ role="menu"
+ aria-label={msg("teleprompterMore", "More script options")}
+ onKeyDown={onMenuKeyDown}
+ >
+ {onShowScript && canShowScript && (
+ <button
+ type="button"
+ role="menuitem"
+ className="stp-menu-item"
+ style={menuItem}
+ onClick={() => {
+ closeMenu();
+ onShowScript();
+ }}
+ >
+ {msg("teleprompterShow", "Show script")}
+ </button>
+ )}
+ {hasCamera && (
+ <button
+ type="button"
+ role="menuitem"
+ className="stp-menu-item"
+ style={menuItem}
+ onClick={() => {
+ onSettings({ showCamera: false });
+ closeMenu();
+ }}
+ >
+ {msg("teleprompterHideCamera", "Move camera to the page")}
+ </button>
+ )}
+ </div>
+ )}
+ </>
+ )}
+
+ {paused && (
+ <div
+ aria-hidden="true"
+ style={{
+ position: "absolute",
+ inset: 6,
+ borderRadius: 12,
+ border: "2px solid #ef4444",
+ pointerEvents: "none",
+ zIndex: 5,
+ }}
+ />
+ )}
+
+ {countdown != null && (
+ <div
+ aria-live="assertive"
+ style={{
+ position: "absolute",
+ inset: 0,
+ zIndex: 6,
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ background: "rgb(0 0 0 / 45%)",
+ fontSize: 96,
+ fontWeight: 600,
+ fontVariantNumeric: "tabular-nums",
+ pointerEvents: "none",
+ }}
+ >
+ {countdown}
+ </div>
+ )}
+
+ {showScript && (
+ <>
+ <div
+ style={pill}
+ className={playing ? "stp-pill-top stp-pill-dim" : "stp-pill-top"}
+ >
+ <span data-tip={playTip} style={{ display: "inline-flex" }}>
+ <button
+ type="button"
+ className="stp-pill-button"
+ style={{
+ ...pillButton,
+ background: playing ? "rgb(255 255 255 / 16%)" : "transparent",
+ }}
+ onClick={() => {
+ const atEnd =
+ offsetRef.current > 0 &&
+ offsetRef.current >= maxOffset();
+ if (!playing && atEnd) return;
+ onPlayingChange(!playing);
+ }}
+ disabled={!hasScript || (!canPlay && !playing)}
+ aria-label={playTip}
+ aria-pressed={playing}
+ >
+ <Icon name="scroll" />
+ </button>
+ </span>
+ <button
+ type="button"
+ className="stp-pill-button"
+ style={{
+ ...pillButton,
+ background: menuOpen ? HAIRLINE : "transparent",
+ }}
+ ref={moreRef}
+ onClick={() => (menuOpen ? closeMenu() : setMenuOpen(true))}
+ aria-expanded={menuOpen}
+ aria-haspopup="dialog"
+ aria-label={msg("teleprompterMore", "More script options")}
+ data-tip={msg("teleprompterMore", "More script options")}
+ >
+ <Icon name="more" />
+ </button>
+ </div>
+
+ {menuOpen && (
+ <div
+ ref={menuRef}
+ style={menuPanel}
+ role="dialog"
+ aria-label={msg("teleprompterMore", "More script options")}
+ >
+ {stepRows.map((r) => (
+ <div
+ key={r.label}
+ style={{
+ ...menuItem,
+ justifyContent: "space-between",
+ gap: 8,
+ padding: "0 4px 0 12px",
+ boxSizing: "border-box",
+ cursor: "default",
+ }}
+ >
+ <span>{r.label}</span>
+ <span
+ style={{ display: "inline-flex", alignItems: "center" }}
+ >
+ <button
+ type="button"
+ className="stp-pill-button"
+ style={pillButton}
+ onClick={r.less}
+ disabled={r.lessOff}
+ aria-label={r.lessLabel}
+ data-tip={r.lessLabel}
+ >
+ <Icon name="minus" />
+ </button>
+ <span style={{ minWidth: 56, textAlign: "center" }}>
+ {r.value}
+ </span>
+ <button
+ type="button"
+ className="stp-pill-button"
+ style={pillButton}
+ onClick={r.more}
+ disabled={r.moreOff}
+ aria-label={r.moreLabel}
+ data-tip={r.moreLabel}
+ >
+ <Icon name="plus" />
+ </button>
+ </span>
+ </div>
+ ))}
+ <span
+ style={{
+ display: "block",
+ height: 1,
+ margin: "4px 0",
+ background: HAIRLINE,
+ }}
+ aria-hidden="true"
+ />
+ <button
+ type="button"
+ role="switch"
+ aria-checked={autoScroll}
+ className="stp-menu-item"
+ style={{
+ ...menuItem,
+ justifyContent: "space-between",
+ gap: 12,
+ }}
+ onClick={() => onSettings({ autoScroll: !autoScroll })}
+ >
+ {msg(
+ "teleprompterScrollOnStart",
+ "Scroll when recording starts"
+ )}
+ <span
+ style={{ width: 16, display: "inline-flex", color: "#fff" }}
+ >
+ {autoScroll && <Icon name="check" />}
+ </span>
+ </button>
+ <button
+ type="button"
+ className="stp-menu-item"
+ style={menuItem}
+ onClick={() => {
+ onRewind();
+ closeMenu();
+ }}
+ >
+ {msg("teleprompterRewind", "Scroll back to the top")}
+ </button>
+ {hasCamera && (
+ <button
+ type="button"
+ className="stp-menu-item"
+ style={menuItem}
+ onClick={() => {
+ onSettings({ showCamera: !settings.showCamera });
+ closeMenu();
+ }}
+ >
+ {settings.showCamera
+ ? msg("teleprompterHideCamera", "Move camera to the page")
+ : msg("teleprompterShowCamera", "Move camera here")}
+ </button>
+ )}
+ {canEdit && hasScript && (
+ <button
+ type="button"
+ className="stp-menu-item"
+ style={
+ clearArmed ? { ...menuItem, color: "#ff5c5c" } : menuItem
+ }
+ onClick={() => {
+ if (!clearArmed) {
+ setClearArmed(true);
+ return;
+ }
+ setClearArmed(false);
+ closeMenu();
+ onSettings({ script: "" });
+ }}
+ >
+ {clearArmed
+ ? msg("teleprompterClearConfirm", "Click again to clear")
+ : msg("teleprompterClear", "Clear script")}
+ </button>
+ )}
+ <button
+ type="button"
+ className="stp-menu-item"
+ style={menuItem}
+ onClick={() => {
+ closeMenu();
+ onHide();
+ }}
+ >
+ {msg("teleprompterHide", "Hide script")}
+ </button>
+ </div>
+ )}
+ </>
+ )}
+ </div>
+ );
+};
+
+export default Teleprompter;
diff --git a/src/pages/Content/teleprompter/TeleprompterController.jsx b/src/pages/Content/teleprompter/TeleprompterController.jsx
new file mode 100644
index 0000000..7fe035b
--- /dev/null
+++ b/src/pages/Content/teleprompter/TeleprompterController.jsx
@@ -0,0 +1,623 @@
+import React, {
+ useCallback,
+ useContext,
+ useEffect,
+ useRef,
+ useState,
+ useSyncExternalStore,
+} from "react";
+import { createPortal } from "react-dom";
+
+import { contentStateContext, timerContext } from "../context/ContentState";
+import { beginRecording } from "../utils/beginRecording";
+import Teleprompter from "./Teleprompter";
+import {
+ DEFAULT_SETTINGS,
+ formatClock,
+ planCameraAtSurface,
+ cameraCloseWaitsForGate,
+ cameraCanLiveInWindow,
+ captureRecordsWindow,
+ normalizeSettings,
+ shouldClosePrompter,
+} from "./prompterRules";
+import { notifyPrompterClosed, startCameraCloseNotice } from "./prompterGate";
+import { loadPrompterSettings, savePrompterSettings } from "./prompterSettings";
+import {
+ closePipLayer,
+ closePrompterWindow,
+ openPipLayer,
+ getCameraManual,
+ getPipLayers,
+ getPrompterKeepVisible,
+ getPrompterWindow,
+ subscribePrompterWindow,
+} from "./prompterWindow";
+
+const SAVE_DELAY_MS = 400;
+const CLOUD_FEATURES_ENABLED =
+ process.env.SCREENITY_ENABLE_CLOUD_FEATURES === "true";
+
+// Always mounted. Owns the floating window once the popup opens it and ties it
+// to the recording: scrolls with the take, stops on pause, closes if the capture includes it.
+const TeleprompterController = () => {
+ const [contentState, setContentState] = useContext(contentStateContext);
+ const [seconds] = useContext(timerContext);
+ const win = useSyncExternalStore(subscribePrompterWindow, getPrompterWindow);
+ const layers = useSyncExternalStore(subscribePrompterWindow, getPipLayers);
+ const prompterOn = Boolean(win && layers.prompter);
+ const cameraOn = Boolean(win && layers.camera);
+ const controlsOn = Boolean(win && layers.controls);
+ const [cameraHost, setCameraHost] = useState(null);
+ const [micLevel, setMicLevel] = useState(0);
+
+ const [settings, setSettings] = useState(null);
+ const [playing, setPlaying] = useState(false);
+ const [rewindToken, setRewindToken] = useState(0);
+ const [host, setHost] = useState(null);
+ const [confirmKind, setConfirmKind] = useState(null);
+ const pausedForConfirmRef = useRef(false);
+ const confirmKindRef = useRef(null);
+ confirmKindRef.current = confirmKind;
+
+ const settingsRef = useRef(null);
+ const saveTimerRef = useRef(null);
+ const contentStateRef = useRef(contentState);
+ contentStateRef.current = contentState;
+
+ const flushSave = useCallback(() => {
+ if (saveTimerRef.current) {
+ clearTimeout(saveTimerRef.current);
+ saveTimerRef.current = null;
+ if (settingsRef.current) savePrompterSettings(settingsRef.current);
+ }
+ }, []);
+
+ const onSettings = useCallback((patch) => {
+ const next = normalizeSettings({ ...settingsRef.current, ...patch });
+ settingsRef.current = next;
+ setSettings(next);
+ if (saveTimerRef.current) clearTimeout(saveTimerRef.current);
+ saveTimerRef.current = setTimeout(() => {
+ saveTimerRef.current = null;
+ savePrompterSettings(next);
+ }, SAVE_DELAY_MS);
+ }, []);
+
+ // Close with the page, and on extension reload, disable or update: the
+ // orphaned script's window would be a zombie the popup can no longer close.
+ useEffect(() => {
+ if (!win) return undefined;
+ const close = () => closePrompterWindow("opener page left");
+ window.addEventListener("pagehide", close);
+ const alive = () => {
+ try {
+ return Boolean(chrome.runtime?.id);
+ } catch {
+ return false;
+ }
+ };
+ const watchdog = setInterval(() => {
+ if (!alive()) close();
+ }, 2000);
+ return () => {
+ window.removeEventListener("pagehide", close);
+ clearInterval(watchdog);
+ };
+ }, [win]);
+
+ // Navigating away can tear the page down before the debounced write runs.
+ useEffect(() => {
+ window.addEventListener("pagehide", flushSave);
+ return () => window.removeEventListener("pagehide", flushSave);
+ }, [flushSave]);
+
+ // Read settings on each open and write on close (camera placement included)
+ // so a script typed just before closing is not lost.
+ const windowOpen = Boolean(win);
+ useEffect(() => {
+ if (!windowOpen) return undefined;
+ let cancelled = false;
+ loadPrompterSettings().then((loaded) => {
+ if (cancelled) return;
+ settingsRef.current = loaded;
+ setSettings(loaded);
+ });
+ return () => {
+ cancelled = true;
+ flushSave();
+ settingsRef.current = null;
+ setSettings(null);
+ setPlaying(false);
+ // The window closed under an open restart/discard prompt: nothing is left
+ // to answer it, so undo the pause it caused.
+ if (confirmKindRef.current) {
+ setConfirmKind(null);
+ const now = contentStateRef.current;
+ if (pausedForConfirmRef.current && now.recording && now.paused) {
+ now.resumeRecording();
+ }
+ }
+ };
+ }, [windowOpen, flushSave]);
+
+ const hasSettings = settings !== null;
+ const needsUi = Boolean(win) && (cameraOn || controlsOn || hasSettings);
+ useEffect(() => {
+ if (!win || !needsUi) {
+ setHost(null);
+ return undefined;
+ }
+ const el = win.document.createElement("div");
+ Object.assign(el.style, { position: "absolute", inset: "0", zIndex: "1" });
+ win.document.body.appendChild(el);
+ setHost(el);
+ return () => {
+ el.remove();
+ setHost(null);
+ };
+ }, [win, needsUi]);
+
+ useEffect(() => {
+ if (!win || !cameraOn) {
+ setCameraHost(null);
+ return undefined;
+ }
+ const el = win.document.createElement("div");
+ Object.assign(el.style, { position: "absolute", inset: "0", zIndex: "0" });
+ win.document.body.appendChild(el);
+ setCameraHost(el);
+ return () => {
+ el.remove();
+ setCameraHost(null);
+ };
+ }, [win, cameraOn]);
+
+ const cameraOnRef = useRef(false);
+ useEffect(() => {
+ const was = cameraOnRef.current;
+ cameraOnRef.current = cameraOn;
+ if (cameraOn === was) return;
+ // A camera put here by hand is wanted here, whatever was chosen before.
+ if (cameraOn && getCameraManual()) {
+ if (settingsRef.current) onSettings({ showCamera: true });
+ else {
+ loadPrompterSettings().then((loaded) =>
+ savePrompterSettings({ ...loaded, showCamera: true })
+ );
+ }
+ }
+ }, [cameraOn, onSettings]);
+
+ // Hiding the camera in the window moves it to the page, bubble included, even
+ // where it is normally hidden during a recording.
+ const cameraShown = cameraOn && settings?.showCamera !== false;
+ useEffect(() => {
+ const onPage = cameraOn && !cameraShown;
+ setContentState((prev) =>
+ prev.pipActive === cameraShown &&
+ prev.cameraOnPage === onPage &&
+ prev.cameraInWindow === cameraShown
+ ? prev
+ : {
+ ...prev,
+ pipActive: cameraShown,
+ cameraOnPage: onPage,
+ cameraInWindow: cameraShown,
+ }
+ );
+ }, [cameraOn, cameraShown, setContentState]);
+
+ // Once the capture is known, drop the camera from the window where the page's
+ // own picture in picture should carry it.
+ useEffect(() => {
+ const onRuntime = (message) => {
+ if (message?.type !== "set-surface") return;
+ const state = contentStateRef.current;
+ const plan = planCameraAtSurface({
+ cloud: CLOUD_FEATURES_ENABLED,
+ subscribed: Boolean(message.subscribed),
+ instantMode: Boolean(message.instantMode),
+ recordingType: message.recordingType || null,
+ surface: message.surface,
+ layers: getPipLayers(),
+ keepVisible: getPrompterKeepVisible(),
+ cameraEnabled:
+ Boolean(state.cameraActive) && state.defaultVideoInput !== "none",
+ windowOpen: Boolean(getPrompterWindow()),
+ });
+ // Pre-take, a camera-only window waits for the start gate, which warns first.
+ const waitsForGate = cameraCloseWaitsForGate({
+ cloud: CLOUD_FEATURES_ENABLED,
+ subscribed: Boolean(message.subscribed),
+ instantMode: Boolean(message.instantMode),
+ recordingType: message.recordingType || null,
+ surface: message.surface,
+ layers: getPipLayers(),
+ recording: Boolean(state.recording),
+ countdown: Boolean(state.countdownActive || state.isCountdownVisible),
+ });
+ if (plan === "close") {
+ if (!waitsForGate)
+ closePipLayer("camera", "capture records the window");
+ else
+ void startCameraCloseNotice({
+ ...state,
+ isSubscribed: Boolean(message.subscribed),
+ instantMode: Boolean(message.instantMode),
+ });
+ } else if (plan === "open") openPipLayer("camera", "surface picked");
+ // Switching to the whole monitor mid-take puts the window in the video.
+ if (
+ state.recording &&
+ getPrompterWindow() &&
+ !getPrompterKeepVisible() &&
+ shouldClosePrompter({
+ recordingType: message.recordingType || state.recordingType,
+ surface: message.surface,
+ recording: true,
+ })
+ ) {
+ if (getPipLayers().prompter) void notifyPrompterClosed(state);
+ closePipLayer("prompter", "capture records the window");
+ closePipLayer("controls", "capture records the window");
+ }
+ };
+ chrome.runtime.onMessage.addListener(onRuntime);
+ return () => chrome.runtime.onMessage.removeListener(onRuntime);
+ }, []);
+
+ // Turning the camera off leaves a black window, so the camera leaves it.
+ useEffect(() => {
+ if (cameraOn && contentState.cameraActive === false) {
+ closePipLayer("camera", "camera turned off");
+ }
+ }, [cameraOn, contentState.cameraActive]);
+
+ // Close the camera if no start begins within 90s of opening it.
+ useEffect(() => {
+ if (!cameraOn || getCameraManual()) return undefined;
+ const id = setTimeout(() => {
+ const s = contentStateRef.current;
+ if (!s.pendingRecording && !s.preparingRecording && !s.recording) {
+ closePipLayer("camera", "start never began");
+ }
+ }, 90000);
+ return () => clearTimeout(id);
+ }, [cameraOn]);
+
+ // Flags all dip clear briefly between restart steps, so require a 1.5s lull
+ // before treating a start as ended and dropping the camera.
+ const sawStartRef = useRef(false);
+ const startBusy = Boolean(
+ contentState.pendingRecording ||
+ contentState.recording ||
+ contentState.preparingRecording ||
+ contentState.restartingRecording ||
+ contentState.countdownActive
+ );
+ useEffect(() => {
+ if (startBusy) {
+ sawStartRef.current = true;
+ return undefined;
+ }
+ if (!sawStartRef.current) return undefined;
+ const id = setTimeout(() => {
+ const s = contentStateRef.current;
+ if (
+ s.pendingRecording ||
+ s.recording ||
+ s.preparingRecording ||
+ s.restartingRecording ||
+ s.countdownActive
+ ) {
+ return;
+ }
+ sawStartRef.current = false;
+ if (!getCameraManual()) closePipLayer("camera", "start ended");
+ }, 1500);
+ return () => clearTimeout(id);
+ }, [startBusy]);
+
+ // Mic level comes from a hidden page inside the window; only run it while the mic is on.
+ const meterOn =
+ Boolean(win) &&
+ Boolean(contentState.micActive) &&
+ Boolean(contentState.microphonePermission) &&
+ contentState.defaultAudioInput !== "none";
+ useEffect(() => {
+ if (!meterOn || !win) {
+ setMicLevel(0);
+ return undefined;
+ }
+ let last = 0;
+ const onMessage = (e) => {
+ if (e.data?.type !== "screenity-mic-level") return;
+ const level = Number(e.data.level) || 0;
+ if (Math.abs(level - last) < 0.04) return;
+ last = level;
+ setMicLevel(level);
+ };
+ win.addEventListener("message", onMessage);
+ return () => {
+ win.removeEventListener("message", onMessage);
+ setMicLevel(0);
+ };
+ }, [meterOn, win]);
+
+ // Scrolling follows the take; a window opened mid-recording does not start itself.
+ const prevRecordingRef = useRef({
+ recording: contentState.recording,
+ paused: contentState.paused,
+ });
+ useEffect(() => {
+ const prev = prevRecordingRef.current;
+ const now = {
+ recording: Boolean(contentState.recording),
+ paused: Boolean(contentState.paused),
+ };
+ prevRecordingRef.current = now;
+ if (!win) return;
+
+ const wantsAutoScroll =
+ settingsRef.current?.autoScroll !== false &&
+ Boolean(settingsRef.current?.script?.trim());
+
+ if (
+ now.recording &&
+ !prev.recording &&
+ getPipLayers().camera &&
+ cameraCanLiveInWindow({
+ cloud: CLOUD_FEATURES_ENABLED,
+ subscribed: contentState.isSubscribed,
+ instantMode: contentState.instantMode,
+ }) &&
+ captureRecordsWindow({
+ recordingType: contentState.recordingType,
+ surface: contentState.surface,
+ })
+ ) {
+ closePipLayer("camera", "capture records the window");
+ }
+
+ if (now.recording && !prev.recording) {
+ if (
+ !getPrompterKeepVisible() &&
+ shouldClosePrompter({
+ recordingType: contentState.recordingType,
+ surface: contentState.surface,
+ recording: true,
+ })
+ ) {
+ if (getPipLayers().prompter) {
+ void notifyPrompterClosed(contentStateRef.current);
+ }
+ closePipLayer("prompter", "capture records the window");
+ closePipLayer("controls", "capture records the window");
+ return;
+ }
+ setRewindToken((n) => n + 1);
+ setPlaying(wantsAutoScroll && !now.paused);
+ } else if (!now.recording && prev.recording) {
+ setPlaying(false);
+ // A finished, cancelled or discarded take ends the session. A restart
+ // also passes through "not recording" and carries on.
+ if (!contentStateRef.current.restartingRecording) {
+ closePrompterWindow("take ended");
+ }
+ } else if (now.recording && now.paused && !prev.paused) {
+ setPlaying(false);
+ } else if (now.recording && !now.paused && prev.paused) {
+ setPlaying(wantsAutoScroll);
+ }
+ }, [
+ contentState.recording,
+ contentState.paused,
+ contentState.recordingType,
+ contentState.surface,
+ win,
+ ]);
+
+ const t = (key, fallback) => chrome.i18n.getMessage(key) || fallback;
+
+ useEffect(() => {
+ if (!contentState.recording) setConfirmKind(null);
+ }, [contentState.recording]);
+
+ // Restart and discard normally ask in a modal on the page, which is behind
+ // the window being recorded. Ask here instead, pausing like the modal does.
+ const askConfirm = (kind) => {
+ pausedForConfirmRef.current = !contentState.paused;
+ if (!contentState.paused) contentState.pauseRecording(kind === "discard");
+ setConfirmKind(kind);
+ };
+ const cancelConfirm = () => {
+ if (pausedForConfirmRef.current) contentState.resumeRecording();
+ setConfirmKind(null);
+ };
+ const confirm = confirmKind
+ ? {
+ title:
+ confirmKind === "restart"
+ ? t("restartModalTitle", "Restart recording?")
+ : t("discardModalTitle", "Discard recording?"),
+ confirmLabel:
+ confirmKind === "restart"
+ ? t("restartModalRestart", "Restart")
+ : t("discardModalDiscard", "Discard"),
+ cancelLabel:
+ confirmKind === "restart"
+ ? t("restartModalResume", "Resume")
+ : t("discardModalResume", "Resume"),
+ onCancel: cancelConfirm,
+ onConfirm: () => {
+ setConfirmKind(null);
+ if (confirmKind === "restart") contentState.restartRecording();
+ else contentState.dismissRecording("user-discard-confirmed");
+ },
+ }
+ : null;
+
+ const micAvailable =
+ Boolean(contentState.microphonePermission) &&
+ contentState.defaultAudioInput !== "none";
+ const onMic = () => {
+ const pressed = !contentState.micActive;
+ setContentState((prev) => ({ ...prev, micActive: pressed }));
+ chrome.storage.local.set({ micActive: pressed });
+ chrome.runtime.sendMessage({
+ type: "set-mic-active-tab",
+ active: pressed,
+ defaultAudioInput: contentState.defaultAudioInput,
+ });
+ contentState.openToast?.(
+ chrome.i18n.getMessage(pressed ? "micOnToast" : "micOffToast"),
+ () => {}
+ );
+ };
+
+ // Same actions as the on-page toolbar, Record included (via beginRecording).
+ // Shown before the take with take-only buttons held back, so the bar does not
+ // appear all at once when the countdown ends.
+ const controls = {
+ inactive: !contentState.recording,
+ // Region capture needs the current tab, which Chrome resolves to the
+ // window clicked in, so it can only start from the page.
+ recordLabel:
+ contentState.recordingType === "region"
+ ? t(
+ "teleprompterRegionStartOnPage",
+ "Region recording must be started from the page"
+ )
+ : t("recordButtonLabel", "Start recording"),
+ recordDisabled: Boolean(
+ contentState.recordingType === "region" ||
+ contentState.pendingRecording ||
+ contentState.preparingRecording ||
+ contentState.restartingRecording ||
+ contentState.countdownActive ||
+ contentState.startGateOpen ||
+ contentState.finalizingRecording ||
+ (contentState.recordingType === "camera" &&
+ (!contentState.cameraPermission || !contentState.cameraActive))
+ ),
+ onRecord: () => beginRecording(contentStateRef.current, "floating-window"),
+ paused: Boolean(contentState.paused),
+ busy: Boolean(contentState.finalizingRecording),
+ micOn: Boolean(contentState.micActive),
+ micLevel,
+ micAvailable,
+ micLabel: micAvailable
+ ? t(
+ contentState.micActive
+ ? "disableMicrophoneTooltip"
+ : "enableMicrophoneTooltip",
+ "Microphone"
+ )
+ : t("noMicrophonePermissionsTooltip", "Microphone"),
+ pauseLabel: t("pauseRecordingTooltip", "Pause"),
+ resumeLabel: t("resumeRecordingTooltip", "Resume"),
+ stopLabel: t("finishRecordingTooltip", "Finish recording"),
+ restartLabel: t("restartRecordingTooltip", "Restart"),
+ discardLabel: t("cancelRecordingTooltip", "Discard"),
+ onMic,
+ onPause: () => contentState.pauseRecording(),
+ onResume: () => contentState.resumeRecording(),
+ onStop: () => contentState.stopRecording(),
+ onRestart: () => askConfirm("restart"),
+ onDiscard: () => {
+ if (contentState.askDismiss) askConfirm("discard");
+ else contentState.dismissRecording("user-discard");
+ },
+ confirm,
+ };
+
+ if (!host) return null;
+ const showScript = prompterOn && Boolean(settings);
+ if (!showScript && !cameraOn && !controlsOn) return null;
+ const takeActive = Boolean(contentState.recording);
+ const cameraIsOwnTrack = cameraCanLiveInWindow({
+ cloud: CLOUD_FEATURES_ENABLED,
+ subscribed: Boolean(contentState.isSubscribed),
+ instantMode: Boolean(contentState.instantMode),
+ });
+ // Bringing the script back would put it in the video, or next to a camera
+ // that is burnt in.
+ const canShowScript =
+ !(takeActive && captureRecordsWindow(contentState)) &&
+ !(!cameraIsOwnTrack && cameraOn);
+ return (
+ <>
+ {meterOn &&
+ host &&
+ createPortal(
+ <iframe
+ title="Microphone level"
+ src={chrome.runtime.getURL("camera.html?meter=1")}
+ allow="microphone"
+ style={{
+ position: "absolute",
+ width: 1,
+ height: 1,
+ opacity: 0,
+ border: "none",
+ pointerEvents: "none",
+ }}
+ />,
+ host
+ )}
+ {cameraHost &&
+ cameraShown &&
+ createPortal(
+ <iframe
+ title="Camera"
+ src={chrome.runtime.getURL("camera.html?pip=1")}
+ allow="camera; microphone"
+ style={{
+ position: "absolute",
+ inset: 0,
+ width: "100%",
+ height: "100%",
+ border: "none",
+ pointerEvents: "none",
+ transform: contentState.cameraFlipped ? "scaleX(-1)" : undefined,
+ }}
+ />,
+ cameraHost
+ )}
+ {createPortal(
+ <Teleprompter
+ settings={settings || DEFAULT_SETTINGS}
+ onSettings={onSettings}
+ showScript={showScript}
+ backdrop={cameraShown ? (showScript ? "scrim" : "none") : "solid"}
+ hasCamera={cameraOn}
+ quiet={takeActive && captureRecordsWindow(contentState)}
+ onShowScript={() => openPipLayer("prompter", "show script")}
+ canShowScript={canShowScript}
+ paused={takeActive && Boolean(contentState.paused)}
+ countdown={
+ contentState.countdownValue > 0 ? contentState.countdownValue : null
+ }
+ playing={playing}
+ canPlay={takeActive}
+ onPlayingChange={setPlaying}
+ rewindToken={rewindToken}
+ onRewind={() => {
+ setPlaying(false);
+ setRewindToken((n) => n + 1);
+ }}
+ onHide={() => {
+ openPipLayer("controls");
+ closePipLayer("prompter");
+ }}
+ timerLabel={takeActive ? formatClock(seconds) : null}
+ controls={controls}
+ />,
+ host
+ )}
+ </>
+ );
+};
+
+export default TeleprompterController;
diff --git a/src/pages/Content/teleprompter/TeleprompterRow.jsx b/src/pages/Content/teleprompter/TeleprompterRow.jsx
new file mode 100644
index 0000000..fd3c006
--- /dev/null
+++ b/src/pages/Content/teleprompter/TeleprompterRow.jsx
@@ -0,0 +1,106 @@
+import React, {
+ useContext,
+ useEffect,
+ useState,
+ useSyncExternalStore,
+} from "react";
+import * as S from "@radix-ui/react-switch";
+import { contentStateContext } from "../context/ContentState";
+import {
+ closePipLayer,
+ getPipLayers,
+ getPrompterWindow,
+ isPrompterWindowSupported,
+ openPrompterWindow,
+ subscribePrompterWindow,
+} from "./prompterWindow";
+
+const INTRO_KEY = "teleprompterIntroSeen";
+
+// Opens the window inside the click (Chrome requires it), so the row only
+// mirrors whether the script shows. The first time, an intro modal comes first
+// and its button opens the window, as a click of its own.
+const TeleprompterRow = () => {
+ const [contentState] = useContext(contentStateContext);
+ // Read on mount to keep the click synchronous; assume seen until loaded.
+ const [introSeen, setIntroSeen] = useState(true);
+ useEffect(() => {
+ chrome.storage.local
+ .get(INTRO_KEY)
+ .then((stored) => setIntroSeen(stored?.[INTRO_KEY] === true))
+ .catch(() => {});
+ }, []);
+
+ const layers = useSyncExternalStore(subscribePrompterWindow, getPipLayers);
+ const open =
+ Boolean(getPrompterWindow()) && (layers.prompter || layers.controls);
+ const supported = isPrompterWindowSupported();
+
+ const label = supported
+ ? chrome.i18n.getMessage("teleprompterLabel") || "Teleprompter"
+ : chrome.i18n.getMessage("teleprompterUnavailableLabel") ||
+ "Teleprompter (not available on this page)";
+
+ return (
+ <form>
+ <div
+ className="SwitchRow"
+ style={supported ? undefined : { opacity: 0.5 }}
+ >
+ <label
+ className="Label"
+ htmlFor="teleprompter-switch"
+ style={{ paddingRight: 15 }}
+ >
+ {label}
+ </label>
+ <S.Root
+ className="SwitchRoot"
+ id="teleprompter-switch"
+ checked={open}
+ disabled={!supported}
+ style={supported ? undefined : { opacity: 1 }}
+ onCheckedChange={(checked) => {
+ if (checked) {
+ if (introSeen || typeof contentState.openModal !== "function") {
+ openPrompterWindow();
+ return;
+ }
+ const gotIt = () => {
+ setIntroSeen(true);
+ chrome.storage.local.set({ [INTRO_KEY]: true }).catch(() => {});
+ openPrompterWindow();
+ };
+ contentState.openModal(
+ chrome.i18n.getMessage("teleprompterIntroTitle") ||
+ "How the teleprompter works",
+ chrome.i18n.getMessage("teleprompterIntroDescription") ||
+ "Your script opens in a floating window that stays out of the recording when you share a window or tab, record an area, or record just your camera. If you share your entire screen, the window would show in the video, so it closes when you start. Your script is always saved.",
+ chrome.i18n.getMessage("instantRecordingModeAction") ||
+ "Got it",
+ null,
+ gotIt,
+ null,
+ null,
+ null,
+ null,
+ true,
+ false,
+ () => {},
+ gotIt,
+ true
+ );
+ } else {
+ closePipLayer("prompter");
+ closePipLayer("controls");
+ }
+ }}
+ >
+ <S.Thumb className="SwitchThumb" />
+ </S.Root>
+ </div>
+ </form>
+ );
+};
+
+export default TeleprompterRow;
diff --git a/src/pages/Content/teleprompter/prompterGate.js b/src/pages/Content/teleprompter/prompterGate.js
new file mode 100644
index 0000000..52d4924
--- /dev/null
+++ b/src/pages/Content/teleprompter/prompterGate.js
@@ -0,0 +1,257 @@
+import { setContentState } from "../context/ContentState";
+import { cameraCanLiveInWindow, prompterCaptureStatus } from "./prompterRules";
+import {
+ closePipLayer,
+ getPipLayers,
+ getPrompterKeepVisible,
+ getPrompterWindow,
+ openPipLayer,
+ setPrompterKeepVisible,
+} from "./prompterWindow";
+
+const NO_PROMPT_KEY = "teleprompterFullScreenNoPrompt";
+
+// Burnt-in camera: once a full-screen capture closes the script, the camera takes the window.
+const giveWindowToCamera = (state) => {
+ const own = cameraCanLiveInWindow({
+ cloud: process.env.SCREENITY_ENABLE_CLOUD_FEATURES === "true",
+ subscribed: state.isSubscribed,
+ instantMode: state.instantMode,
+ });
+ if (own || state.recordingType !== "screen") return;
+ if (state.cameraActive && state.defaultVideoInput !== "none") {
+ openPipLayer("camera", "gate: full screen");
+ }
+};
+
+const msg = (key, fallback) => chrome.i18n.getMessage(key) || fallback;
+
+// The open prompt's escape hatch. A failed or cancelled start must settle it,
+// or the start that was waiting on it never ends.
+let abortOpenPrompt = null;
+export const ABORTED = "aborted";
+
+// Called when the attempt ends under an open prompt (stop-pending, recording-error).
+export const abortStartGate = (state) => {
+ cameraNotice = null;
+ const abort = abortOpenPrompt;
+ abortOpenPrompt = null;
+ if (!abort) return;
+ abort();
+ state?.closeModal?.();
+};
+
+const readGatePrefs = async () => {
+ let remembered = false;
+ try {
+ const stored = await chrome.storage.local.get(NO_PROMPT_KEY);
+ remembered = stored?.[NO_PROMPT_KEY] === true;
+ } catch {}
+ // No countdown: the recorder is already running, so there is no moment to ask.
+ let countdownOn = true;
+ try {
+ const stored = await chrome.storage.local.get("countdown");
+ countdownOn = Boolean(stored?.countdown);
+ } catch {}
+ return { remembered, countdownOn };
+};
+
+// Closed without asking (mid-take switch to full screen, unknown surface at
+// the start): toast unless they opted out.
+export const notifyPrompterClosed = async (state) => {
+ const { remembered } = await readGatePrefs();
+ if (remembered) return;
+ state.openToast?.(
+ msg(
+ "teleprompterClosedToast",
+ "Teleprompter closed to keep it out of your recording"
+ ),
+ () => {}
+ );
+};
+
+// Pro's own-track camera is in the window only while the capture leaves it out.
+// Full screen records it, so it closes, with a notice first.
+const closeOwnCameraLayer = async (state) => {
+ if (!getPipLayers().camera) return;
+ const own = cameraCanLiveInWindow({
+ cloud: process.env.SCREENITY_ENABLE_CLOUD_FEATURES === "true",
+ subscribed: state.isSubscribed,
+ instantMode: state.instantMode,
+ });
+ if (!own) return;
+ const { remembered, countdownOn } = await readGatePrefs();
+ if (remembered || typeof state.openModal !== "function") {
+ closePipLayer("camera", "gate: full screen");
+ return;
+ }
+ if (!countdownOn) {
+ closePipLayer("camera", "gate: no countdown");
+ state.openToast?.(
+ msg("cameraFullScreenTitle", "Camera window will close"),
+ () => {}
+ );
+ return;
+ }
+ setContentState((prev) => ({ ...prev, startGateOpen: true }));
+ const outcome = await new Promise((resolve) => {
+ let settled = false;
+ abortOpenPrompt = () => {
+ settled = true;
+ resolve(ABORTED);
+ };
+ const choose = (choice) => () => {
+ if (settled) return;
+ settled = true;
+ abortOpenPrompt = null;
+ if (choice === "never") {
+ chrome.storage.local.set({ [NO_PROMPT_KEY]: true }).catch(() => {});
+ }
+ closePipLayer("camera", "gate: closed");
+ resolve();
+ };
+ state.openModal(
+ msg("cameraFullScreenTitle", "Camera window will close"),
+ msg(
+ "cameraFullScreenDescription",
+ "You're recording your entire screen, so the camera window would appear in the video. We'll close it to keep it out of the recording. Your camera is still recorded."
+ ),
+ msg("teleprompterFullScreenClose", "OK, close it"),
+ null,
+ choose("close"),
+ null,
+ null,
+ null,
+ null,
+ true,
+ msg("teleprompterFullScreenNever", "Don't show again"),
+ choose("never"),
+ choose("close"),
+ true
+ );
+ });
+ if (outcome === ABORTED) return ABORTED;
+ setContentState((prev) => ({ ...prev, startGateOpen: false }));
+};
+
+// The surface is known as soon as the picker closes, before the recorder is
+// ready. The start gate joins this prompt instead of asking again.
+let cameraNotice = null;
+export const startCameraCloseNotice = (state) => {
+ if (!cameraNotice) {
+ const notice = closeOwnCameraLayer(state).finally(() => {
+ if (cameraNotice === notice) cameraNotice = null;
+ });
+ cameraNotice = notice;
+ }
+ return cameraNotice;
+};
+
+// The controls bar is in the video as much as the script is, and the take-start
+// close only runs once recording flips true.
+const closeScriptWindow = (reason) => {
+ closePipLayer("prompter", reason);
+ closePipLayer("controls", reason);
+};
+
+// Runs before a recording starts. A full-screen capture would record the open
+// teleprompter window, so the start waits for the user's choice. Every answer records.
+export const runPrompterStartGate = async (state) => {
+ if (!getPrompterWindow()) return;
+ // state.surface lags an auth round-trip; storage has it as soon as the recorder reports it.
+ let surface = state.surface;
+ if (!surface || surface === "default") {
+ try {
+ const stored = await chrome.storage.local.get("surface");
+ if (stored?.surface) surface = stored.surface;
+ } catch {}
+ }
+ if (surface && surface !== state.surface) {
+ setContentState((prev) => ({ ...prev, surface }));
+ }
+ const status = prompterCaptureStatus({
+ recordingType: state.recordingType,
+ surface,
+ });
+ if (status !== "unsafe") return;
+ // Asked once for this window: a restart does not ask again.
+ if (getPrompterKeepVisible()) return;
+ // Controls-only window needs no prompt, the toolbar is visible.
+ if (!getPipLayers().prompter) {
+ giveWindowToCamera(state);
+ closePipLayer("controls", "gate: full screen");
+ return startCameraCloseNotice(state);
+ }
+
+ // No countdown: close the script and toast instead of asking.
+ const { remembered, countdownOn } = await readGatePrefs();
+ if (!countdownOn && !remembered) {
+ giveWindowToCamera(state);
+ closeScriptWindow("gate: no countdown");
+ state.openToast?.(
+ msg("teleprompterFullScreenTitle", "Teleprompter will be closed"),
+ () => {}
+ );
+ return;
+ }
+ if (remembered || typeof state.openModal !== "function") {
+ giveWindowToCamera(state);
+ closeScriptWindow("gate: remembered");
+ return;
+ }
+
+ setContentState((prev) => ({ ...prev, startGateOpen: true }));
+ const outcome = await new Promise((resolve) => {
+ let settled = false;
+ abortOpenPrompt = () => {
+ settled = true;
+ resolve(ABORTED);
+ };
+ const choose = (choice) => () => {
+ if (settled) return;
+ settled = true;
+ abortOpenPrompt = null;
+ if (choice === "keep") {
+ setPrompterKeepVisible(true);
+ // Camera and script share the window only when the camera is its own track.
+ if (
+ !cameraCanLiveInWindow({
+ cloud: process.env.SCREENITY_ENABLE_CLOUD_FEATURES === "true",
+ subscribed: state.isSubscribed,
+ instantMode: state.instantMode,
+ })
+ ) {
+ closePipLayer("camera", "gate: script kept");
+ }
+ } else {
+ if (choice === "never") {
+ chrome.storage.local.set({ [NO_PROMPT_KEY]: true }).catch(() => {});
+ }
+ giveWindowToCamera(state);
+ closeScriptWindow("gate: closed");
+ }
+ resolve();
+ };
+ state.openModal(
+ msg("teleprompterFullScreenTitle", "Teleprompter will be closed"),
+ msg(
+ "teleprompterFullScreenDescription",
+ "You're recording your entire screen, so the teleprompter window would appear in the video. We'll close it to keep it out of the recording. You can keep it open, but it will be recorded."
+ ),
+ msg("teleprompterFullScreenClose", "OK, close it"),
+ msg("teleprompterFullScreenKeep", "Keep it visible"),
+ choose("close"),
+ choose("keep"),
+ null,
+ null,
+ null,
+ true,
+ msg("teleprompterFullScreenNever", "Don't show again"),
+ choose("never"),
+ choose("close"),
+ true
+ );
+ });
+ if (outcome === ABORTED) return ABORTED;
+ setContentState((prev) => ({ ...prev, startGateOpen: false }));
+};
diff --git a/src/pages/Content/teleprompter/prompterRules.js b/src/pages/Content/teleprompter/prompterRules.js
new file mode 100644
index 0000000..e5ce1b3
--- /dev/null
+++ b/src/pages/Content/teleprompter/prompterRules.js
@@ -0,0 +1,171 @@
+// Pure rules for the teleprompter: scroll speed, saved settings, and which
+// captures can safely show the floating script window.
+
+export const FONT_SIZE_MIN = 20;
+export const FONT_SIZE_MAX = 72;
+export const FONT_STEP = 4;
+export const WPM_MIN = 80;
+export const WPM_MAX = 240;
+export const WPM_STEP = 10;
+
+export const DEFAULT_SETTINGS = {
+ script: "",
+ fontSize: 28,
+ wpm: 120,
+ autoScroll: true,
+ showCamera: true,
+};
+
+const LINE_HEIGHT = 1.5;
+// Average word plus space in characters, and glyph width as a fraction of font
+// size. Rough on purpose: scroll speed only has to feel like the chosen pace.
+const CHARS_PER_WORD = 6;
+const GLYPH_WIDTH = 0.5;
+
+export const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
+
+// px/s that scroll `wpm` words a minute in a `width` px block at `fontSize` px.
+export const wpmToPxPerSecond = (wpm, fontSize, width) => {
+ const safeWidth = Math.max(1, width || 0);
+ const charsPerLine = Math.max(1, safeWidth / (fontSize * GLYPH_WIDTH));
+ const wordsPerLine = Math.max(1, charsPerLine / CHARS_PER_WORD);
+ const linesPerSecond = wpm / 60 / wordsPerLine;
+ return linesPerSecond * fontSize * LINE_HEIGHT;
+};
+
+// Storage may hold missing, partial, older-build or hand-edited values; this
+// always returns a complete, in-range object.
+export const normalizeSettings = (raw) => {
+ const saved = raw && typeof raw === "object" ? raw : {};
+ return {
+ script: typeof saved.script === "string" ? saved.script : "",
+ fontSize: clamp(
+ Number(saved.fontSize) || DEFAULT_SETTINGS.fontSize,
+ FONT_SIZE_MIN,
+ FONT_SIZE_MAX
+ ),
+ wpm: clamp(Number(saved.wpm) || DEFAULT_SETTINGS.wpm, WPM_MIN, WPM_MAX),
+ autoScroll: saved.autoScroll !== false,
+ showCamera: saved.showCamera !== false,
+ };
+};
+
+// Whether the floating window can end up in the recording.
+// - "ok": tab, region and camera captures never include another window, and a
+// shared window or browser tab excludes it.
+// - "pending": screen recording, surface not picked yet.
+// - "unsafe": whole monitor (includes every window), or an unidentified surface.
+// `surface` is displaySurface from the recorder ("default" until it reports).
+export const prompterCaptureStatus = ({ recordingType, surface }) => {
+ if (recordingType && recordingType !== "screen") return "ok";
+ if (surface === "window" || surface === "browser") return "ok";
+ if (surface === "monitor") return "unsafe";
+ return "pending";
+};
+
+export const shouldClosePrompter = ({ recordingType, surface, recording }) => {
+ const status = prompterCaptureStatus({ recordingType, surface });
+ if (status === "unsafe") return true;
+ return status === "pending" && Boolean(recording);
+};
+
+export const formatClock = (seconds) => {
+ const total = Math.max(0, Math.floor(Number(seconds) || 0));
+ const h = Math.floor(total / 3600);
+ const m = Math.floor((total % 3600) / 60);
+ const s = total % 60;
+ const pad = (n) => String(n).padStart(2, "0");
+ return h > 0 ? `${pad(h)}:${pad(m)}:${pad(s)}` : `${pad(m)}:${pad(s)}`;
+};
+
+// An own-track camera (cloud, subscribed, not instant) can live in the window
+// for window or tab captures, which leave it out of the video. Otherwise the
+// camera is burnt in and only goes in the window for full-screen, the one
+// capture that records the window.
+export const cameraCanLiveInWindow = ({ cloud, subscribed, instantMode }) =>
+ Boolean(cloud && subscribed && !instantMode);
+
+const CROPPED_TYPES = ["region", "tab", "camera"];
+
+export const wantsCameraLayerAtStart = ({
+ cloud,
+ subscribed,
+ instantMode,
+ recordingType,
+ cameraOn,
+ windowOpen,
+}) => {
+ if (!cameraOn) return false;
+ const own = cameraCanLiveInWindow({ cloud, subscribed, instantMode });
+ // Camera beside the script only works for an own-track camera. Otherwise an
+ // already-open window gets the camera only once full-screen is picked.
+ if (!own && windowOpen) return false;
+ if (recordingType === "screen") return true;
+ return (recordingType === "region" || recordingType === "tab") && own;
+};
+
+// Whether the capture records the floating window along with the screen. A
+// region or tab capture still reports displaySurface "monitor", so the
+// recording type leads.
+export const captureRecordsWindow = ({ recordingType, surface }) =>
+ surface === "monitor" && !CROPPED_TYPES.includes(recordingType);
+
+export const keepsCameraLayer = ({
+ cloud,
+ subscribed,
+ instantMode,
+ recordingType,
+ surface,
+}) => {
+ if (recordingType === "camera") return false;
+ const recorded = captureRecordsWindow({ recordingType, surface });
+ return cameraCanLiveInWindow({ cloud, subscribed, instantMode })
+ ? !recorded
+ : recorded;
+};
+
+// Camera layer action once the capture is known: "open", "close", or "keep" (leave as is).
+export const planCameraAtSurface = ({
+ cloud,
+ subscribed,
+ instantMode,
+ recordingType,
+ surface,
+ layers,
+ keepVisible,
+ cameraEnabled,
+ windowOpen,
+}) => {
+ const keeps = keepsCameraLayer({
+ cloud,
+ subscribed,
+ instantMode,
+ recordingType,
+ surface,
+ });
+ if (layers.camera) return keeps ? "keep" : "close";
+ if (!keeps || !cameraEnabled || !windowOpen) return "keep";
+ const own = cameraCanLiveInWindow({ cloud, subscribed, instantMode });
+ // A script kept over a full-screen capture does not share the window with a burnt-in camera.
+ if (!own && layers.prompter && keepVisible) return "keep";
+ return "open";
+};
+
+// Pre-take, a camera-only window the capture will record closes at the start
+// gate (which warns first), not at surface pick. Mid-take and during the
+// countdown it closes at once.
+export const cameraCloseWaitsForGate = ({
+ cloud,
+ subscribed,
+ instantMode,
+ recordingType,
+ surface,
+ layers,
+ recording,
+ countdown,
+}) =>
+ !recording &&
+ !countdown &&
+ !layers.prompter &&
+ cameraCanLiveInWindow({ cloud, subscribed, instantMode }) &&
+ captureRecordsWindow({ recordingType, surface });
diff --git a/src/pages/Content/teleprompter/prompterSettings.js b/src/pages/Content/teleprompter/prompterSettings.js
new file mode 100644
index 0000000..0d528b2
--- /dev/null
+++ b/src/pages/Content/teleprompter/prompterSettings.js
@@ -0,0 +1,20 @@
+import { DEFAULT_SETTINGS, normalizeSettings } from "./prompterRules";
+
+const STORAGE_KEY = "teleprompter";
+
+export const loadPrompterSettings = async () => {
+ try {
+ const result = await chrome.storage.local.get(STORAGE_KEY);
+ return normalizeSettings(result?.[STORAGE_KEY]);
+ } catch {
+ return { ...DEFAULT_SETTINGS };
+ }
+};
+
+export const savePrompterSettings = async (settings) => {
+ try {
+ await chrome.storage.local.set({
+ [STORAGE_KEY]: normalizeSettings(settings),
+ });
+ } catch {}
+};
diff --git a/src/pages/Content/teleprompter/prompterWindow.js b/src/pages/Content/teleprompter/prompterWindow.js
new file mode 100644
index 0000000..26b4dc7
--- /dev/null
+++ b/src/pages/Content/teleprompter/prompterWindow.js
@@ -0,0 +1,150 @@
+// Floating Document Picture-in-Picture window for the script and camera; window
+// and tab captures leave it out of the recording. Chrome only opens one from a
+// user gesture, so openPipLayer() must run synchronously inside the click.
+
+export const PROMPTER_WINDOW_SIZE = { width: 420, height: 380 };
+
+let pipWindow = null;
+// The window stays open while any layer is on.
+const NO_LAYERS = { prompter: false, camera: false, controls: false };
+let layers = NO_LAYERS;
+// Set when the user chose to keep the window up over a capture that records it.
+let keepVisible = false;
+const listeners = new Set();
+
+const trace = (what, layer, reason) => {
+ if (process.env.NODE_ENV === "production") return;
+ console.debug("[Screenity][pip]", what, layer || "", reason || "");
+};
+const emit = () => listeners.forEach((fn) => fn());
+
+export const isPrompterWindowSupported = () => {
+ try {
+ return typeof window.documentPictureInPicture?.requestWindow === "function";
+ } catch {
+ return false;
+ }
+};
+
+export const getPipLayers = () => layers;
+
+// Camera put in the window by hand stays until closed or the take ends, rather
+// than waiting for a recording to start.
+let cameraManual = false;
+export const setCameraManual = (value) => {
+ cameraManual = Boolean(value);
+};
+export const getCameraManual = () => cameraManual;
+
+export const subscribePrompterWindow = (fn) => {
+ listeners.add(fn);
+ return () => listeners.delete(fn);
+};
+
+export const setPrompterKeepVisible = (value) => {
+ keepVisible = Boolean(value);
+};
+
+export const getPrompterKeepVisible = () => keepVisible;
+
+export const getPrompterWindow = () =>
+ pipWindow && !pipWindow.closed ? pipWindow : null;
+
+const setLayers = (patch) => {
+ layers = { ...layers, ...patch };
+ emit();
+};
+
+// Must run synchronously inside a click when no window is open yet. Adding a
+// layer to a window that is already open needs no gesture.
+let opening = null;
+
+export const openPipLayer = async (layer, reason) => {
+ trace("open", layer, reason);
+ const existing = getPrompterWindow();
+ if (existing) {
+ setLayers({ [layer]: true });
+ if (layer === "prompter") {
+ try {
+ existing.focus();
+ } catch {}
+ }
+ return true;
+ }
+ if (!isPrompterWindowSupported()) return false;
+ if (opening) {
+ await opening.catch(() => {});
+ return openPipLayer(layer, reason);
+ }
+
+ let win;
+ try {
+ opening = window.documentPictureInPicture.requestWindow({
+ ...PROMPTER_WINDOW_SIZE,
+ disallowReturnToOpener: true,
+ });
+ win = await opening;
+ } catch {
+ return false;
+ } finally {
+ opening = null;
+ }
+
+ try {
+ const doc = win.document;
+ doc.title = "Screenity";
+ doc.documentElement.lang = chrome.i18n.getUILanguage();
+ doc.documentElement.style.height = "100%";
+ Object.assign(doc.body.style, {
+ margin: "0",
+ height: "100%",
+ overflow: "hidden",
+ background: "#1b1b1f",
+ });
+ } catch {}
+
+ // A window closed by hand or by the browser (navigation, another PiP
+ // opening) never passes through closePrompterWindow().
+ win.addEventListener("pagehide", () => {
+ if (pipWindow === win) {
+ trace("window gone", "", "pagehide");
+ pipWindow = null;
+ cameraManual = false;
+ layers = NO_LAYERS;
+ emit();
+ }
+ });
+ pipWindow = win;
+ keepVisible = false;
+ layers = { ...NO_LAYERS, [layer]: true };
+ emit();
+ return true;
+};
+
+export const closePipLayer = (layer, reason) => {
+ if (!layers[layer]) return;
+ trace("close", layer, reason);
+ if (layer === "camera") cameraManual = false;
+ const next = { ...layers, [layer]: false };
+ if (!next.prompter && !next.camera && !next.controls) {
+ closePrompterWindow();
+ return;
+ }
+ if (layer === "prompter") keepVisible = false;
+ setLayers({ [layer]: false });
+};
+
+export const openPrompterWindow = () => openPipLayer("prompter");
+
+export const closePrompterWindow = (reason) => {
+ trace("close window", "", reason);
+ const win = pipWindow;
+ pipWindow = null;
+ keepVisible = false;
+ cameraManual = false;
+ layers = NO_LAYERS;
+ try {
+ if (win && !win.closed) win.close();
+ } catch {}
+ emit();
+};
diff --git a/src/pages/Content/toolbar/components/MicToggle.jsx b/src/pages/Content/toolbar/components/MicToggle.jsx
index 660d032..622e8eb 100644
--- a/src/pages/Content/toolbar/components/MicToggle.jsx
+++ b/src/pages/Content/toolbar/components/MicToggle.jsx
@@ -14,10 +14,11 @@ const MicToggle = (props) => {
return (
<TooltipWrap
+ shortcut={contentState.toggleMicShortcut}
content={
contentState.microphonePermission && contentState.micActive
? chrome.i18n.getMessage("disableMicrophoneTooltip")
- : contentState.microphonePermission && !contentState.micactive
+ : contentState.microphonePermission && !contentState.micActive
? chrome.i18n.getMessage("enableMicrophoneTooltip")
: chrome.i18n.getMessage("noMicrophonePermissionsTooltip")
}
diff --git a/src/pages/Content/toolbar/components/TooltipWrap.jsx b/src/pages/Content/toolbar/components/TooltipWrap.jsx
index 5b3e27a..1c39d71 100644
--- a/src/pages/Content/toolbar/components/TooltipWrap.jsx
+++ b/src/pages/Content/toolbar/components/TooltipWrap.jsx
@@ -68,6 +68,7 @@ const TooltipWrap = (props) => {
}
>
<Tooltip.Content
+ sideOffset={props.sideOffset ?? 8}
onPointerEnter={cancelOpenTimer}
onPointerLeave={() => setOpen(false)}
className={
diff --git a/src/pages/Content/toolbar/styles/components/_Tooltip.scss b/src/pages/Content/toolbar/styles/components/_Tooltip.scss
index 2a8e1e2..9801f88 100644
--- a/src/pages/Content/toolbar/styles/components/_Tooltip.scss
+++ b/src/pages/Content/toolbar/styles/components/_Tooltip.scss
@@ -3,7 +3,7 @@
.TooltipContent {
border-radius: $container-border-radius;
background-color: $color-text-primary;
- padding: 10px 15px;
+ padding: 8px 13px;
font-size: 12px;
margin-bottom: 10px;
bottom: 100px;
diff --git a/src/pages/Content/utils/beginRecording.js b/src/pages/Content/utils/beginRecording.js
new file mode 100644
index 0000000..6d6806e
--- /dev/null
+++ b/src/pages/Content/utils/beginRecording.js
@@ -0,0 +1,82 @@
+import { wantsCameraLayerAtStart } from "../teleprompter/prompterRules";
+import { getPipLayers, openPipLayer } from "../teleprompter/prompterWindow";
+
+// Single start path for the popup button and the floating window's button.
+// Start goes before opening the camera window: the permission request needs the
+// click's activation, and opening the window spends it.
+const beginStreaming = (state, source) => {
+ if (process.env.NODE_ENV !== "production") {
+ console.debug(
+ "[Screenity][pip] start",
+ JSON.stringify({
+ sub: state.isSubscribed,
+ instant: state.instantMode,
+ type: state.recordingType,
+ cam: state.cameraActive,
+ vin: state.defaultVideoInput,
+ })
+ );
+ }
+ // A click in the floating window gives this page no activation, so a first-time
+ // permission request would be rejected. Read it here, in the click's own turn.
+ const noPageGesture =
+ source === "floating-window" &&
+ navigator.userActivation?.isActive === false;
+ const started = state.startStreaming({ noPageGesture });
+ if (
+ wantsCameraLayerAtStart({
+ cloud: process.env.SCREENITY_ENABLE_CLOUD_FEATURES === "true",
+ subscribed: state.isSubscribed,
+ instantMode: state.instantMode,
+ recordingType: state.recordingType,
+ cameraOn: state.cameraActive && state.defaultVideoInput !== "none",
+ windowOpen: Object.values(getPipLayers()).some(Boolean),
+ })
+ ) {
+ openPipLayer("camera", "start");
+ }
+ return started;
+};
+
+// A new recording destroys one still unsaved in an editor tab, so confirm first.
+export const beginRecording = async (state, source) => {
+ let unsaved = null;
+ try {
+ unsaved = await chrome.runtime.sendMessage({
+ type: "unsaved-retained-recording",
+ });
+ } catch {}
+ if (unsaved?.hasUnsaved && typeof state.openModal === "function") {
+ state.openModal(
+ chrome.i18n.getMessage("unsavedRecordingModalTitle"),
+ chrome.i18n.getMessage("unsavedRecordingModalDescription"),
+ chrome.i18n.getMessage("unsavedRecordingModalAction"),
+ chrome.i18n.getMessage("unsavedRecordingModalCancel"),
+ () => {
+ beginStreaming(state, source);
+ },
+ () => {
+ chrome.runtime
+ .sendMessage({
+ type: "focus-retained-recording",
+ tabId: unsaved.tabId,
+ })
+ .catch(() => {});
+ },
+ null,
+ null,
+ null,
+ false,
+ chrome.i18n.getMessage("unsavedRecordingModalDismiss"),
+ () => {
+ // Dismiss the prompt for good and still start, so this button is not a dead end.
+ chrome.storage.local
+ .set({ unsavedRecordingPromptDismissed: Date.now() })
+ .catch(() => {});
+ beginStreaming(state, source);
+ }
+ );
+ return;
+ }
+ beginStreaming(state, source);
+};
diff --git a/src/pages/OffscreenRecorder/index.jsx b/src/pages/OffscreenRecorder/index.jsx
index 9b0b19f..5e0689c 100644
--- a/src/pages/OffscreenRecorder/index.jsx
+++ b/src/pages/OffscreenRecorder/index.jsx
@@ -35,6 +35,23 @@ const swKeepaliveTimer = setInterval(() => {
}, SW_KEEPALIVE_MS);
window.addEventListener("pagehide", () => clearInterval(swKeepaliveTimer));
+// Lets the SW tell a close it issued from this document vanishing on its own.
+let hostPortStopped = false;
+window.addEventListener("pagehide", () => {
+ hostPortStopped = true;
+});
+const connectHostPort = () => {
+ if (hostPortStopped) return;
+ try {
+ const port = chrome.runtime.connect({ name: "recorder-host" });
+ port.onDisconnect.addListener(() => {
+ void chrome.runtime.lastError;
+ setTimeout(connectHostPort, 2000);
+ });
+ } catch {}
+};
+connectHostPort();
+
const IS_RESUME_DOC =
new URLSearchParams(window.location.search).get("resume") === "1";
diff --git a/src/pages/OffscreenRecorder/resumeJournal.js b/src/pages/OffscreenRecorder/resumeJournal.js
index 821d105..d801d2a 100644
--- a/src/pages/OffscreenRecorder/resumeJournal.js
+++ b/src/pages/OffscreenRecorder/resumeJournal.js
@@ -427,7 +427,7 @@ export const resumeOneJournal = async (journal, { latestSessionId = null } = {})
// bytes reached, so the whole file goes up as new media in the same scene.
uploader = makeUploader(trackType);
try {
- await uploader.initialize(projectId, initOpts);
+ await uploader.initialize(projectId, { ...initOpts, fresh: true });
} catch (freshErr) {
return fail("initialize-fresh", freshErr);
}
@@ -499,6 +499,9 @@ export const resumeOneJournal = async (journal, { latestSessionId = null } = {})
return fail("finalize", err);
}
+ // The fresh media carries its own journal. Leaving the replaced one behind
+ // lets the next pass resume it again and upload the same take as more media.
+ if (freshMedia) await removeJournal(mediaId);
await clearAttempts(mediaId);
emit("upload_resume_completed", {
...ctx,
diff --git a/src/pages/Recorder/Recorder.jsx b/src/pages/Recorder/Recorder.jsx
index 16af6bf..9d1cfea 100644
--- a/src/pages/Recorder/Recorder.jsx
+++ b/src/pages/Recorder/Recorder.jsx
@@ -26,6 +26,8 @@ import {
computeTargetVideoBps,
getFreeCaptureCaps,
orientBoxToSource,
+ resolveQualityValue,
+ resolveFps,
} from "./recorderConfig";
import {
WebCodecsRecorder,
@@ -44,6 +46,7 @@ import { attachAudioContextWatchdog } from "../utils/audioContextWatchdog";
import { beginFinalizeHeartbeat } from "../utils/finalizeHeartbeat";
import { IS_OFFSCREEN_HOST } from "../utils/recordingHost";
import { sendSystemAudioGuidanceToast } from "../utils/systemAudioGuidance";
+import { createSourceProbe, snapshotProbes } from "./audioSourceProbe";
import {
isCaptureAudioSourceError,
shouldRequestCaptureAudio,
@@ -73,7 +76,12 @@ import {
validateFastRecorderOutputBlob,
isTransientFastRecorderError,
isFastRecorderFailureTransient,
+ RESOLUTION_UNSUPPORTED_CODE,
} from "../../media/fastRecorderGate";
+import {
+ avcCodecForSize,
+ largeFrameKnownUnsupported,
+} from "../../media/avcLevel";
localforage.config({
driver: localforage.INDEXEDDB,
@@ -156,16 +164,6 @@ function logRecordingSnapshot(label, data) {
debug(`Recording snapshot: ${label}`, data);
}
-const QUALITY_ORDER = ["240p", "360p", "480p", "720p", "1080p", "4k"];
-
-const clampQualityValue = (value, maxValue) => {
- const current = QUALITY_ORDER.includes(value) ? value : "1080p";
- const max = QUALITY_ORDER.includes(maxValue) ? maxValue : "1080p";
- return QUALITY_ORDER.indexOf(current) <= QUALITY_ORDER.indexOf(max)
- ? current
- : max;
-};
-
const Recorder = () => {
const isRestarting = useRef(false);
const pendingStartAfterRestart = useRef(false);
@@ -1391,15 +1389,17 @@ const Recorder = () => {
const endCapsRead = perfSpan("Recorder.preflight storage+caps");
const [
{ qualityValue, useWebCodecsRecorder: prefUseWebCodecs },
- { isPro, maxQuality, maxFps },
+ captureCaps,
] = await Promise.all([
chrome.storage.local.get(["qualityValue", "useWebCodecsRecorder"]),
getFreeCaptureCaps(),
]);
+ const { isPro, maxFps } = captureCaps;
endCapsRead();
- const effectiveQualityValue = isPro
- ? qualityValue
- : clampQualityValue(qualityValue, maxQuality);
+ const effectiveQualityValue = resolveQualityValue(
+ qualityValue,
+ captureCaps,
+ );
const { audio: audioBitsPerSecond, video: bitratePreset } = getBitrates(
effectiveQualityValue,
);
@@ -1631,6 +1631,40 @@ const Recorder = () => {
const width = Math.max(2, Math.round((trackWidth * fitScale) / 2) * 2);
const height = Math.max(2, Math.round((trackHeight * fitScale) / 2) * 2);
+ // The probe recorded that this size can't be encoded: swap before the
+ // capture is consumed, not after the encoder yields zero chunks. Not sticky.
+ if (
+ canUseWebCodecs &&
+ largeFrameKnownUnsupported(width, height, probeResult?.details)
+ ) {
+ debugWarn("Encode size unsupported by WebCodecs, using MediaRecorder", {
+ width,
+ height,
+ });
+ chrome.runtime
+ .sendMessage({
+ type: "diag-forward",
+ event: "recorder-webcodecs-resolution-swap",
+ data: {
+ stage: "preflight",
+ width,
+ height,
+ supports1440p: probeResult?.details?.supports1440p ?? null,
+ supports4k: probeResult?.details?.supports4k ?? null,
+ },
+ })
+ .catch(() => {});
+ if (chunkWriter.current) {
+ try {
+ await chunkWriter.current.abort();
+ } catch {}
+ chunkWriter.current = null;
+ chunkBackendRef.current = null;
+ }
+ isStarting.current = false;
+ return await startRecording({ forceMediaRecorder: true });
+ }
+
// MediaRecorder encodes the track as-is, so lower it back to the tier or a
// 1080p recording ships as 3840x2160. Runs after the probe, so a decision
// that disagreed with the pre-capture guess still lands right.
@@ -1665,8 +1699,7 @@ const Recorder = () => {
}
const { fpsValue } = await chrome.storage.local.get(["fpsValue"]);
- let fps = parseInt(fpsValue);
- if (Number.isNaN(fps)) fps = 30;
+ let fps = resolveFps(fpsValue, captureCaps);
if (!isPro) {
fps = Math.min(fps, maxFps);
@@ -1924,6 +1957,7 @@ const Recorder = () => {
}
let webcodecsFallbackTriggered = false;
+ let webcodecsFailureMarked = false;
try {
if (canUseWebCodecs) {
useWebCodecs.current = true;
@@ -2269,6 +2303,7 @@ const Recorder = () => {
detail: err?.detail || null,
finalized: fatalFinalized || undefined,
});
+ webcodecsFailureMarked = true;
// Transient stream errors don't disable WebCodecs.
const persisted = {
lastWebCodecsFailureAt: Date.now(),
@@ -2303,6 +2338,20 @@ const Recorder = () => {
trackLive
) {
webcodecsFallbackTriggered = true;
+ if (failureCode === RESOLUTION_UNSUPPORTED_CODE) {
+ chrome.runtime
+ .sendMessage({
+ type: "diag-forward",
+ event: "recorder-webcodecs-resolution-swap",
+ data: {
+ stage: "encoder-choice",
+ width,
+ height,
+ tried: err?.detail?.tried ?? null,
+ },
+ })
+ .catch(() => {});
+ }
debugWarn(
"WebCodecs onError: attempting in-session MediaRecorder swap",
);
@@ -2386,16 +2435,22 @@ const Recorder = () => {
debug("WebCodecsRecorder.start() result", ok);
if (!ok) {
+ // onError already started the swap; a second start would race it.
+ if (webcodecsFallbackTriggered) return;
debugWarn(
"Falling back to MediaRecorder because WebCodecsRecorder failed",
);
useWebCodecs.current = false;
await chrome.storage.local.set({ fastRecorderInUse: false });
// Recoverable device-sticky disable, not the durable user setting.
- await markFastRecorderFailure("start-failed", {});
+ if (!webcodecsFailureMarked) {
+ await markFastRecorderFailure("start-failed", {});
+ }
await chrome.storage.local.set({
lastWebCodecsFailureAt: Date.now(),
- lastWebCodecsFailureCode: "start-failed",
+ ...(webcodecsFailureMarked
+ ? {}
+ : { lastWebCodecsFailureCode: "start-failed" }),
});
chrome.runtime.sendMessage({
type: "show-toast",
@@ -3333,6 +3388,17 @@ const Recorder = () => {
try {
clearInterval(silenceWatchdogRef.current.intervalId);
silenceWatchdogRef.current.analyser?.disconnect?.();
+ const { probeId, probes, probeStartedAt } = silenceWatchdogRef.current;
+ clearInterval(probeId);
+ chrome.runtime.sendMessage({
+ type: "diag-forward",
+ event: "recorder-audio-sources-summary",
+ data: {
+ durationMs: Date.now() - probeStartedAt,
+ sources: snapshotProbes(probes),
+ },
+ });
+ Object.values(probes || {}).forEach((p) => p.dispose());
} catch {}
silenceWatchdogRef.current = null;
}
@@ -3609,18 +3675,16 @@ const Recorder = () => {
});
const { qualityValue } = await chrome.storage.local.get(["qualityValue"]);
- const { isPro, maxQuality, maxFps } = await getFreeCaptureCaps();
- const effectiveQualityValue = isPro
- ? qualityValue
- : clampQualityValue(qualityValue, maxQuality);
+ const captureCaps = await getFreeCaptureCaps();
+ const { isPro, maxFps } = captureCaps;
+ const effectiveQualityValue = resolveQualityValue(
+ qualityValue,
+ captureCaps,
+ );
const { width, height } = getResolutionForQuality(effectiveQualityValue);
const { fpsValue } = await chrome.storage.local.get(["fpsValue"]);
- let fps = parseInt(fpsValue);
-
- if (isNaN(fps)) {
- fps = 30;
- }
+ let fps = resolveFps(fpsValue, captureCaps);
if (!isPro) {
fps = Math.min(fps, maxFps);
}
@@ -3736,37 +3800,50 @@ const Recorder = () => {
: userConstraints.video,
};
- userStream = await getUserMediaWithFallback({
- constraints: cameraConstraints,
- fallbacks: [
- hasVideoDevice && desiredVideoLabel
- ? {
- kind: "videoinput",
- desiredDeviceId: data.defaultVideoInput,
- desiredLabel: desiredVideoLabel,
- onResolved: (resolvedId) => {
- chrome.storage.local.set({
- defaultVideoInput: resolvedId,
- defaultVideoInputLabel: desiredVideoLabel,
- });
- },
- }
- : null,
- hasAudioDevice && desiredAudioLabel
- ? {
- kind: "audioinput",
- desiredDeviceId: data.defaultAudioInput,
- desiredLabel: desiredAudioLabel,
- onResolved: (resolvedId) => {
- chrome.storage.local.set({
- defaultAudioInput: resolvedId,
- defaultAudioInputLabel: desiredAudioLabel,
- });
- },
- }
- : null,
- ].filter(Boolean),
- });
+ try {
+ userStream = await getUserMediaWithFallback({
+ constraints: cameraConstraints,
+ fallbacks: [
+ hasVideoDevice && desiredVideoLabel
+ ? {
+ kind: "videoinput",
+ desiredDeviceId: data.defaultVideoInput,
+ desiredLabel: desiredVideoLabel,
+ onResolved: (resolvedId) => {
+ chrome.storage.local.set({
+ defaultVideoInput: resolvedId,
+ defaultVideoInputLabel: desiredVideoLabel,
+ });
+ },
+ }
+ : null,
+ hasAudioDevice && desiredAudioLabel
+ ? {
+ kind: "audioinput",
+ desiredDeviceId: data.defaultAudioInput,
+ desiredLabel: desiredAudioLabel,
+ onResolved: (resolvedId) => {
+ chrome.storage.local.set({
+ defaultAudioInput: resolvedId,
+ defaultAudioInputLabel: desiredAudioLabel,
+ });
+ },
+ }
+ : null,
+ ].filter(Boolean),
+ });
+ } catch (err) {
+ const cancelled = err?.name === "NotAllowedError";
+ debugWarn("Camera getUserMedia failed", err);
+ resetGateState();
+ sendRecordingError(
+ cancelled
+ ? "User cancelled the modal"
+ : "Failed to get user media: " + String(err),
+ cancelled,
+ );
+ return;
+ }
debug("Camera userStream acquired", {
videoTracks: userStream.getVideoTracks().length,
audioTracks: userStream.getAudioTracks().length,
@@ -3885,6 +3962,13 @@ const Recorder = () => {
path: "getDisplayMedia",
streamId: stream.id,
});
+ // The page learns what was picked here, as the desktop path does below.
+ chrome.runtime
+ .sendMessage({
+ type: "set-surface",
+ surface: stream.getVideoTracks()[0].getSettings().displaySurface,
+ })
+ .catch(() => {});
} else {
// Chrome's tab capture defaults to a 1920x1080 frame and pillarboxes
// narrower tabs to fit. Match the constraint box to the tab's real
@@ -4192,6 +4276,27 @@ const Recorder = () => {
tapSource.connect(analyser);
} catch {}
});
+ // Raw per-source taps, ahead of any gain, so a silent report can say
+ // which source was quiet and whether the graph or the input lost it.
+ const probes = {};
+ try {
+ if (data.systemAudio && sysTracks[0]) {
+ probes.sys = createSourceProbe(aCtx.current, sysTracks[0]);
+ }
+ const probeMicTrack = helperAudioStream.current?.getAudioTracks?.()[0];
+ if (probeMicTrack) {
+ probes.mic = createSourceProbe(aCtx.current, probeMicTrack);
+ }
+ } catch {}
+ const probeStartedAt = Date.now();
+ const probeId = setInterval(() => {
+ if (!isRecording.current || isFinishing.current) return;
+ Object.values(probes).forEach((p) => {
+ try {
+ p.sample();
+ } catch {}
+ });
+ }, 500);
let silentSamples = 0;
let alreadyReported = false;
const SILENCE_THRESHOLD = 2;
@@ -4237,9 +4342,29 @@ const Recorder = () => {
typeof document !== "undefined"
? document.visibilityState
: null,
+ micActive: !!data.micActive,
+ micGain: audioInputGain.current?.gain?.value ?? null,
+ sources: snapshotProbes(probes, { resetWindow: true }),
+ sysTrackLabel: String(sysTracks[0]?.label || "").slice(0, 80),
+ sysTrackSettings: sysTracks[0]?.getSettings?.() ?? null,
},
});
} catch {}
+ navigator.mediaDevices
+ ?.enumerateDevices?.()
+ .then((devices) => {
+ chrome.runtime.sendMessage({
+ type: "diag-forward",
+ event: "recorder-audio-output-devices",
+ data: {
+ outputs: devices
+ .filter((d) => d.kind === "audiooutput")
+ .map((d) => String(d.label || "").slice(0, 80))
+ .slice(0, 8),
+ },
+ });
+ })
+ .catch(() => {});
// No toast: silence is normal (nobody speaking, or no audio), so a
// mid-recording warning just gets in the way. Diag above still logs it.
}
@@ -4251,12 +4376,19 @@ const Recorder = () => {
chrome.runtime.sendMessage({
type: "diag-forward",
event: "recorder-audio-recovered",
+ data: { sources: snapshotProbes(probes) },
});
} catch {}
}
}
}, 5000);
- silenceWatchdogRef.current = { intervalId, analyser };
+ silenceWatchdogRef.current = {
+ intervalId,
+ analyser,
+ probeId,
+ probes,
+ probeStartedAt,
+ };
} catch (err) {
console.warn("[Recorder] silence watchdog setup failed", err);
}
@@ -4302,10 +4434,10 @@ const Recorder = () => {
const { qualityValue: storedQuality } = await chrome.storage.local.get([
"qualityValue",
]);
- const { isPro, maxQuality } = await getFreeCaptureCaps();
- const tierQuality = isPro
- ? storedQuality
- : clampQualityValue(storedQuality, maxQuality);
+ const tierQuality = resolveQualityValue(
+ storedQuality,
+ await getFreeCaptureCaps(),
+ );
const { width: tierW, height: tierH } =
getResolutionForQuality(tierQuality);
if (rawW > 0 && rawH > 0 && tierW > 0 && tierH > 0) {
@@ -4322,13 +4454,18 @@ const Recorder = () => {
probeData?.fastRecorderProbe?.details?.selectedVideoConfig || null;
// Prefer the probe's codec; fall back to High L4.2 (Main is excluded
// from the ladder for Windows MFT silent-no-output, see WCR).
- const codec = probeConfig?.codec || "avc1.64002A";
const bitrate =
Number(probeConfig?.bitrate) || 4_000_000;
const framerate =
Number(settings.frameRate) ||
Number(probeConfig?.framerate) ||
30;
+ const codec = avcCodecForSize(
+ probeConfig?.codec || "avc1.64002A",
+ w,
+ h,
+ framerate,
+ );
void startEncoderPrewarm({
width: w,
height: h,
diff --git a/src/pages/Recorder/audioGapDetector.js b/src/pages/Recorder/audioGapDetector.js
new file mode 100644
index 0000000..6c654c1
--- /dev/null
+++ b/src/pages/Recorder/audioGapDetector.js
@@ -0,0 +1,318 @@
+// Separated-mic gap detector. A customer's mic file had ~400 ms of exact digital
+// silence mid-speech with nothing dropped by our encoder, so the loss was
+// upstream. This watches the raw mic for runs of exact-zero samples (digital
+// silence, as in that file) and for callbacks arriving late. It only reads a
+// second tap of the track; the recorder keeps reading the original stream.
+
+const BLOCK_FRAMES = 4096;
+
+export const createGapDetector = ({
+ sampleRate,
+ minRunMs = 100,
+ lateMs = 150,
+ // The source emits zeros while it spins up; those are not a gap in speech.
+ warmupMs = 500,
+ maxEvents = 20,
+ onGap = null,
+} = {}) => {
+ const toMs = (frames) => Math.round((frames / sampleRate) * 1000);
+ const minRunFrames = Math.round((sampleRate * minRunMs) / 1000);
+ const warmupFrames = Math.round((sampleRate * warmupMs) / 1000);
+
+ // Audio time seen so far, so offsets line up with the file and not the wall.
+ let frames = 0;
+ let runStart = 0;
+ let runLen = 0;
+ let lastWallMs = null;
+ const gaps = [];
+ const lates = [];
+ const totals = { gapCount: 0, gapMaxMs: 0, lateCount: 0, lateMaxMs: 0 };
+
+ const closeRun = () => {
+ if (runLen >= minRunFrames && runStart >= warmupFrames) {
+ const gap = { atMs: toMs(runStart), ms: toMs(runLen) };
+ totals.gapCount += 1;
+ totals.gapMaxMs = Math.max(totals.gapMaxMs, gap.ms);
+ if (gaps.length < maxEvents) {
+ gaps.push(gap);
+ try {
+ onGap?.(gap);
+ } catch {}
+ }
+ }
+ runLen = 0;
+ };
+
+ const snapshot = () => ({
+ monitoredMs: toMs(frames),
+ ...totals,
+ gaps: gaps.slice(),
+ lates: lates.slice(),
+ });
+
+ return {
+ // active=false (muted, track ended, context not running): the zeros are
+ // expected, so drop any run and keep the clock moving. paused=true: the file
+ // is not advancing either, so freeze it.
+ push(samples, { wallMs, active = true, paused = false } = {}) {
+ if (paused) {
+ runLen = 0;
+ lastWallMs = null;
+ return;
+ }
+ if (active && lastWallMs !== null) {
+ const late = wallMs - lastWallMs - (samples.length / sampleRate) * 1000;
+ if (late > lateMs) {
+ const entry = { atMs: toMs(frames), lateMs: Math.round(late) };
+ totals.lateCount += 1;
+ totals.lateMaxMs = Math.max(totals.lateMaxMs, entry.lateMs);
+ if (lates.length < maxEvents) lates.push(entry);
+ }
+ }
+ lastWallMs = active ? wallMs : null;
+ if (!active) {
+ runLen = 0;
+ frames += samples.length;
+ return;
+ }
+ for (let i = 0; i < samples.length; i += 1) {
+ if (samples[i] === 0) {
+ if (runLen === 0) runStart = frames + i;
+ runLen += 1;
+ } else if (runLen > 0) {
+ closeRun();
+ }
+ }
+ frames += samples.length;
+ },
+ // A run still open at the end of the take is a gap too.
+ finish() {
+ closeRun();
+ return snapshot();
+ },
+ snapshot,
+ };
+};
+
+// Main-thread side of audioGapWorklet.js: same totals and event lists as
+// createGapDetector, fed by the worklet's run events and heartbeats instead of
+// raw samples. A heartbeat stands in for a ScriptProcessor callback, so "late"
+// still means audio-paced work reaching the main thread late.
+export const createWorkletGapSink = ({
+ sampleRate,
+ minRunMs = 100,
+ lateMs = 150,
+ warmupMs = 500,
+ maxEvents = 20,
+ onGap = null,
+} = {}) => {
+ const toMs = (frames) => Math.round((frames / sampleRate) * 1000);
+ const minRunFrames = Math.round((sampleRate * minRunMs) / 1000);
+ const warmupFrames = Math.round((sampleRate * warmupMs) / 1000);
+
+ let frames = 0;
+ let openRun = null;
+ let lastWallMs = null;
+ const gaps = [];
+ const lates = [];
+ const totals = { gapCount: 0, gapMaxMs: 0, lateCount: 0, lateMaxMs: 0 };
+
+ const countRun = (start, len) => {
+ if (len < minRunFrames || start < warmupFrames) return;
+ const gap = { atMs: toMs(start), ms: toMs(len) };
+ totals.gapCount += 1;
+ totals.gapMaxMs = Math.max(totals.gapMaxMs, gap.ms);
+ if (gaps.length < maxEvents) {
+ gaps.push(gap);
+ try {
+ onGap?.(gap);
+ } catch {}
+ }
+ };
+
+ const snapshot = () => ({
+ monitoredMs: toMs(frames),
+ ...totals,
+ gaps: gaps.slice(),
+ lates: lates.slice(),
+ });
+
+ return {
+ minRunFrames,
+ gap({ start, len }) {
+ if (openRun?.start === start) openRun = null;
+ countRun(start, len);
+ },
+ heartbeat(hb, { wallMs, active = true, paused = false } = {}) {
+ frames = hb.frames;
+ openRun = hb.runLen > 0 ? { start: hb.runStart, len: hb.runLen } : null;
+ if (paused) {
+ lastWallMs = null;
+ return;
+ }
+ if (active && lastWallMs !== null) {
+ const late = wallMs - lastWallMs - (hb.rendered / sampleRate) * 1000;
+ if (late > lateMs) {
+ const entry = { atMs: toMs(hb.at), lateMs: Math.round(late) };
+ totals.lateCount += 1;
+ totals.lateMaxMs = Math.max(totals.lateMaxMs, entry.lateMs);
+ if (lates.length < maxEvents) lates.push(entry);
+ }
+ }
+ lastWallMs = active ? wallMs : null;
+ },
+ finish() {
+ if (openRun) countRun(openRun.start, openRun.len);
+ openRun = null;
+ return snapshot();
+ },
+ snapshot,
+ };
+};
+
+export const GAP_WORKLET_FILE = "audioGapWorklet.js";
+const GAP_PROCESSOR = "screenity-gap-scan";
+const workletLoads = new WeakMap();
+
+const loadGapWorklet = (ctx) => {
+ if (!workletLoads.has(ctx)) {
+ const url = globalThis.chrome?.runtime?.getURL?.(GAP_WORKLET_FILE);
+ const load =
+ url && ctx.audioWorklet && typeof AudioWorkletNode !== "undefined"
+ ? ctx.audioWorklet.addModule(url)
+ : Promise.reject(new Error("no audio worklet"));
+ workletLoads.set(ctx, load);
+ }
+ return workletLoads.get(ctx);
+};
+
+// The scan runs in an AudioWorklet so the main thread only handles a message
+// every ~85 ms. If the module fails to load, falls back to a 4096-frame
+// ScriptProcessor running createGapDetector. Never throws into the caller.
+export const attachGapDetector = (ctx, track, { isPaused, onGap } = {}) => {
+ const isActive = () =>
+ track.enabled && track.readyState === "live" && ctx.state === "running";
+ let detector = createWorkletGapSink({ sampleRate: ctx.sampleRate, onGap });
+ let disposed = false;
+ let teardown = null;
+
+ const connect = (node) => {
+ const source = ctx.createMediaStreamSource(new MediaStream([track]));
+ // Private sink so the node is pulled without touching the recording bus.
+ const sink = ctx.createMediaStreamDestination();
+ source.connect(node);
+ node.connect(sink);
+ return () => {
+ try {
+ source.disconnect();
+ node.disconnect();
+ } catch {}
+ };
+ };
+
+ const startScriptProcessor = () => {
+ if (disposed) return;
+ try {
+ const fallback = createGapDetector({ sampleRate: ctx.sampleRate, onGap });
+ const node = ctx.createScriptProcessor(BLOCK_FRAMES, 1, 1);
+ node.onaudioprocess = (event) => {
+ try {
+ fallback.push(event.inputBuffer.getChannelData(0), {
+ wallMs: performance.now(),
+ active: isActive(),
+ paused: Boolean(isPaused?.()),
+ });
+ } catch {}
+ };
+ const disconnect = connect(node);
+ detector = fallback;
+ teardown = () => {
+ node.onaudioprocess = null;
+ disconnect();
+ };
+ } catch {}
+ };
+
+ const startWorklet = () => {
+ if (disposed) return;
+ const sink = detector;
+ const node = new AudioWorkletNode(ctx, GAP_PROCESSOR, {
+ numberOfInputs: 1,
+ numberOfOutputs: 1,
+ outputChannelCount: [1],
+ channelCount: 1,
+ channelCountMode: "explicit",
+ processorOptions: {
+ minRunFrames: sink.minRunFrames,
+ heartbeatFrames: BLOCK_FRAMES,
+ },
+ });
+ // active and paused are main-thread facts. They are re-read on each
+ // heartbeat and pushed to the worklet when they change.
+ let sent = { active: isActive(), paused: Boolean(isPaused?.()) };
+ node.port.postMessage(sent);
+ node.port.onmessage = (event) => {
+ try {
+ const msg = event.data;
+ if (msg?.t === "gap") {
+ sink.gap(msg);
+ return;
+ }
+ if (msg?.t !== "hb") return;
+ const state = { active: isActive(), paused: Boolean(isPaused?.()) };
+ sink.heartbeat(msg, { wallMs: performance.now(), ...state });
+ if (state.active !== sent.active || state.paused !== sent.paused) {
+ sent = state;
+ node.port.postMessage(state);
+ }
+ } catch {}
+ };
+ let disconnect;
+ try {
+ disconnect = connect(node);
+ } catch (err) {
+ node.port.onmessage = null;
+ try {
+ node.disconnect();
+ } catch {}
+ throw err;
+ }
+ teardown = () => {
+ node.port.onmessage = null;
+ try {
+ node.port.close();
+ } catch {}
+ disconnect();
+ };
+ };
+
+ try {
+ loadGapWorklet(ctx)
+ .then(startWorklet)
+ .catch(startScriptProcessor);
+ } catch {
+ startScriptProcessor();
+ }
+
+ return {
+ snapshot: () => detector.snapshot(),
+ finish: () => detector.finish(),
+ dispose() {
+ disposed = true;
+ teardown?.();
+ teardown = null;
+ },
+ };
+};
+
+// Flat numeric keys for the server telemetry sanitizer, which whitelists
+// audioDiag one key at a time. The offsets travel in the diag event instead.
+export const flattenGapDiag = (snap) =>
+ snap
+ ? {
+ micGapCount: snap.gapCount,
+ micGapMaxMs: snap.gapMaxMs,
+ micLateCount: snap.lateCount,
+ micLateMaxMs: snap.lateMaxMs,
+ }
+ : {};
diff --git a/src/pages/Recorder/audioGapWorklet.js b/src/pages/Recorder/audioGapWorklet.js
new file mode 100644
index 0000000..589d671
--- /dev/null
+++ b/src/pages/Recorder/audioGapWorklet.js
@@ -0,0 +1,75 @@
+/* global registerProcessor, AudioWorkletProcessor */
+// Audio-thread half of the separated-mic gap detector. Copied as-is into the
+// build (not bundled) so it loads with ctx.audioWorklet.addModule. It only
+// tracks zero runs; totals, warmup and late checks stay on the main thread.
+// Posts { t: "gap" } when a run of at least minRunFrames closes, and
+// { t: "hb" } every heartbeatFrames rendered frames with the file clock and
+// any open run, so finish() can close it without a round trip.
+
+class GapScanProcessor extends AudioWorkletProcessor {
+ constructor(options) {
+ super();
+ const opts = options?.processorOptions || {};
+ this.minRunFrames = opts.minRunFrames || 1;
+ this.heartbeatFrames = opts.heartbeatFrames || 4096;
+ // File clock: advances unless paused, like createGapDetector's frames.
+ this.frames = 0;
+ this.runStart = 0;
+ this.runLen = 0;
+ this.active = true;
+ this.paused = false;
+ this.rendered = 0;
+ this.hbFrom = 0;
+ this.port.onmessage = (event) => {
+ const { active, paused } = event.data || {};
+ this.active = active !== false;
+ this.paused = paused === true;
+ if (!this.active || this.paused) this.runLen = 0;
+ };
+ }
+
+ closeRun() {
+ if (this.runLen >= this.minRunFrames) {
+ this.port.postMessage({ t: "gap", start: this.runStart, len: this.runLen });
+ }
+ this.runLen = 0;
+ }
+
+ process(inputs) {
+ const ch = inputs[0]?.[0];
+ const n = ch ? ch.length : 128;
+ if (!this.paused) {
+ if (this.active) {
+ // No channel means the source went away; treat it as zeros, as the
+ // ScriptProcessor's empty input buffer would read.
+ for (let i = 0; i < n; i += 1) {
+ if (!ch || ch[i] === 0) {
+ if (this.runLen === 0) this.runStart = this.frames + i;
+ this.runLen += 1;
+ } else if (this.runLen > 0) {
+ this.closeRun();
+ }
+ }
+ }
+ this.frames += n;
+ }
+ this.rendered += n;
+ if (this.rendered >= this.heartbeatFrames) {
+ this.port.postMessage({
+ t: "hb",
+ at: this.hbFrom,
+ frames: this.frames,
+ rendered: this.rendered,
+ runStart: this.runStart,
+ runLen: this.runLen,
+ });
+ this.rendered = 0;
+ this.hbFrom = this.frames;
+ }
+ return true;
+ }
+}
+
+try {
+ registerProcessor("screenity-gap-scan", GapScanProcessor);
+} catch {}
diff --git a/src/pages/Recorder/audioSourceProbe.js b/src/pages/Recorder/audioSourceProbe.js
new file mode 100644
index 0000000..be2ea61
--- /dev/null
+++ b/src/pages/Recorder/audioSourceProbe.js
@@ -0,0 +1,99 @@
+// Per-source level probe. The silence watchdog only hears the mixed bus, so a
+// silent report can't say whether the mic, the system audio, or our own graph
+// went quiet. This taps a raw track before any gain and keeps running stats.
+
+const ACTIVE_DEVIATION = 2;
+
+export const byteDeviationToDb = (dev) =>
+ dev > 0 ? Math.round(20 * Math.log10(dev / 128) * 10) / 10 : null;
+
+export const createSourceStats = (now = Date.now) => {
+ const startedAt = now();
+ let samples = 0;
+ let activeSamples = 0;
+ let peak = 0;
+ let windowPeak = 0;
+ let firstActiveMs = null;
+ let lastActiveMs = null;
+
+ return {
+ record(maxDev) {
+ samples += 1;
+ if (maxDev > peak) peak = maxDev;
+ if (maxDev > windowPeak) windowPeak = maxDev;
+ if (maxDev >= ACTIVE_DEVIATION) {
+ activeSamples += 1;
+ const at = now() - startedAt;
+ if (firstActiveMs === null) firstActiveMs = at;
+ lastActiveMs = at;
+ }
+ },
+ snapshot({ resetWindow = false } = {}) {
+ const out = {
+ samples,
+ activeSamples,
+ everActive: firstActiveMs !== null,
+ firstActiveMs,
+ lastActiveMs,
+ peakDb: byteDeviationToDb(peak),
+ windowPeakDb: byteDeviationToDb(windowPeak),
+ };
+ if (resetWindow) windowPeak = 0;
+ return out;
+ },
+ };
+};
+
+export const createSourceProbe = (ctx, track) => {
+ const analyser = ctx.createAnalyser();
+ analyser.fftSize = 1024;
+ const source = ctx.createMediaStreamSource(new MediaStream([track]));
+ source.connect(analyser);
+ const buf = new Uint8Array(analyser.frequencyBinCount);
+ const stats = createSourceStats();
+
+ return {
+ sample() {
+ analyser.getByteTimeDomainData(buf);
+ let maxDev = 0;
+ for (let i = 0; i < buf.length; i += 1) {
+ const dev = Math.abs(buf[i] - 128);
+ if (dev > maxDev) maxDev = dev;
+ }
+ stats.record(maxDev);
+ },
+ snapshot: (opts) => stats.snapshot(opts),
+ dispose() {
+ try {
+ source.disconnect();
+ analyser.disconnect();
+ } catch {}
+ },
+ };
+};
+
+export const snapshotProbes = (probes, opts) => {
+ const out = {};
+ for (const [name, probe] of Object.entries(probes || {})) {
+ out[name] = probe.snapshot(opts);
+ }
+ return out;
+};
+
+// Flat, numeric/boolean keys for the server telemetry sanitizer, which
+// whitelists audioDiag one key at a time and has no nested pass-through.
+export const flattenProbeDiag = (snapshots) => {
+ const out = {};
+ for (const name of ["sys", "mic"]) {
+ const s = snapshots?.[name];
+ if (!s) continue;
+ out[`${name}EverActive`] = s.everActive;
+ out[`${name}FirstActiveMs`] = s.firstActiveMs;
+ out[`${name}PeakDb`] = s.peakDb;
+ out[`${name}WindowPeakDb`] = s.windowPeakDb;
+ out[`${name}ActiveRatio`] = s.samples
+ ? Math.round((s.activeSamples / s.samples) * 100) / 100
+ : null;
+ }
+ return out;
+};
diff --git a/src/pages/Recorder/perfTelemetry.js b/src/pages/Recorder/perfTelemetry.js
new file mode 100644
index 0000000..9bce129
--- /dev/null
+++ b/src/pages/Recorder/perfTelemetry.js
@@ -0,0 +1,103 @@
+// Numbers-only host health for the recorder document. One fps average over a
+// take can't say when frames slowed or why, so this keeps fps per 30 s window
+// and the main thread's long tasks.
+
+export const FPS_WINDOW_MS = 30_000
+
+// Fed cumulative frames and active (pause-excluded) ms, so a window closes on
+// the first tick past its length. A starved take closes late, not never.
+export const createFpsWindows = ({ windowMs = FPS_WINDOW_MS, maxWindows = 240 } = {}) => {
+ const windows = []
+ let startFrames = null
+ let startMs = 0
+ return {
+ tick(frames, activeMs) {
+ if (startFrames === null) {
+ startFrames = frames
+ startMs = activeMs
+ return
+ }
+ const span = activeMs - startMs
+ if (span < windowMs) return
+ const fps = Math.round(((frames - startFrames) / (span / 1000)) * 10) / 10
+ if (windows.length < maxWindows) windows.push(fps)
+ startFrames = frames
+ startMs = activeMs
+ },
+ snapshot() {
+ return {
+ count: windows.length,
+ last: windows.length ? windows[windows.length - 1] : null,
+ min: windows.length ? Math.min(...windows) : null,
+ max: windows.length ? Math.max(...windows) : null,
+ windows: windows.slice(),
+ }
+ },
+ }
+}
+
+// Long tasks (50 ms+) on this document's main thread, where the capture read
+// loop, canvas draw and encoder feed all run.
+export const createLongTaskTracker = ({ Observer = globalThis.PerformanceObserver } = {}) => {
+ let observer = null
+ const totals = { count: 0, maxMs: 0, totalMs: 0 }
+ return {
+ start() {
+ if (observer || typeof Observer !== "function") return
+ try {
+ observer = new Observer((list) => {
+ for (const entry of list.getEntries()) {
+ totals.count += 1
+ totals.totalMs += entry.duration
+ totals.maxMs = Math.max(totals.maxMs, entry.duration)
+ }
+ })
+ observer.observe({ type: "longtask" })
+ } catch {
+ observer = null
+ }
+ },
+ stop() {
+ try {
+ observer?.disconnect()
+ } catch {}
+ observer = null
+ },
+ reset() {
+ totals.count = 0
+ totals.maxMs = 0
+ totals.totalMs = 0
+ },
+ snapshot() {
+ return {
+ count: totals.count,
+ maxMs: Math.round(totals.maxMs),
+ totalMs: Math.round(totals.totalMs),
+ }
+ },
+ }
+}
+
+export const longTasks = createLongTaskTracker()
+
+export const readDevice = (nav = globalThis.navigator) => ({
+ hardwareConcurrency: Number.isFinite(nav?.hardwareConcurrency) ? nav.hardwareConcurrency : null,
+ // Chrome reports this on Windows and Linux; Macs return nothing.
+ deviceMemoryGb: Number.isFinite(nav?.deviceMemory) ? nav.deviceMemory : null,
+})
+
+// Flat keys for the server sanitizer, which whitelists encodeStats one key at a
+// time. The per-window series travels in the diag event instead.
+export const flattenPerfStats = ({ device, fps, longTask, encodeHardware, tier, targetFps }) => ({
+ hardwareConcurrency: device?.hardwareConcurrency ?? null,
+ deviceMemoryGb: device?.deviceMemoryGb ?? null,
+ encodeHardware: encodeHardware ?? null,
+ longTaskCount: longTask?.count ?? null,
+ longTaskMaxMs: longTask?.maxMs ?? null,
+ fpsWindowCount: fps?.count ?? null,
+ fpsWindowLast: fps?.last ?? null,
+ fpsWindowMin: fps?.min ?? null,
+ fpsWindowMax: fps?.max ?? null,
+ encodeTier: tier ?? null,
+ encodeTargetFps: targetFps ?? null,
+})
diff --git a/src/pages/Recorder/prewarmSustained.js b/src/pages/Recorder/prewarmSustained.js
new file mode 100644
index 0000000..5851664
--- /dev/null
+++ b/src/pages/Recorder/prewarmSustained.js
@@ -0,0 +1,79 @@
+import {
+ resolveSustainedTier,
+ measureEncodeRate,
+ TARGET_FPS,
+} from "../CloudRecorder/sustainedEncode";
+import { avcCodecForSize } from "../../media/avcLevel";
+import { smootherMotionActive } from "../CloudRecorder/screenFps";
+
+// Auto only takes 4K once the sustained test has passed on this device, so fill
+// the cache before the first take. Only runs when Auto could pick 4K.
+export const prewarmSustainedEncode = async () => {
+ try {
+ const stored = await chrome.storage.local.get([
+ "qualityValue",
+ "fastRecorderProbe",
+ "smootherMotion",
+ "fpsValue",
+ ]);
+ const { qualityValue, fastRecorderProbe } = stored;
+ const auto = qualityValue === undefined || qualityValue === "auto";
+ if (!auto || fastRecorderProbe?.details?.supports4k !== true) return;
+ await resolveSustainedTier({
+ preferFps:
+ Number.parseInt(stored.fpsValue, 10) > TARGET_FPS
+ ? Number.parseInt(stored.fpsValue, 10)
+ : smootherMotionActive(stored)
+ ? 60
+ : TARGET_FPS,
+ measure: (tier, opts) =>
+ measureEncodeRate(tier, { ...opts, codecFor: avcCodecForSize }),
+ });
+ } catch {}
+};
+
+const pageVisible = () =>
+ typeof document === "undefined" ||
+ (!document.hidden && document.visibilityState === "visible");
+
+const recordingInProgress = async () => {
+ try {
+ const { recording } = await chrome.storage.local.get("recording");
+ return recording === true;
+ } catch {
+ return false;
+ }
+};
+
+// Runs a speed test when it cannot disturb anything: the tab is shown (a
+// background tab throttles timers and the skewed rate is cached for 14 days),
+// no recording is running (a flat-out encode would drop its frames and measure
+// low), and no other tab is already testing. Skipped runs retry on the next
+// page load; the click still measures if the cache is cold.
+export const prewarmSpeedTest = (task) => {
+ if (typeof window === "undefined") return;
+ const run = async () => {
+ if (!pageVisible()) {
+ document.addEventListener("visibilitychange", () => schedule(), { once: true });
+ return;
+ }
+ if (await recordingInProgress()) return;
+ const exclusive = (fn) =>
+ navigator.locks
+ ? navigator.locks.request("screenity-speed-test", { ifAvailable: true }, (lock) =>
+ lock ? fn() : undefined
+ )
+ : fn();
+ try {
+ await exclusive(task);
+ } catch {}
+ };
+ const schedule = () => {
+ if (typeof window.requestIdleCallback === "function") {
+ window.requestIdleCallback(run, { timeout: 2000 });
+ } else {
+ setTimeout(run, 200);
+ }
+ };
+ schedule();
+};
diff --git a/src/pages/Recorder/recorderConfig.js b/src/pages/Recorder/recorderConfig.js
index 5c0067e..4801b2d 100644
--- a/src/pages/Recorder/recorderConfig.js
+++ b/src/pages/Recorder/recorderConfig.js
@@ -1,3 +1,10 @@
+import {
+ readCache,
+ passes,
+ rateKey,
+ TARGET_FPS,
+} from "../CloudRecorder/sustainedEncode.js";
+
// Pair video + audio codec explicitly (w3c/mediacapture-record#194); Chrome
// mis-tags blob.type otherwise. MP4 (H.264+AAC) first since VFR VP9/WebM breaks
// downstream (Bunny drops frames, node-av SIGSEGVs); isTypeSupported gates it.
@@ -58,20 +65,126 @@ export function computeTargetVideoBps(width, height, fps, isPro = false) {
return Math.max(VIDEO_BPS_MIN, Math.min(VIDEO_BPS_MAX, target));
}
+const QUALITY_ORDER = ["240p", "360p", "480p", "720p", "1080p", "4k"];
+
+export const AUTO = "auto";
+
+// Rates the sustained-encode test cached for this device (null before it
+// runs). Shared with the cloud recorder through localStorage.
+const readSustainedRates = () => {
+ try {
+ return readCache(localStorage);
+ } catch {
+ return null;
+ }
+};
+
+// Same RAM read the settings menu uses: Macs don't report deviceMemory.
+export const deviceRamGb = () => {
+ try {
+ if (navigator.userAgent.includes("Macintosh")) return 32;
+ return Number(navigator.deviceMemory) || 4;
+ } catch {
+ return 4;
+ }
+};
+
export async function getFreeCaptureCaps() {
try {
- const { isLoggedIn, isSubscribed } = await chrome.storage.local.get([
+ const {
+ isLoggedIn,
+ isSubscribed,
+ fastRecorderProbe,
+ smootherMotion,
+ fpsValue,
+ } = await chrome.storage.local.get([
"isLoggedIn",
"isSubscribed",
+ "fastRecorderProbe",
+ "smootherMotion",
+ "fpsValue",
]);
+ const isPro = Boolean(isLoggedIn && isSubscribed);
return {
- isPro: Boolean(isLoggedIn && isSubscribed),
- maxQuality: "1080p",
+ isPro,
+ maxQuality: "4k",
maxFps: 60,
+ support: fastRecorderProbe?.details || null,
+ // The checkbox is disabled under a fixed fps, so a stored true is stale.
+ smoother:
+ smootherMotion === true &&
+ !(Number.parseInt(fpsValue, 10) > 0),
+ fixedFps:
+ Number.parseInt(fpsValue, 10) > 0 ? Number.parseInt(fpsValue, 10) : null,
+ sustained: readSustainedRates(),
+ ram: deviceRamGb(),
};
} catch {
- return { isPro: false, maxQuality: "1080p", maxFps: 60 };
+ return {
+ isPro: false,
+ maxQuality: "1080p",
+ maxFps: 60,
+ support: null,
+ smoother: false,
+ fixedFps: null,
+ sustained: null,
+ ram: 4,
+ };
+ }
+}
+
+const clampQuality = (value, maxValue) => {
+ const current = QUALITY_ORDER.includes(value) ? value : "1080p";
+ const max = QUALITY_ORDER.includes(maxValue) ? maxValue : "1080p";
+ return QUALITY_ORDER.indexOf(current) <= QUALITY_ORDER.indexOf(max)
+ ? current
+ : max;
+};
+
+const hardware4kPassed = (support) =>
+ support?.supports4k === true &&
+ support?.supports4kConfig?.hardwareAcceleration === "prefer-hardware";
+
+const MIN_AUTO_4K_RAM_GB = 8;
+
+// True only if the speed test measured 4K keeping up at the Auto frame rate.
+// Unmeasured is no: a new device's first take stays at 1080p while the cache fills.
+const sustains4k = (sustained, fps) =>
+ passes(sustained?.[rateKey("2160p", fps)], fps);
+
+// Auto takes 4K only if the probe passed it on hardware AND the sustained test
+// kept up, with a RAM floor as backstop. A picked 4k drops to 1080p only when
+// the probe said 4K can't be encoded; an unknown probe keeps the choice.
+export function resolveQualityValue(stored, caps = {}) {
+ const {
+ maxQuality = "4k",
+ support = null,
+ smoother = false,
+ fixedFps = null,
+ sustained = null,
+ ram = MIN_AUTO_4K_RAM_GB,
+ } = caps;
+ if (stored === AUTO || stored === undefined || stored === null) {
+ // A fixed 60 records at 60, so Auto must check the 60 result, not the 30 one.
+ const fps = fixedFps > TARGET_FPS ? fixedFps : smoother ? 60 : TARGET_FPS;
+ const wanted =
+ hardware4kPassed(support) &&
+ sustains4k(sustained, fps) &&
+ ram >= MIN_AUTO_4K_RAM_GB
+ ? "4k"
+ : "1080p";
+ return clampQuality(wanted, maxQuality);
}
+ const picked = QUALITY_ORDER.includes(stored) ? stored : "1080p";
+ if (picked === "4k" && support?.supports4k === false) return "1080p";
+ return clampQuality(picked, maxQuality);
+}
+
+export function resolveFps(stored, caps = {}) {
+ const { smoother = false } = caps;
+ const parsed = Number.parseInt(stored, 10);
+ if (Number.isFinite(parsed) && parsed > 0) return parsed;
+ return smoother ? 60 : 30;
}
// Every encode cap we ship is landscape, so a portrait source binds on HEIGHT
diff --git a/src/pages/Recorder/webcodecs/WebCodecsRecorder.js b/src/pages/Recorder/webcodecs/WebCodecsRecorder.js
index 18b34cb..3b572d5 100644
--- a/src/pages/Recorder/webcodecs/WebCodecsRecorder.js
+++ b/src/pages/Recorder/webcodecs/WebCodecsRecorder.js
@@ -12,6 +12,7 @@
import { perfMark, perfSpan } from "../../utils/perfMarks";
import { diagForward } from "../../utils/diagForward";
import { computeLetterboxRect } from "./letterbox";
+import { createFpsWindows } from "../perfTelemetry";
import {
AAC_SUPPORTED_RATES,
AVC_MAX_PIXELS,
@@ -35,6 +36,14 @@ import {
} from "./recorderLogic";
import { getStartupFlags } from "./startupFlags";
import { orientBoxToSource } from "../recorderConfig";
+import {
+ advanceAudioLeadInHold,
+ computeStartLeadInUs,
+ createAudioLeadInHoldState,
+ isValidStartEpochMs,
+} from "./startLeadIn";
+import { avcCodecForSize, exceedsAvcL42 } from "../../../media/avcLevel";
+import { RESOLUTION_UNSUPPORTED_CODE } from "../../../media/fastRecorderGate";
import { claimPrewarmedEncoder } from "../encoderPrewarm";
// Lazy-load Mp4MuxerWrapper so its ~3MB mediabunny static import doesn't
// drag into recorder.bundle.js cold start (dominates click-record latency).
@@ -109,6 +118,17 @@ export class WebCodecsRecorder {
this._frameDurationUs = null;
this._lastKeyFrameIndex = 0;
this._keyFrameIntervalFrames = 60;
+ // Shared start epoch (startLeadIn.js): first video frame and first audio
+ // packet are padded to their offset from it.
+ this._startEpochUs = null;
+ this._videoLeadInPending = false;
+ this._audioLeadInPending = false;
+ this._videoArrivalUs = null;
+ // Telemetry: first-frame lag past the epoch, and lead-in written (0 if the
+ // clamp fell back). Null without an epoch.
+ this._startLagMs = null;
+ this._startLeadInMs = null;
+ this._audioStartLeadInMs = null;
this.audioSamplesWritten = 0;
this.audioSampleRate = null;
@@ -261,6 +281,7 @@ export class WebCodecsRecorder {
// almost did.
this._peakVideoEncodeQueueSize = 0;
this._peakAudioEncodeQueueSize = 0;
+ this._fpsWindows = createFpsWindows();
// Encoder reclaim recovery. Chrome reclaims idle HW slots; we
// rebuild with the same config. Cap 5 plus throttle is ~10s of retries.
@@ -531,6 +552,15 @@ export class WebCodecsRecorder {
this._videoStartUs = null;
this._frameDurationUs = null;
this._lastKeyFrameIndex = 0;
+ this._startEpochUs = isValidStartEpochMs(this.options.startEpochMs)
+ ? this.options.startEpochMs * 1000
+ : null;
+ this._videoLeadInPending = false;
+ this._audioLeadInPending = this._startEpochUs != null;
+ this._videoArrivalUs = null;
+ this._startLagMs = null;
+ this._startLeadInMs = null;
+ this._audioStartLeadInMs = null;
this.audioSamplesWritten = 0;
this._audioTimeBaseUs = 0;
this._audioStampRate = null;
@@ -659,6 +689,15 @@ export class WebCodecsRecorder {
bitrate: safeBitrate,
framerate: fps,
});
+ // Probe codec was picked at 1080p; its level may be too low here.
+ if (config.codec) {
+ config.codec = avcCodecForSize(
+ config.codec,
+ this.targetWidth,
+ this.targetHeight,
+ fps,
+ );
+ }
this.log("[WCR] Using override encoder config", config);
try {
const support = await VideoEncoder.isConfigSupported(config);
@@ -1145,6 +1184,9 @@ export class WebCodecsRecorder {
videoEncoderStateAtStop: this._videoEncoderStateAtStop,
failureReported: this._failureReported,
lastFailureCode: this._lastFailureCode || null,
+ startLagMs: this._startLagMs,
+ startLeadInMs: this._startLeadInMs,
+ audioStartLeadInMs: this._audioStartLeadInMs,
});
} catch {}
@@ -1239,12 +1281,13 @@ export class WebCodecsRecorder {
// cleanup() nulls _videoStartUs, so this reads null once it has run. The
// finalize-time capture in WebCodecsTrackRecorder lands before that.
_effectiveOutputFps() {
- if (this._videoStartUs == null || !(this.frameCount > 0)) return null;
+ const startUs = this._videoArrivalUs ?? this._videoStartUs;
+ if (startUs == null || !(this.frameCount > 0)) return null;
let pausedUs = this.totalPausedDurationUs || 0;
if (this.paused && this.pauseStartUs != null) {
pausedUs += performance.now() * 1000 - this.pauseStartUs;
}
- const elapsedUs = performance.now() * 1000 - this._videoStartUs - pausedUs;
+ const elapsedUs = performance.now() * 1000 - startUs - pausedUs;
if (!(elapsedUs > 0)) return null;
return Math.round((this.frameCount / (elapsedUs / 1e6)) * 100) / 100;
}
@@ -1283,6 +1326,20 @@ export class WebCodecsRecorder {
startupBufferEngaged: this._startupBufferEngaged ?? null,
framesBufferedAtStart: this._framesBufferedAtStart ?? null,
adoptedWarmEncoder: this._adoptedPrewarmEncoder === true,
+ startLagMs: this._startLagMs,
+ startLeadInMs: this._startLeadInMs,
+ audioStartLeadInMs: this._audioStartLeadInMs,
+ };
+ }
+
+ // fps per 30 s window and whether the live encoder config asks for hardware.
+ // The config is the request: Chrome doesn't say what it really ran on.
+ getPerfSnapshot() {
+ const accel = this._activeVideoConfig?.hardwareAcceleration;
+ return {
+ fps: this._fpsWindows.snapshot(),
+ encodeHardware:
+ accel === "prefer-hardware" ? true : accel === "prefer-software" ? false : null,
};
}
@@ -1344,10 +1401,9 @@ export class WebCodecsRecorder {
getDiagSnapshot() {
let firstChunkLatencyMs = null;
- if (this._firstChunkAt != null && this._videoStartUs != null) {
- firstChunkLatencyMs = Math.round(
- this._firstChunkAt - this._videoStartUs / 1000,
- );
+ const arrivalUs = this._videoArrivalUs ?? this._videoStartUs;
+ if (this._firstChunkAt != null && arrivalUs != null) {
+ firstChunkLatencyMs = Math.round(this._firstChunkAt - arrivalUs / 1000);
}
return {
videoCodecString: this.actualVideoCodec || null,
@@ -2797,7 +2853,14 @@ export class WebCodecsRecorder {
{ codec: "avc1.42E028", containerCodec: "avc", hw: "prefer-software" },
];
- for (const c of candidates) {
+ // Past L4.2's coded-area limit (or above 30fps) the level must rise, or
+ // Chrome rejects the frame at encode time (configure() still passes).
+ const oversize = exceedsAvcL42(width, height) || fps > 30;
+
+ for (const candidate of candidates) {
+ const c = oversize
+ ? { ...candidate, codec: avcCodecForSize(candidate.codec, width, height, fps) }
+ : candidate;
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.
@@ -2805,6 +2868,17 @@ export class WebCodecsRecorder {
try {
supported = await VideoEncoder.isConfigSupported(config);
} catch {}
+ // configure() reports an unsupported size asynchronously, so a rung
+ // isConfigSupported refused would be selected and die with zero chunks.
+ // Only large frames skip on it.
+ if (oversize && supported && supported.supported === false) {
+ this._videoCodecConfigsTried.push({
+ codec: c.codec,
+ hw: c.hw,
+ succeeded: false,
+ });
+ continue;
+ }
const resolvedConfig =
supported?.supported && supported.config ? supported.config : config;
const test = new VideoEncoder({ output() {}, error() {} });
@@ -2845,7 +2919,16 @@ export class WebCodecsRecorder {
try { test.close(); } catch {}
}
}
- throw new Error("WebCodecsRecorder: No supported H.264 encoder");
+ const failure = new Error("WebCodecsRecorder: No supported H.264 encoder");
+ if (exceedsAvcL42(width, height)) {
+ failure.code = RESOLUTION_UNSUPPORTED_CODE;
+ failure.detail = {
+ width,
+ height,
+ tried: this._videoCodecConfigsTried.slice(),
+ };
+ }
+ throw failure;
}
// Geometry lives in letterbox.js; this just paints it.
@@ -2878,6 +2961,45 @@ export class WebCodecsRecorder {
this.resizeCtx.drawImage(frame, rect.x, rect.y, rect.w, rect.h);
}
+ // For a track that started before the epoch existed (screen, when a mic file
+ // follows). Before its first frame it behaves as if passed at start; after,
+ // the file can't be padded, so only the signed lag is recorded (negative =
+ // frame beat the epoch).
+ setStartEpoch(epochMs) {
+ if (!isValidStartEpochMs(epochMs) || this._startEpochUs != null) return;
+ this.options.startEpochMs = epochMs;
+ this._startEpochUs = epochMs * 1000;
+ if (this._videoStartUs != null) {
+ this._startLagMs = Math.round(
+ ((this._videoArrivalUs ?? this._videoStartUs) - this._startEpochUs) /
+ 1000,
+ );
+ this._startLeadInMs = 0;
+ return;
+ }
+ if (this.audioSamplesWritten === 0 && !this._audioDataEncoded) {
+ this._audioLeadInPending = true;
+ }
+ }
+
+ // Timeline zero is the epoch when usable (frame held from 0 to its arrival),
+ // else the first frame, real or stand-in.
+ _anchorVideoStart(nowUs) {
+ this._videoArrivalUs = nowUs;
+ if (this._startEpochUs != null) {
+ this._startLagMs = Math.round((nowUs - this._startEpochUs) / 1000);
+ }
+ const leadInUs = computeStartLeadInUs(this._startEpochUs, nowUs);
+ if (leadInUs == null) {
+ this._videoStartUs = nowUs;
+ if (this._startEpochUs != null) this._startLeadInMs = 0;
+ return;
+ }
+ this._videoStartUs = this._startEpochUs;
+ this._startLeadInMs = Math.round(leadInUs / 1000);
+ this._videoLeadInPending = true;
+ }
+
async readVideoLoop() {
this.log("[WCR] video loop start");
if (!this.videoReader || !this.videoEncoder) return;
@@ -3011,7 +3133,7 @@ export class WebCodecsRecorder {
}
ensureResizeCanvas();
if (this._videoStartUs == null) {
- this._videoStartUs = performance.now() * 1000;
+ this._anchorVideoStart(performance.now() * 1000);
}
isSynthetic = true;
this._syntheticFirstFrameCount += 1;
@@ -3052,7 +3174,7 @@ export class WebCodecsRecorder {
this.drawFrameToResizeCanvas(frame);
if (!this._videoStartUs) {
- this._videoStartUs = performance.now() * 1000;
+ this._anchorVideoStart(performance.now() * 1000);
perfMark("WCR.firstSourceFrame", {
w: frame.codedWidth,
h: frame.codedHeight,
@@ -3079,16 +3201,24 @@ export class WebCodecsRecorder {
// Filling the gap synchronously would overflow the encoder queue, so
// skip ahead to at most MAX_GAP_FRAMES behind. Skipped indices
// advance _videoFrameIndex to prevent repeated catch-up attempts.
+ // First frame after a lead-in: encode at 0 and hold to its arrival slot,
+ // not a tab-gap clamp. Muxer wrappers rebase the first PTS to 0, so only
+ // a long first sample keeps the offset. A dropped attempt retries from 0.
+ const holdUntilIndex =
+ this._videoLeadInPending && targetIndex > this._videoFrameIndex
+ ? targetIndex
+ : null;
+
const MAX_GAP_FRAMES = 8;
const gap = targetIndex - this._videoFrameIndex;
- if (gap > MAX_GAP_FRAMES) {
+ if (holdUntilIndex == null && gap > MAX_GAP_FRAMES) {
this.warn(`[WCR] skipping ${gap - MAX_GAP_FRAMES} frames (tab gap)`);
this._framesSkippedForGap += gap - MAX_GAP_FRAMES;
this._videoFrameIndex = targetIndex - MAX_GAP_FRAMES;
}
const startIndex = this._videoFrameIndex;
- const endIndex = targetIndex;
+ const endIndex = holdUntilIndex != null ? startIndex : targetIndex;
for (let i = startIndex; i <= endIndex; i += 1) {
const tsUs = i * frameDurationUs;
@@ -3150,13 +3280,17 @@ export class WebCodecsRecorder {
if (vQueueSize > effectiveQueueCap) {
this._droppedForBackpressureCount += 1;
this._forceNextKeyframe = true;
- this._videoFrameIndex = i + 1;
+ // A dropped lead-in hold leaves index 0 for the retry.
+ if (holdUntilIndex == null) this._videoFrameIndex = i + 1;
continue;
}
const resized = new VideoFrame(this.resizeCanvas, {
timestamp: tsUs,
- duration: frameDurationUs,
+ duration:
+ holdUntilIndex != null
+ ? (holdUntilIndex + 1 - i) * frameDurationUs
+ : frameDurationUs,
});
const keyFrame =
@@ -3180,7 +3314,7 @@ export class WebCodecsRecorder {
this.videoEncoder.state === "closed"
) {
resized.close();
- this._videoFrameIndex = i + 1;
+ if (holdUntilIndex == null) this._videoFrameIndex = i + 1;
this._forceNextKeyframe = true;
continue;
}
@@ -3201,7 +3335,7 @@ export class WebCodecsRecorder {
this.videoEncoder?.state === "closed"
) {
this.warn("[WCR] encode() race during pause; dropping frame");
- this._videoFrameIndex = i + 1;
+ if (holdUntilIndex == null) this._videoFrameIndex = i + 1;
this._forceNextKeyframe = true;
continue;
}
@@ -3214,7 +3348,7 @@ export class WebCodecsRecorder {
// at 16 a real reclaim looks like backpressure and silently
// skips the rebuild. Chrome names reclaims in the message.
if (isReclaimErrorMessage(encErr) || q <= 5) {
- this._videoFrameIndex = i + 1;
+ if (holdUntilIndex == null) this._videoFrameIndex = i + 1;
this._forceNextKeyframe = true;
this.warn(
"[WCR] encode() QuotaExceededError with near-empty queue; treating as encoder reclaim, rebuilding",
@@ -3225,7 +3359,7 @@ export class WebCodecsRecorder {
}
this._droppedForBackpressureCount += 1;
this._forceNextKeyframe = true;
- this._videoFrameIndex = i + 1;
+ if (holdUntilIndex == null) this._videoFrameIndex = i + 1;
this.warn(
"[WCR] encode() QuotaExceededError; dropping frame as backpressure",
);
@@ -3254,7 +3388,13 @@ export class WebCodecsRecorder {
});
}
this.frameCount++;
- this._videoFrameIndex = i + 1;
+ this._fpsWindows.tick(
+ this.frameCount,
+ performance.now() - (this.totalPausedDurationUs || 0) / 1000,
+ );
+ this._videoLeadInPending = false;
+ this._videoFrameIndex =
+ holdUntilIndex != null ? holdUntilIndex + 1 : i + 1;
} finally {
resized.close();
}
@@ -3506,6 +3646,76 @@ export class WebCodecsRecorder {
});
};
+ // Audio gets the same lead-in as its video, or padding video alone puts
+ // them out of sync. Silence runs from the epoch to firstStartUs (start of
+ // the first packet written). Skips the reconciler (isCatchUpSilence).
+ const padAudioLeadIn = (firstStartUs) => {
+ const leadInUs = computeStartLeadInUs(this._startEpochUs, firstStartUs);
+ if (this._startEpochUs != null) {
+ this._audioStartLeadInMs =
+ leadInUs == null ? 0 : Math.round(leadInUs / 1000);
+ }
+ if (leadInUs == null) return;
+ let remainingUs = leadInUs;
+ while (remainingUs >= 1000) {
+ const silent = makeSilentAudioData(
+ Math.min(SILENCE_CHUNK_MS, remainingUs / 1000),
+ );
+ // Read before close(): a closed AudioData reports 0 frames.
+ const silentUs = Math.round(
+ (silent.numberOfFrames * 1_000_000) / silent.sampleRate,
+ );
+ try {
+ encodeAudioData(silent, true);
+ } finally {
+ silent.close?.();
+ }
+ remainingUs -= silentUs;
+ }
+ };
+
+ // _prebufferedAudio packets are older than anything held, so they go first
+ // and count toward the length the start estimate subtracts.
+ const leadInHeld = [];
+ const leadInState = createAudioLeadInHoldState();
+ const packetLengthUs = (audioData) => {
+ const rate = audioData.sampleRate || this.audioSampleRate || 48000;
+ return Math.round(((audioData.numberOfFrames || 0) * 1_000_000) / rate);
+ };
+ const adoptPrebufferedIntoHold = () => {
+ if (!this._prebufferedAudio.length) return;
+ const older = this._prebufferedAudio.splice(0);
+ for (const packet of older) leadInState.heldUs += packetLengthUs(packet);
+ leadInHeld.unshift(...older);
+ };
+
+ const flushLeadInHold = (firstStartUs) => {
+ this._audioLeadInPending = false;
+ adoptPrebufferedIntoHold();
+ padAudioLeadIn(firstStartUs);
+ while (leadInHeld.length) {
+ const held = leadInHeld.shift();
+ try {
+ encodeAudioData(held);
+ } finally {
+ held.close?.();
+ }
+ }
+ };
+
+ const holdForLeadIn = (audioData) => {
+ const nowUs = performance.now() * 1000;
+ adoptPrebufferedIntoHold();
+ leadInHeld.push(audioData);
+ const flushNow = advanceAudioLeadInHold(
+ leadInState,
+ nowUs,
+ packetLengthUs(audioData),
+ leadInHeld.length,
+ );
+ if (flushNow) flushLeadInHold(leadInState.startUs);
+ };
+
// Lost AudioData (MSTP overflow under load) shortens the track with
// contiguous PTS, so everything after the loss plays early.
const AUDIO_DRIFT_WINDOW_US = 2_000_000;
@@ -3662,6 +3872,15 @@ export class WebCodecsRecorder {
continue;
}
try {
+ // Silence before delivery went live: first audio, or follows held.
+ if (this._audioLeadInPending) {
+ flushLeadInHold(
+ leadInState.startUs ??
+ performance.now() * 1000 -
+ SILENCE_CHUNK_MS * 1000 -
+ leadInState.heldUs,
+ );
+ }
const silent = makeSilentAudioData(SILENCE_CHUNK_MS);
try {
encodeAudioData(silent);
@@ -3763,6 +3982,10 @@ export class WebCodecsRecorder {
}
try {
+ if (this._audioLeadInPending) {
+ holdForLeadIn(audioData);
+ continue;
+ }
if (this._prebufferedAudio.length) {
while (this._prebufferedAudio.length) {
const buffered = this._prebufferedAudio.shift();
@@ -3786,6 +4009,17 @@ export class WebCodecsRecorder {
this.err("[WCR] audio loop error:", err);
}
+ if (leadInHeld.length) {
+ try {
+ if (this.audioEncoder && this.audioEncoder.state !== "closed") {
+ flushLeadInHold(leadInState.startUs);
+ }
+ } catch (err) {
+ this.warn("[WCR] lead-in flush failed", err);
+ }
+ for (const held of leadInHeld.splice(0)) held.close?.();
+ }
+
if (
this._paddedSilenceCount > 0 ||
this._injectedCatchUpSilenceEvents > 0 ||
diff --git a/src/pages/Recorder/webcodecs/startLeadIn.js b/src/pages/Recorder/webcodecs/startLeadIn.js
new file mode 100644
index 0000000..d1b1246
--- /dev/null
+++ b/src/pages/Recorder/webcodecs/startLeadIn.js
@@ -0,0 +1,52 @@
+// Shared start epoch for a multi-track take. CloudRecorder takes one
+// performance.now() reading and hands it to every WebCodecs video recorder
+// that starts after it; each pads its file front so the first frame sits at its
+// real offset. Without it a video file's zero is its own first frame, reached
+// after an async start chain (probe, muxer, configure) the mic doesn't wait for.
+// Tests: tests/unit/startLeadIn.test.mjs
+
+// Anything longer is a broken clock or a stalled start, not a lead-in.
+export const MAX_START_LEAD_IN_MS = 10_000;
+
+export const isValidStartEpochMs = (epochMs) =>
+ Number.isFinite(epochMs) && epochMs > 0;
+
+// Lead-in in microseconds for media starting at `startUs` (same clock as
+// `epochUs`). null = no lead-in (no epoch, negative gap, or past the cap).
+export const computeStartLeadInUs = (epochUs, startUs) => {
+ if (!Number.isFinite(epochUs) || !Number.isFinite(startUs)) return null;
+ const leadInUs = startUs - epochUs;
+ if (leadInUs < 0 || leadInUs > MAX_START_LEAD_IN_MS * 1000) return null;
+ return leadInUs;
+};
+
+export const LEAD_IN_MAX_HELD = 50;
+
+export const createAudioLeadInHoldState = () => ({
+ heldUs: 0,
+ startUs: null,
+ lastReadUs: null,
+});
+
+// Packets queued during encoder/muxer start drain in one burst, so read time
+// minus the first packet's length over-pads by its queue time. A packet is read
+// no earlier than it ends: read time minus everything held bounds the first
+// start from above, and the minimum over the run is the estimate. Live once a
+// read lands >= half a packet after the previous (queue drained) or at `maxHeld`.
+export const advanceAudioLeadInHold = (
+ state,
+ nowUs,
+ packetUs,
+ heldCount,
+ maxHeld = LEAD_IN_MAX_HELD,
+) => {
+ state.heldUs += packetUs;
+ const startUs = nowUs - state.heldUs;
+ if (state.startUs == null || startUs < state.startUs) {
+ state.startUs = startUs;
+ }
+ const live =
+ state.lastReadUs != null && nowUs - state.lastReadUs >= packetUs / 2;
+ state.lastReadUs = nowUs;
+ return live || heldCount >= maxHeld;
+};
diff --git a/src/pages/Region/Recorder.jsx b/src/pages/Region/Recorder.jsx
index 5fbde62..e8ceca7 100644
--- a/src/pages/Region/Recorder.jsx
+++ b/src/pages/Region/Recorder.jsx
@@ -37,12 +37,19 @@ import {
validateFastRecorderOutputBlob,
isFastRecorderFailureTransient,
} from "../../media/fastRecorderGate";
-import { getResolutionForQuality } from "../Recorder/recorderConfig";
+import {
+ getResolutionForQuality,
+ getFreeCaptureCaps,
+ resolveQualityValue,
+ resolveFps,
+} from "../Recorder/recorderConfig";
+import { avcCodecForSize } from "../../media/avcLevel";
import { chooseWriter } from "../Recorder/recorderStorage/chooseWriter";
import { chooseReader } from "../Recorder/recorderStorage/chooseReader";
import { lifecycle } from "../utils/lifecycleLog";
import { perfMark, perfSpan } from "../utils/perfMarks";
import { markStartProgress } from "../utils/startProgress";
+import { prewarmSpeedTest, prewarmSustainedEncode } from "../Recorder/prewarmSustained";
import localforage from "localforage";
import { activeChunksStore } from "../utils/chunkStores";
@@ -666,6 +673,12 @@ const Recorder = () => {
}
}
+ // Local Auto takes 4K only from a cached speed test, and this hidden iframe
+ // is the one place an unsubscribed user's device gets measured.
+ useEffect(() => {
+ prewarmSpeedTest(prewarmSustainedEncode);
+ }, []);
+
useEffect(() => {
window.parent.postMessage(
{
@@ -839,8 +852,12 @@ const Recorder = () => {
await chunksStore.clear();
try {
- const { qualityValue } = await chrome.storage.local.get(["qualityValue"]);
+ const { qualityValue: storedQuality } = await chrome.storage.local.get([
+ "qualityValue",
+ ]);
const { fpsValue } = await chrome.storage.local.get(["fpsValue"]);
+ const captureCaps = await getFreeCaptureCaps();
+ const qualityValue = resolveQualityValue(storedQuality, captureCaps);
const activeVideoTrack =
liveStream.current?.getVideoTracks?.()[0] ||
helperVideoStream.current?.getVideoTracks?.()[0] ||
@@ -859,8 +876,10 @@ const Recorder = () => {
: 1080;
let fps = Number.parseInt(fpsValue, 10);
if (!Number.isFinite(fps) || fps <= 0) {
- fps =
- Number.isFinite(trackSettings.frameRate) && trackSettings.frameRate > 0
+ fps = captureCaps.smoother
+ ? 60
+ : Number.isFinite(trackSettings.frameRate) &&
+ trackSettings.frameRate > 0
? Math.round(trackSettings.frameRate)
: 30;
}
@@ -2307,13 +2326,12 @@ const Recorder = () => {
try {
const endStorageReads = perfSpan("Region.Recorder storage.reads");
const { qualityValue } = await chrome.storage.local.get(["qualityValue"]);
- const { width, height } = getResolutionForQuality(qualityValue);
+ const captureCaps = await getFreeCaptureCaps();
+ const { width, height } = getResolutionForQuality(
+ resolveQualityValue(qualityValue, captureCaps),
+ );
const { fpsValue } = await chrome.storage.local.get(["fpsValue"]);
- let fps = parseInt(fpsValue);
-
- if (isNaN(fps)) {
- fps = 30;
- }
+ let fps = resolveFps(fpsValue, captureCaps);
endStorageReads();
let stream;
@@ -2519,7 +2537,12 @@ const Recorder = () => {
void startEncoderPrewarm({
width: warmW,
height: warmH,
- codec: probeConfig?.codec || "avc1.64002A",
+ codec: avcCodecForSize(
+ probeConfig?.codec || "avc1.64002A",
+ warmW,
+ warmH,
+ fps || 30,
+ ),
bitrate: Number(probeConfig?.bitrate) || 4_000_000,
framerate: Number(probeConfig?.framerate) || fps || 30,
});
diff --git a/src/pages/utils/captureSurface.js b/src/pages/utils/captureSurface.js
index a7eeb1c..dd2617b 100644
--- a/src/pages/utils/captureSurface.js
+++ b/src/pages/utils/captureSurface.js
@@ -27,3 +27,15 @@ export const setCapturedSurface = async (surface) => {
}
} catch {}
};
+
+// Region crops report surface "browser", so only this flag tells them from a
+// tab. Anything but true clears the key, so it can't leak into a later take.
+export const setCapturedRegion = async (isRegion) => {
+ try {
+ if (isRegion === true) {
+ await chrome.storage.local.set({ capturedRegion: true });
+ } else {
+ await chrome.storage.local.remove(["capturedRegion"]);
+ }
+ } catch {}
+};
diff --git a/src/pages/utils/perfMarks.js b/src/pages/utils/perfMarks.js
index e637053..f691e98 100644
--- a/src/pages/utils/perfMarks.js
+++ b/src/pages/utils/perfMarks.js
@@ -1,7 +1,7 @@
// Perf instrumentation; enabled in prod too (300-event-per-context
-// cap, 250ms debounced flush) so user diag zips have the full
-// stop→editor timing. Labels are hardcoded; payloads are caller ints/
-// strings. Console "[perf]" lines stay dev-only.
+// cap, 250ms debounced flush, 15s for progress-only batches) so user
+// diag zips have the full stop→editor timing. Labels are hardcoded;
+// payloads are caller ints/strings. Console "[perf]" lines stay dev-only.
const DEV = process.env.SCREENITY_DEV_MODE === "true";
const ENABLED = true;
@@ -15,6 +15,10 @@ const buildDevImpl = () => {
const STORAGE_KEY_BASE = "perfTimeline";
const MAX_EVENTS = 300;
const FLUSH_DEBOUNCE_MS = 250;
+ // Each flush rewrites the whole list and reaches every tab's onChanged
+ // listeners. Progress marks fire every second while recording, so a batch
+ // holding only those waits longer; any other mark pulls the flush forward.
+ const PROGRESS_FLUSH_MS = 15000;
const detectContext = () => {
try {
@@ -56,6 +60,7 @@ const buildDevImpl = () => {
const localBuf = [];
let lastMarkPerfNow = null;
let pendingFlush = null;
+ let pendingFlushAt = 0;
let writeChain = Promise.resolve();
let cachedSessionId = null;
@@ -86,12 +91,18 @@ const buildDevImpl = () => {
.catch(() => {});
};
- const scheduleFlush = () => {
- if (pendingFlush) return;
+ const scheduleFlush = (label) => {
+ const delay = isLowValueLabel(label) ? PROGRESS_FLUSH_MS : FLUSH_DEBOUNCE_MS;
+ const at = Date.now() + delay;
+ if (pendingFlush) {
+ if (pendingFlushAt <= at) return;
+ clearTimeout(pendingFlush);
+ }
+ pendingFlushAt = at;
pendingFlush = setTimeout(() => {
pendingFlush = null;
flushNow();
- }, FLUSH_DEBOUNCE_MS);
+ }, delay);
};
const emit = (label, meta) => {
@@ -130,7 +141,7 @@ const buildDevImpl = () => {
}
} catch {}
}
- scheduleFlush();
+ scheduleFlush(label);
};
const perfMarkImpl = (label, meta = null) => {
diff --git a/src/pages/utils/physicalScreenSize.js b/src/pages/utils/physicalScreenSize.js
new file mode 100644
index 0000000..975a756
--- /dev/null
+++ b/src/pages/utils/physicalScreenSize.js
@@ -0,0 +1,24 @@
+// Native display size for the resolution picker. availWidth/availHeight exclude
+// the menu bar and taskbar, so a 3840x2160 monitor reported under 2160 and 4K
+// stayed disabled. width/height times DPR gives physical pixels.
+// Tests: tests/unit/physicalScreenSize.test.mjs
+export function physicalScreenSize(screenLike, devicePixelRatio) {
+ const dpr =
+ Number.isFinite(devicePixelRatio) && devicePixelRatio > 0
+ ? devicePixelRatio
+ : 1;
+ const w = Number(screenLike?.width) || Number(screenLike?.availWidth) || 0;
+ const h = Number(screenLike?.height) || Number(screenLike?.availHeight) || 0;
+ return { width: Math.round(w * dpr), height: Math.round(h * dpr) };
+}
+
+// Chrome reports screen.width in CSS px at the current page zoom, and
+// devicePixelRatio includes that zoom, so the product is zoom-invariant (a
+// 1920x1080 display is 960x540 at dpr 2 when the page is 200%, 2400x1350 at
+// dpr 0.8 at 80%). No zoom input is needed; correcting for it would double
+// count. Fractional zoom rounds screen.width, so allow a small shortfall.
+export function screenFits(size, minWidth, minHeight, slack = 0.01) {
+ const w = Number(size?.width) || 0;
+ const h = Number(size?.height) || 0;
+ return w >= minWidth * (1 - slack) && h >= minHeight * (1 - slack);
+}
diff --git a/src/pages/utils/startAudioStream.js b/src/pages/utils/startAudioStream.js
index d7fc248..3e97b59 100644
--- a/src/pages/utils/startAudioStream.js
+++ b/src/pages/utils/startAudioStream.js
@@ -5,12 +5,63 @@
// bailOnNone: return null for a "none"/empty id (Recorder)
// bluetoothDiag: diag-forward when the mic comes up at a low sample rate (Recorder)
// toastOnBlocked: toast when even the generic fallback fails (CloudRecorder)
+// separatedMic: the mic is its own file, so ask Chrome to skip noise suppression and AGC
// logger: optional { debug, warn } for dev breadcrumbs
import { getUserMediaWithFallback } from "./mediaDeviceFallback";
+// Chrome's noise-suppression and AGC stage runs ahead of us and can chop speech,
+// so both are off for a separated mic. Echo cancellation stays on: on speakers
+// the mic file would otherwise carry the demo audio. The combined path keeps
+// the defaults.
+export const RAW_MIC_PROCESSING = {
+ echoCancellation: true,
+ noiseSuppression: false,
+ autoGainControl: false,
+};
+
+// FNV-1a: enough to tell two devices apart in telemetry without shipping the id.
+const hashId = (id) => {
+ let h = 0x811c9dc5;
+ const str = String(id || "");
+ for (let i = 0; i < str.length; i += 1) {
+ h ^= str.charCodeAt(i);
+ h = Math.imul(h, 0x01000193) >>> 0;
+ }
+ return h.toString(16).padStart(8, "0");
+};
+
+// What Chrome applied, read back from the track. constraintsHonored is false
+// when any setting differs from the request.
+export const describeMicSettings = (stream, requested = null) => {
+ const track = stream?.getAudioTracks?.()[0];
+ if (!track) return null;
+ const s = track.getSettings?.() || {};
+ const out = {
+ sampleRate: s.sampleRate ?? null,
+ channelCount: s.channelCount ?? null,
+ deviceIdHash: s.deviceId ? hashId(s.deviceId) : null,
+ label: String(track.label || "").slice(0, 60) || null,
+ autoGainControl: s.autoGainControl ?? null,
+ echoCancellation: s.echoCancellation ?? null,
+ noiseSuppression: s.noiseSuppression ?? null,
+ };
+ if (requested) {
+ out.constraintsHonored = Object.keys(requested).every(
+ (key) => s[key] === requested[key],
+ );
+ }
+ return out;
+};
+
export async function startAudioStream(
id,
- { bailOnNone = false, bluetoothDiag = false, toastOnBlocked = false, logger = null } = {},
+ {
+ bailOnNone = false,
+ bluetoothDiag = false,
+ toastOnBlocked = false,
+ separatedMic = false,
+ logger = null,
+ } = {},
) {
logger?.debug?.("startAudioStream()", { id });
@@ -21,9 +72,12 @@ export async function startAudioStream(
}
const useExact = id && id !== "none";
+ const processing = separatedMic ? RAW_MIC_PROCESSING : null;
const audioStreamOptions = {
mimeType: "video/webm;codecs=vp8,opus",
- audio: useExact ? { deviceId: { exact: id } } : true,
+ audio: useExact
+ ? { deviceId: { exact: id }, ...processing }
+ : processing || true,
};
const { defaultAudioInputLabel, audioinput } = await chrome.storage.local.get([
@@ -56,6 +110,17 @@ export async function startAudioStream(
: [],
});
+ if (separatedMic && stream) {
+ const applied = describeMicSettings(stream, RAW_MIC_PROCESSING);
+ const honored = applied?.constraintsHonored;
+ (honored ? console.info : console.warn)(
+ honored
+ ? "[startAudioStream] separated mic applied"
+ : "[startAudioStream] Chrome kept mic processing on despite the request",
+ applied,
+ );
+ }
+
if (bluetoothDiag && stream) {
// BT mic switches A2DP (48k) to HFP (8/16k mono); the 48k AudioContext then upsamples garbage.
try {
@@ -82,7 +147,9 @@ export async function startAudioStream(
} catch (err) {
logger?.warn?.("startAudioStream() exact device failed, retrying generic", err);
try {
- return await navigator.mediaDevices.getUserMedia({ audio: true });
+ return await navigator.mediaDevices.getUserMedia({
+ audio: processing || true,
+ });
} catch (err2) {
logger?.warn?.("startAudioStream() failed completely", err2);
if (toastOnBlocked) {
diff --git a/src/pages/utils/startFlowTrace.js b/src/pages/utils/startFlowTrace.js
index 6931026..bba77d1 100644
--- a/src/pages/utils/startFlowTrace.js
+++ b/src/pages/utils/startFlowTrace.js
@@ -198,6 +198,44 @@ export const submitDiagnosticReport = async (trigger) => {
}
};
+let lastIgnoredReportAt = 0;
+const IGNORED_REPORT_COOLDOWN_MS = 10000;
+
+/**
+ * Report a Start click the double-click guard swallowed. Own event, not the
+ * stored trace (that belongs to the attempt still in flight). Throttled so a
+ * mashed button is one report.
+ */
+export const reportIgnoredStartClick = async ({
+ reason,
+ pendingAgeMs,
+ recordingType,
+}) => {
+ try {
+ const now = Date.now();
+ if (now - lastIgnoredReportAt < IGNORED_REPORT_COOLDOWN_MS) return;
+ lastIgnoredReportAt = now;
+
+ const res = await chrome.storage.local.get(["isSubscribed", "isLoggedIn"]);
+ if (!res.isSubscribed || !res.isLoggedIn) return;
+
+ chrome.runtime
+ .sendMessage({
+ type: "submit-diagnostic-report",
+ event: {
+ attemptId: `ig-${now.toString(36)}-${Math.random().toString(36).slice(2, 8)}`,
+ trigger: "ignored",
+ outcome: "ignored",
+ stage: "start-click-ignored",
+ reason,
+ pendingAgeMs,
+ recordingType: recordingType || null,
+ },
+ })
+ .catch(() => {});
+ } catch {}
+};
+
/** Format the trace as a compact human-readable timeline. */
export const formatStartFlowTimeline = (trace) => {
if (!trace?.t) return null;
diff --git a/src/pages/utils/systemAudioGuidance.js b/src/pages/utils/systemAudioGuidance.js
index e80ffd3..35a7cfc 100644
--- a/src/pages/utils/systemAudioGuidance.js
+++ b/src/pages/utils/systemAudioGuidance.js
@@ -2,6 +2,10 @@ import { shouldUseDisplayMediaForScreen } from "./screenCaptureMode";
let sent = false;
+// Camera-only has no computer audio to share, so the guidance doesn't apply.
+export const hasComputerAudioToShare = (recordingType) =>
+ recordingType !== "camera";
+
// Offscreen screen recordings can't show the "record computer audio" warning
// directly, so trigger the same component in the content script (via the SW),
// passing the variant. Fires once per recorder document.
@@ -10,8 +14,9 @@ export const sendSystemAudioGuidanceToast = () => {
sent = true;
const isMac = navigator.userAgent.indexOf("Mac") !== -1;
chrome.storage.local.get(
- ["forceDisplayMediaScreen", "macSystemAudioCapture"],
- ({ forceDisplayMediaScreen, macSystemAudioCapture }) => {
+ ["forceDisplayMediaScreen", "macSystemAudioCapture", "recordingType"],
+ ({ forceDisplayMediaScreen, macSystemAudioCapture, recordingType }) => {
+ if (!hasComputerAudioToShare(recordingType)) return;
const useDisplayMedia = shouldUseDisplayMediaForScreen({
forceDisplayMediaScreen,
macSystemAudioCapture,
diff --git a/src/pages/utils/writeCoalescer.js b/src/pages/utils/writeCoalescer.js
new file mode 100644
index 0000000..bc7ca28
--- /dev/null
+++ b/src/pages/utils/writeCoalescer.js
@@ -0,0 +1,57 @@
+// Rate-limits a storage write that is requested far more often than its data
+// is read. Every chrome.storage.local write is delivered to the onChanged
+// listeners of every open tab, so progress-only writes are worth batching.
+//
+// request() runs the write now if none ran in the last minIntervalMs, else once
+// at the end of that window. noteWrite() records a write made elsewhere that
+// already carried the same state, so a pending one is dropped. Pure, so
+// tests/unit can drive it with fake timers.
+export const createWriteCoalescer = ({
+ minIntervalMs,
+ run,
+ now = () => Date.now(),
+ setTimer = (fn, ms) => setTimeout(fn, ms),
+ clearTimer = (id) => clearTimeout(id),
+}) => {
+ let lastRunAt = null;
+ let timer = null;
+ let pending = false;
+
+ const clear = () => {
+ if (timer === null) return;
+ clearTimer(timer);
+ timer = null;
+ };
+
+ const fire = () => {
+ timer = null;
+ if (!pending) return;
+ pending = false;
+ lastRunAt = now();
+ run();
+ };
+
+ return {
+ request() {
+ pending = true;
+ if (timer !== null) return;
+ const wait = lastRunAt === null ? 0 : lastRunAt + minIntervalMs - now();
+ if (wait <= 0) fire();
+ else timer = setTimer(fire, wait);
+ },
+ noteWrite() {
+ lastRunAt = now();
+ pending = false;
+ clear();
+ },
+ flush() {
+ clear();
+ fire();
+ },
+ cancel() {
+ pending = false;
+ clear();
+ },
+ isPending: () => pending,
+ };
+};
diff --git a/webpack.config.js b/webpack.config.js
index 0f9f776..b45c346 100755
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -302,6 +302,9 @@ const config = {
"process.env.RECORDING_WARNING_THRESHOLD": JSON.stringify(
process.env.RECORDING_WARNING_THRESHOLD || 60 // Default to 1 minute
),
+ "process.env.ENABLE_LIVE_TRANSCRIPTION": JSON.stringify(
+ process.env.ENABLE_LIVE_TRANSCRIPTION || ""
+ ),
"process.env.SCREENITY_DEV_MODE": JSON.stringify(
process.env.SCREENITY_DEV_MODE || ""
),
@@ -360,6 +363,13 @@ const config = {
to: path.join(__dirname, "build/_locales"),
force: true,
},
+ // AudioWorklet modules load by URL and run without the webpack
+ // runtime, so this one is copied rather than bundled.
+ {
+ from: "src/pages/Recorder/audioGapWorklet.js",
+ to: path.join(__dirname, "build/audioGapWorklet.js"),
+ force: true,
+ },
{
from: "THIRD_PARTY_NOTICES.md",
to: path.join(__dirname, "build/THIRD_PARTY_NOTICES.md"),