Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ui/src/SettingDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const SettingDialog = ({open, setOpen, updateName, saveSettings}: Setting
setOpen(false);
};

const {name, preferCodec, displayMode, framerate} = settingsInput;
const {name, preferCodec, displayMode, framerate, width} = settingsInput;

return (
<Dialog open={open} onClose={() => setOpen(false)} maxWidth={'xs'} fullWidth>
Expand Down Expand Up @@ -111,6 +111,15 @@ export const SettingDialog = ({open, setOpen, updateName, saveSettings}: Setting
fullWidth
/>
</Box>
<Box sx={{paddingTop: 1}}>
<NumberField
label="Width (px)"
min={1}
onChange={(width) => setSettingsInput((c) => ({...c, width}))}
value={width}
fullWidth
/>
</Box>
</form>
</DialogContent>
<DialogActions>
Expand Down
3 changes: 3 additions & 0 deletions ui/src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface Settings {
displayMode: VideoDisplayMode;
preferCodec?: PreferredCodec;
framerate: number;
width: number;
}
export interface PreferredCodec {
mimeType: string;
Expand All @@ -59,6 +60,7 @@ export const loadSettings = (): Settings => {
const defaults: Settings = {
displayMode: VideoDisplayMode.FitToWindow,
framerate: 30,
width: 1920,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default should be unlimited, meaning no width set on the getDisplayMedia query. Screego is optimized for code sharing and having the highest resolution should be the default.

There should also be a way to limit by height. So there should be two settings "Max Stream Width (px)" and "Max Stream Height (px)" where empty means no limit.

};

if (settings && typeof settings === 'object') {
Expand All @@ -69,6 +71,7 @@ export const loadSettings = (): Settings => {
Object.values(VideoDisplayMode).find((mode) => mode === settings.displayMode) ??
defaults.displayMode,
preferCodec: settings.preferCodec ?? CodecDefault,
width: settings.width ?? defaults.width,
};
}
return defaults;
Expand Down
5 changes: 4 additions & 1 deletion ui/src/useRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,10 @@ export const useRoom = (config: UIConfig): UseRoom => {
}
try {
stream.current = await navigator.mediaDevices.getDisplayMedia({
video: {frameRate: loadSettings().framerate},
video: {
frameRate: loadSettings().framerate,
width: { ideal: loadSettings().width, max: loadSettings().width }
},
audio: {
echoCancellation: false,
autoGainControl: false,
Expand Down
Loading