Do not register as media service; Fix autoplay

This commit is contained in:
Vendicated 2023-04-27 01:19:58 +02:00
parent c495e71f35
commit 3305900cb8
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905

View file

@ -17,6 +17,7 @@ import { createMainWindow } from "./mainWindow";
import { Settings } from "./settings"; import { Settings } from "./settings";
import { createSplashWindow } from "./splash"; import { createSplashWindow } from "./splash";
import { ensureVencordFiles } from "./utils/vencordLoader"; import { ensureVencordFiles } from "./utils/vencordLoader";
if (IS_DEV) { if (IS_DEV) {
require("source-map-support").install(); require("source-map-support").install();
} }
@ -29,6 +30,20 @@ const runVencordMain = once(() => require(join(VENCORD_FILES_DIR, "vencordDeskto
let mainWin: BrowserWindow | null = null; let mainWin: BrowserWindow | null = null;
function init() { function init() {
// <-- BEGIN COPY PASTED FROM DISCORD -->
// work around chrome 66 disabling autoplay by default
app.commandLine.appendSwitch("autoplay-policy", "no-user-gesture-required");
// WinRetrieveSuggestionsOnlyOnDemand: Work around electron 13 bug w/ async spellchecking on Windows.
// HardwareMediaKeyHandling,MediaSessionService: Prevent Discord from registering as a media service.
app.commandLine.appendSwitch(
"disable-features",
"WinRetrieveSuggestionsOnlyOnDemand,HardwareMediaKeyHandling,MediaSessionService"
);
// <-- END COPY PASTED FROM DISCORD -->
app.on("second-instance", (_event, _cmdLine, _cwd, data: any) => { app.on("second-instance", (_event, _cmdLine, _cwd, data: any) => {
if (data.IS_DEV) app.quit(); if (data.IS_DEV) app.quit();
else if (mainWin) { else if (mainWin) {