mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-08 13:00:13 +02:00
Prevent Media Session Handling on MPV (#1212)
* Remove MediaSession Handling on MPV * Add playbackType to config.json for Main Thread Access * Disabling settings without Hiding
This commit is contained in:
@@ -3,6 +3,8 @@ import { BrowserWindow, globalShortcut, systemPreferences } from 'electron';
|
||||
import { isMacOS, isWindows } from '../../../utils';
|
||||
import { store } from '../settings';
|
||||
|
||||
import { PlaybackType } from '/@/shared/types/types';
|
||||
|
||||
export const enableMediaKeys = (window: BrowserWindow | null) => {
|
||||
if (isMacOS()) {
|
||||
const shouldPrompt = store.get('should_prompt_accessibility', true) as boolean;
|
||||
@@ -24,7 +26,9 @@ export const enableMediaKeys = (window: BrowserWindow | null) => {
|
||||
}
|
||||
|
||||
const enableWindowsMediaSession = store.get('mediaSession', false) as boolean;
|
||||
if (!(enableWindowsMediaSession && isWindows())) {
|
||||
const playbackType = store.get('playbackType', PlaybackType.WEB) as PlaybackType;
|
||||
|
||||
if (!enableWindowsMediaSession || !isWindows() || playbackType !== PlaybackType.WEB) {
|
||||
globalShortcut.register('MediaStop', () => {
|
||||
window?.webContents.send('renderer-player-stop');
|
||||
});
|
||||
|
||||
+4
-2
@@ -38,7 +38,7 @@ import {
|
||||
} from './utils';
|
||||
import './features';
|
||||
|
||||
import { TitleTheme } from '/@/shared/types/types';
|
||||
import { PlaybackType, TitleTheme } from '/@/shared/types/types';
|
||||
|
||||
export default class AppUpdater {
|
||||
constructor() {
|
||||
@@ -549,7 +549,9 @@ async function createWindow(first = true): Promise<void> {
|
||||
}
|
||||
|
||||
const enableWindowsMediaSession = store.get('mediaSession', false) as boolean;
|
||||
const shouldDisableMediaFeatures = !isWindows() || !enableWindowsMediaSession;
|
||||
const playbackType = store.get('playbackType', PlaybackType.WEB) as PlaybackType;
|
||||
const shouldDisableMediaFeatures =
|
||||
!isWindows() || !enableWindowsMediaSession || playbackType !== PlaybackType.WEB;
|
||||
if (shouldDisableMediaFeatures) {
|
||||
app.commandLine.appendSwitch(
|
||||
'disable-features',
|
||||
|
||||
Reference in New Issue
Block a user