Commit 2733727 1 parent ab9e857 commit 2733727 Copy full SHA for 2733727
File tree 3 files changed +29
-9
lines changed
3 files changed +29
-9
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * SPDX-License-Identifier: GPL-3.0
3
+ * Vesktop, a desktop app aiming to give you a snappier Discord Experience
4
+ * Copyright (c) 2023 Vendicated and Vencord contributors
5
+ */
6
+
7
+ import { addPatch } from "./shared" ;
8
+
9
+ addPatch ( {
10
+ patches : [
11
+ {
12
+ find : 'setSinkId"in' ,
13
+ replacement : {
14
+ // eslint-disable-next-line no-useless-escape
15
+ match : / r e t u r n ( \i ) \? n a v i g a t o r \. m e d i a D e v i c e s \. e n u m e r a t e D e v i c e s / ,
16
+ replace : "return $1 ? $self.filteredDevices"
17
+ }
18
+ }
19
+ ] ,
20
+
21
+ async filteredDevices ( ) {
22
+ const original = await navigator . mediaDevices . enumerateDevices ( ) ;
23
+ return original . filter ( x => x . label !== "vencord-screen-share" ) ;
24
+ }
25
+ } ) ;
Original file line number Diff line number Diff line change 8
8
import "./enableNotificationsByDefault" ;
9
9
import "./platformClass" ;
10
10
import "./hideSwitchDevice" ;
11
+ import "./hideVenmicInput" ;
11
12
import "./screenShareFixes" ;
12
13
import "./spellCheck" ;
13
14
import "./windowsTitleBar" ;
Original file line number Diff line number Diff line change @@ -11,26 +11,20 @@ import { isLinux } from "renderer/utils";
11
11
const logger = new Logger ( "VesktopStreamFixes" ) ;
12
12
13
13
if ( isLinux ) {
14
- const originalMedia = navigator . mediaDevices . getDisplayMedia ;
15
- const originalDevices = navigator . mediaDevices . enumerateDevices ;
14
+ const original = navigator . mediaDevices . getDisplayMedia ;
16
15
17
16
async function getVirtmic ( ) {
18
17
try {
19
- const devices = await originalDevices ( ) ;
18
+ const devices = await navigator . mediaDevices . enumerateDevices ( ) ;
20
19
const audioDevice = devices . find ( ( { label } ) => label === "vencord-screen-share" ) ;
21
20
return audioDevice ?. deviceId ;
22
21
} catch ( error ) {
23
22
return null ;
24
23
}
25
24
}
26
25
27
- navigator . mediaDevices . enumerateDevices = async function ( ) {
28
- const result = await originalDevices . call ( this ) ;
29
- return result . filter ( x => x . label !== "vencord-screen-share" ) ;
30
- } ;
31
-
32
26
navigator . mediaDevices . getDisplayMedia = async function ( opts ) {
33
- const stream = await originalMedia . call ( this , opts ) ;
27
+ const stream = await original . call ( this , opts ) ;
34
28
const id = await getVirtmic ( ) ;
35
29
36
30
const frameRate = Number ( currentSettings ?. fps ) ;
You can’t perform that action at this time.
0 commit comments