Fixed changing stream quality description
This commit is contained in:
parent
b9b336126a
commit
c34533295c
1 changed files with 31 additions and 19 deletions
|
@ -442,6 +442,11 @@ function ModalComponent({
|
|||
console.log("Applied constraints from ScreenSharePicker successfully.");
|
||||
console.log("New constraints:", track.getConstraints());
|
||||
});
|
||||
|
||||
// changing stream quality description
|
||||
conn.videoStreamParameters[0].maxFrameRate = Number(settings.fps);
|
||||
conn.videoStreamParameters[0].maxResolution.height = Number(settings.resolution);
|
||||
conn.videoStreamParameters[0].maxResolution.width = Math.round(height * (16 / 9));
|
||||
}
|
||||
} catch {
|
||||
console.log("No current stream.");
|
||||
|
@ -454,6 +459,7 @@ function ModalComponent({
|
|||
|
||||
// reapply contraints after some time to let discord resubmit stream
|
||||
// i believe there MUST be way to do it cleaner..
|
||||
if (conn) {
|
||||
setTimeout(() => {
|
||||
console.log(conn);
|
||||
const track = conn.input.stream.getVideoTracks()[0];
|
||||
|
@ -472,7 +478,13 @@ function ModalComponent({
|
|||
console.log("Applied constraints from ScreenSharePicker successfully.");
|
||||
console.log("New constraints:", track.getConstraints());
|
||||
});
|
||||
|
||||
// changing stream quality description
|
||||
conn.videoStreamParameters[0].maxFrameRate = Number(settings.fps);
|
||||
conn.videoStreamParameters[0].maxResolution.height = Number(settings.resolution);
|
||||
conn.videoStreamParameters[0].maxResolution.width = Math.round(height * (16 / 9));
|
||||
}, 100);
|
||||
}
|
||||
} catch {
|
||||
console.log("Unable to start stream.");
|
||||
}
|
||||
|
|
Reference in a new issue