diff --git a/src/renderer/components/ScreenSharePicker.tsx b/src/renderer/components/ScreenSharePicker.tsx
index fcf7e29..e12d28f 100644
--- a/src/renderer/components/ScreenSharePicker.tsx
+++ b/src/renderer/components/ScreenSharePicker.tsx
@@ -36,6 +36,7 @@ interface StreamSettings {
fps: StreamFps;
audio: boolean;
audioSource?: string;
+ contentHint?: string;
workaround?: boolean;
}
@@ -49,7 +50,7 @@ interface Source {
url: string;
}
-let currentSettings: StreamSettings | null = null;
+export let currentSettings: StreamSettings | null = null;
addPatch({
patches: [
@@ -179,7 +180,7 @@ function StreamSettings({
deps: [source.id]
}
);
-
+ // the source's name is not properly being displayed
return (
What you're streaming
@@ -228,7 +229,39 @@ function StreamSettings({
-
+
+ Content Type
+
+
+
+
+
+
+
+ Choosing "Prefer Clarity" will significantly lower framerate in exchange for a clearer
+ image.
+
+
+
+
{isWindows && (
({
resolution: "1080",
fps: "60",
+ contentHint: "motion",
audio: true
});
@@ -361,22 +395,26 @@ function ModalComponent({
disabled={!selected}
onClick={() => {
currentSettings = settings;
-
// If there are 2 connections, the second one is the existing stream.
// In that case, we patch its quality
const conn = [...MediaEngineStore.getMediaEngine().connections][1];
if (conn && conn.videoStreamParameters.length > 0) {
+ const track = conn.input.stream.getVideoTracks()[0];
+ const frameRate = Number(settings.fps);
const height = Number(settings.resolution);
const width = Math.round(height * (16 / 9));
- Object.assign(conn.videoStreamParameters[0], {
- maxFrameRate: Number(settings.fps),
- maxPixelCount: width * height,
- maxBitrate: 8000000,
- maxResolution: {
- type: "fixed",
- width,
- height
- }
+ var constraints = track.getConstraints();
+ const newConstraints = {
+ ...constraints,
+ frameRate,
+ width: { ideal: width },
+ height: { ideal: height },
+ advanced: [{ width: width, height: height }]
+ };
+
+ track.applyConstraints(newConstraints).then(() => {
+ console.log("Applied constraints successfully");
+ console.log("New settings:", track.getSettings());
});
}
diff --git a/src/renderer/components/screenSharePicker.css b/src/renderer/components/screenSharePicker.css
index 356a1ca..1a1ed84 100644
--- a/src/renderer/components/screenSharePicker.css
+++ b/src/renderer/components/screenSharePicker.css
@@ -122,3 +122,10 @@
.vcd-screen-picker-audio {
margin-bottom: 0;
}
+
+.vcd-screen-picker-hint-description {
+ font-size: 14px;
+ color: var(--interactive-active);
+ width: 100%;
+
+}
\ No newline at end of file
diff --git a/src/renderer/patches/index.ts b/src/renderer/patches/index.ts
index 7d4c4b3..1e74e6f 100644
--- a/src/renderer/patches/index.ts
+++ b/src/renderer/patches/index.ts
@@ -7,6 +7,6 @@
// TODO: Possibly auto generate glob if we have more patches in the future
import "./enableNotificationsByDefault";
import "./platformClass";
-import "./screenShareAudio";
+import "./screenShareFixes";
import "./spellCheck";
import "./windowsTitleBar";
diff --git a/src/renderer/patches/screenShareAudio.ts b/src/renderer/patches/screenShareFixes.ts
similarity index 60%
rename from src/renderer/patches/screenShareAudio.ts
rename to src/renderer/patches/screenShareFixes.ts
index 3b926c3..4fe6049 100644
--- a/src/renderer/patches/screenShareAudio.ts
+++ b/src/renderer/patches/screenShareFixes.ts
@@ -4,6 +4,7 @@
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
+import { currentSettings } from "renderer/components/ScreenSharePicker";
import { isLinux } from "renderer/utils";
if (isLinux) {
@@ -23,6 +24,26 @@ if (isLinux) {
const stream = await original.call(this, opts);
const id = await getVirtmic();
+ const frameRate = Number(currentSettings?.fps);
+ const height = Number(currentSettings?.resolution);
+ const width = Math.round(height * (16 / 9));
+ var track = stream.getVideoTracks()[0];
+
+ track.contentHint = String(currentSettings?.contentHint);
+ var constraints = track.getConstraints();
+ const newConstraints = {
+ ...constraints,
+ frameRate,
+ width: { ideal: width },
+ height: { ideal: height },
+ advanced: [{ width: width, height: height }]
+ };
+
+ track.applyConstraints(newConstraints).then(() => {
+ console.log("Applied constraints successfully");
+ console.log("New settings:", track.getSettings());
+ });
+
if (id) {
const audio = await navigator.mediaDevices.getUserMedia({
audio: {