Skip to content

Commit 2e9bb61

Browse files
committed
Resolution toggle fix
1 parent 19ae779 commit 2e9bb61

File tree

5 files changed

+24
-57
lines changed

5 files changed

+24
-57
lines changed

build/contentScript.bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"description":"__MSG_extDesc__","version":"3.1.15","manifest_version":3,"name":"__MSG_extName__","default_locale":"en","background":{"service_worker":"background.bundle.js"},"action":{"default_icon":"assets/img/icon-34.png"},"icons":{"128":"assets/img/icon-128.png"},"host_permissions":["<all_urls>"],"content_scripts":[{"matches":["<all_urls>"],"js":["contentScript.bundle.js"],"css":["assets/fonts/fonts.css"]}],"web_accessible_resources":[{"resources":["content.styles.css","blank.mp4","playground.html","editor.html","assets/*","setup.html","worker.js","vendor/*","recorder.html","recorderoffscreen.html","sandbox.html","wrapper.html","camera.html","permissions.html","region.html","waveform.html","playground.html","editorfallback.html","download.html","*"],"matches":["<all_urls>"]}],"oauth2":{"client_id":"560517327251-m7n1k3kddknu7s9s4ejvrs1bj91gutd7.apps.googleusercontent.com","scopes":["https://www.googleapis.com/auth/drive.file"]},"cross_origin_embedder_policy":{"value":"require-corp"},"cross_origin_opener_policy":{"value":"same-origin"},"content_security_policy":{"sandbox":"sandbox allow-scripts allow-modals allow-popups; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob:; object-src 'self';worker-src 'self' blob: ;","extension_pages":"script-src 'self' 'wasm-unsafe-eval'; object-src 'self'; media-src 'self' data: blob: *;"},"sandbox":{"pages":["editor.html"]},"commands":{"start-recording":{"suggested_key":{"default":"Alt+Shift+G"},"description":"Start recording"},"cancel-recording":{"suggested_key":{"default":"Alt+Shift+X"},"description":"Cancel recording"},"pause-recording":{"suggested_key":{"default":"Alt+Shift+M"},"description":"Pause/Resume recording"}},"permissions":["identity","activeTab","storage","unlimitedStorage","downloads","tabs","tabCapture","scripting"],"optional_permissions":["offscreen","desktopCapture","alarms"]}
1+
{"description":"__MSG_extDesc__","version":"3.1.16","manifest_version":3,"name":"__MSG_extName__","default_locale":"en","background":{"service_worker":"background.bundle.js"},"action":{"default_icon":"assets/img/icon-34.png"},"icons":{"128":"assets/img/icon-128.png"},"host_permissions":["<all_urls>"],"content_scripts":[{"matches":["<all_urls>"],"js":["contentScript.bundle.js"],"css":["assets/fonts/fonts.css"]}],"web_accessible_resources":[{"resources":["content.styles.css","blank.mp4","playground.html","editor.html","assets/*","setup.html","worker.js","vendor/*","recorder.html","recorderoffscreen.html","sandbox.html","wrapper.html","camera.html","permissions.html","region.html","waveform.html","playground.html","editorfallback.html","download.html","*"],"matches":["<all_urls>"]}],"oauth2":{"client_id":"560517327251-m7n1k3kddknu7s9s4ejvrs1bj91gutd7.apps.googleusercontent.com","scopes":["https://www.googleapis.com/auth/drive.file"]},"cross_origin_embedder_policy":{"value":"require-corp"},"cross_origin_opener_policy":{"value":"same-origin"},"content_security_policy":{"sandbox":"sandbox allow-scripts allow-modals allow-popups; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob:; object-src 'self';worker-src 'self' blob: ;","extension_pages":"script-src 'self' 'wasm-unsafe-eval'; object-src 'self'; media-src 'self' data: blob: *;"},"sandbox":{"pages":["editor.html"]},"commands":{"start-recording":{"suggested_key":{"default":"Alt+Shift+G"},"description":"Start recording"},"cancel-recording":{"suggested_key":{"default":"Alt+Shift+X"},"description":"Cancel recording"},"pause-recording":{"suggested_key":{"default":"Alt+Shift+M"},"description":"Pause/Resume recording"}},"permissions":["identity","activeTab","storage","unlimitedStorage","downloads","tabs","tabCapture","scripting"],"optional_permissions":["offscreen","desktopCapture","alarms"]}

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "__MSG_extName__",
44
"description": "__MSG_extDesc__",
55
"default_locale": "en",
6-
"version": "3.1.15",
6+
"version": "3.1.16",
77
"background": {
88
"service_worker": "background.bundle.js"
99
},

src/pages/Content/context/ContentState.jsx

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,30 +1028,20 @@ const ContentState = (props) => {
10281028

10291029
// Check if user has enough RAM to record for each quality option
10301030
useEffect(() => {
1031-
const checkQuality = () => {
1032-
const width = Math.round(window.screen.width * window.devicePixelRatio);
1033-
const height = Math.round(window.screen.height * window.devicePixelRatio);
1034-
const ram = Number(navigator.deviceMemory) || 4; // fallback to 4GB if unknown
1031+
const width = Math.round(window.screen.width * window.devicePixelRatio);
1032+
const height = Math.round(window.screen.height * window.devicePixelRatio);
1033+
const ram = Number(navigator.deviceMemory) || 4;
10351034

1035+
if (!contentState.qualityValue) {
10361036
let suggested = "480p";
1037-
if (ram >= 8 && width >= 3840 && height >= 2160) {
1038-
suggested = "4k";
1039-
} else if (ram >= 4 && width >= 1920 && height >= 1080) {
1040-
suggested = "1080p";
1041-
} else if (ram >= 2 && width >= 1280 && height >= 720) {
1042-
suggested = "720p";
1043-
}
1044-
1045-
if (contentState.qualityValue !== suggested) {
1046-
setContentState((prev) => ({ ...prev, qualityValue: suggested }));
1047-
chrome.storage.local.set({ qualityValue: suggested });
1048-
}
1049-
};
1037+
if (ram >= 8 && width >= 3840 && height >= 2160) suggested = "4k";
1038+
else if (ram >= 4 && width >= 1920 && height >= 1080) suggested = "1080p";
1039+
else if (ram >= 2 && width >= 1280 && height >= 720) suggested = "720p";
10501040

1051-
checkQuality();
1052-
window.addEventListener("resize", checkQuality);
1053-
return () => window.removeEventListener("resize", checkQuality);
1054-
}, [contentState.qualityValue, setContentState]);
1041+
setContentState((prev) => ({ ...prev, qualityValue: suggested }));
1042+
chrome.storage.local.set({ qualityValue: suggested });
1043+
}
1044+
}, []);
10551045

10561046
// Check recording start time
10571047
useEffect(() => {

src/pages/Content/popup/layout/SettingsMenu.jsx

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,6 @@ const SettingsMenu = (props) => {
3333
}
3434
}, []);
3535

36-
// Check if user has enough RAM to record for each quality option
37-
useEffect(() => {
38-
if (width === 0 || height === 0) return;
39-
40-
const checkSpecs = () => {
41-
const ram = navigator.deviceMemory || 4; // assume mid-range if unknown
42-
let newQuality = contentState.qualityValue;
43-
44-
if (ram >= 8 && width >= 3840 && height >= 2160) {
45-
newQuality = "4k";
46-
} else if (ram >= 4 && width >= 1920 && height >= 1080) {
47-
newQuality = "1080p";
48-
} else if (ram >= 2 && width >= 1280 && height >= 720) {
49-
newQuality = "720p";
50-
} else {
51-
newQuality = "480p";
52-
}
53-
54-
// Only update if value changes
55-
if (newQuality !== contentState.qualityValue) {
56-
setContentState((prev) => ({ ...prev, qualityValue: newQuality }));
57-
chrome.storage.local.set({ qualityValue: newQuality });
58-
}
59-
60-
setRAM(ram);
61-
};
62-
63-
checkSpecs();
64-
}, [contentState.qualityValue, width, height]);
65-
6636
const handleTroubleshooting = () => {
6737
if (typeof contentState.openModal === "function") {
6838
contentState.openModal(
@@ -137,10 +107,17 @@ const SettingsMenu = (props) => {
137107
};
138108

139109
useEffect(() => {
140-
setWidth(Math.round(window.screen.width * window.devicePixelRatio));
141-
setHeight(Math.round(window.screen.height * window.devicePixelRatio));
142-
}, []);
110+
// More accurate screen detection
111+
const w = window.screen.availWidth * window.devicePixelRatio;
112+
const h = window.screen.availHeight * window.devicePixelRatio;
113+
setWidth(Math.round(w));
114+
setHeight(Math.round(h));
143115

116+
// Fix RAM detection on macOS
117+
const isMac = navigator.userAgent.includes("Macintosh");
118+
const ram = isMac ? 32 : Number(navigator.deviceMemory) || 4;
119+
setRAM(ram);
120+
}, []);
144121
return (
145122
<DropdownMenu.Root
146123
open={props.open}

0 commit comments

Comments
 (0)