Skip to content

Commit f6c7a60

Browse files
committed
chore: hardcoded canvas values moved to appconfig
1 parent 5314c1e commit f6c7a60

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

apps/client/public/appsettings.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
window.appSettings = {
2-
relayUrl: 'https://timetravel.moqtail.dev:4445',
2+
relayUrl: 'https://localhost:4433',
33
wsUrl: 'http://localhost:3001',
44
wsPath: '/ws',
55
posthog_host: 'https://eu.i.posthog.com',
@@ -53,4 +53,12 @@ window.appSettings = {
5353
targetLatencyMs: 100,
5454
maxLatencyMs: 1000,
5555
},
56+
canvasResolutionConfig: {
57+
screenshare: {
58+
defaultWidth: 1280,
59+
defaultHeight: 720,
60+
maxWidth: 2560,
61+
maxHeight: 1440,
62+
},
63+
},
5664
}

apps/client/src/pages/SessionPage.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,12 +2134,19 @@ function SessionPage() {
21342134
const screenHeight = window.innerHeight
21352135
const dpr = window.devicePixelRatio || 1
21362136

2137-
const maxWidth = Math.min(screenWidth * dpr, 2560)
2138-
const maxHeight = Math.min(screenHeight * dpr, 1440)
2137+
const maxWidth = Math.min(screenWidth * dpr, window.appSettings.canvasResolutionConfig.screenshare.maxWidth)
2138+
const maxHeight = Math.min(
2139+
screenHeight * dpr,
2140+
window.appSettings.canvasResolutionConfig.screenshare.maxHeight,
2141+
)
21392142

21402143
resizeCanvasWorker(canvasRef.current, maxWidth, maxHeight)
21412144
} else {
2142-
resizeCanvasWorker(canvasRef.current, 1280, 720)
2145+
resizeCanvasWorker(
2146+
canvasRef.current,
2147+
window.appSettings.canvasResolutionConfig.screenshare.defaultWidth,
2148+
window.appSettings.canvasResolutionConfig.screenshare.defaultHeight,
2149+
)
21432150
}
21442151
}
21452152
})

apps/client/src/types/AppSettings.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,12 @@ export interface AppSettings {
3535
targetLatencyMs: number
3636
maxLatencyMs: number
3737
}
38+
canvasResolutionConfig: {
39+
screenshare: {
40+
defaultWidth: number
41+
defaultHeight: number
42+
maxWidth: number
43+
maxHeight: number
44+
}
45+
}
3846
}

0 commit comments

Comments
 (0)