Fix Play/Pause media key not working out of focus

- Fix media key out of focus not working [86](https://github.com/Zaarrg/stremio-community-v5/issues/86)
This commit is contained in:
Zarg 2025-06-04 18:13:23 +02:00
parent d6c485de17
commit 917dd8d52a
3 changed files with 16 additions and 0 deletions

View file

@ -122,6 +122,11 @@ int main(int argc, char* argv[])
return 1;
}
//Add PlayPause Hotkey
if (!RegisterHotKey(g_hWnd, 1, 0, VK_MEDIA_PLAY_PAUSE)) {
AppendToCrashLog(L"[BOOT]: Failed to register hotkey!");
}
// Scale Values with DPI
ScaleWithDPI();
LoadCustomMenuFont();

View file

@ -391,6 +391,15 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
break;
}
case WM_HOTKEY:
{
// PlayPause Hotkey
if (wParam == 1) {
std::vector<std::string> args = {"cycle", "pause"};
HandleMpvCommand(args);
}
break;
}
case WM_SETTINGCHANGE:
{
UpdateTheme(hWnd);

View file

@ -67,4 +67,6 @@ void Cleanup()
}
Discord_Shutdown();
UnregisterHotKey(g_hWnd, 1);
}