fixed stream resolution and framerate selection

This commit is contained in:
kaitlynkittyy 2024-04-08 18:29:01 -04:00
parent f18051e87c
commit ae9b4b52cf
2 changed files with 29 additions and 27 deletions

View file

@ -88,6 +88,7 @@ addPatch({
bitrateMax: 8000000, bitrateMax: 8000000,
bitrateTarget: 600000 bitrateTarget: 600000
}); });
// I DONT KNOW WHY THIS HAS TO BE HERE BUT WITHOUT IT NOTHING WORKS RIGHT ( BITRATE GETS SET TO 4000KBPS )
Object.assign(opts.capture, { Object.assign(opts.capture, {
framerate, framerate,
width, width,
@ -239,7 +240,7 @@ function StreamSettings({
type="radio" type="radio"
name="contenthint" name="contenthint"
value="motion" value="motion"
checked={settings.contentHint === "moiton"} checked={settings.contentHint === "motion"}
onChange={() => setSettings(s => ({ ...s, contentHint: "motion" }))} onChange={() => setSettings(s => ({ ...s, contentHint: "motion" }))}
/> />
</label> </label>
@ -398,7 +399,8 @@ function ModalComponent({
// If there are 2 connections, the second one is the existing stream. // If there are 2 connections, the second one is the existing stream.
// In that case, we patch its quality // In that case, we patch its quality
const conn = [...MediaEngineStore.getMediaEngine().connections][1]; const conn = [...MediaEngineStore.getMediaEngine().connections][1];
if (conn && conn.videoStreamParameters.length > 0) { try {
if (conn.streamUserId === UserStore.getCurrentUser().id) {
const track = conn.input.stream.getVideoTracks()[0]; const track = conn.input.stream.getVideoTracks()[0];
const frameRate = Number(settings.fps); const frameRate = Number(settings.fps);
const height = Number(settings.resolution); const height = Number(settings.resolution);
@ -407,21 +409,23 @@ function ModalComponent({
const newConstraints = { const newConstraints = {
...constraints, ...constraints,
frameRate, frameRate,
width: { ideal: width },
height: { ideal: height },
advanced: [{ width: width, height: height }] advanced: [{ width: width, height: height }]
}; };
track.applyConstraints(newConstraints).then(() => { track.applyConstraints(newConstraints).then(() => {
console.log("Applied constraints successfully"); console.log("Applied constraints from ScreenSharePicker successfully.");
console.log("New settings:", track.getSettings()); console.log("New constraints:", track.getConstraints());
}); });
} }
} catch {
console.log("No current stream.");
}
if (!conn) {
submit({ submit({
id: selected!, id: selected!,
...settings ...settings
}); });
}
close(); close();
}} }}

View file

@ -34,14 +34,12 @@ if (isLinux) {
const newConstraints = { const newConstraints = {
...constraints, ...constraints,
frameRate, frameRate,
width: { ideal: width },
height: { ideal: height },
advanced: [{ width: width, height: height }] advanced: [{ width: width, height: height }]
}; };
track.applyConstraints(newConstraints).then(() => { track.applyConstraints(newConstraints).then(() => {
console.log("Applied constraints successfully"); console.log("Applied constraints from ScreenShareFixes successfully.");
console.log("New settings:", track.getSettings()); console.log("New constraints:", track.getConstraints());
}); });
if (id) { if (id) {