Skip to content

Commit

Permalink
Fix: music stops when closing laptop lid and MA browser tab open
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Jan 20, 2025
1 parent dfaf7f2 commit 7c487b6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/layouts/default/PlayerOSD/PlayerBrowserMediaControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ onMounted(() => {
apiCommandWithCurrentPlayer(api.playerCommandPlay.bind(api));
});
navigator.mediaSession.setActionHandler("pause", () => {
apiCommandWithCurrentPlayer(api.playerCommandPause.bind(api));
// workaround-alert: delay the pause command a tiny bit
// to workaround a browser bug where pause is sent if a laptop/computer
// goes to standby (lid closed). This issue seems to only exist on Chromium based browsers.
setTimeout(() => {
apiCommandWithCurrentPlayer(api.playerCommandPause.bind(api));
}, 250);
});
navigator.mediaSession.setActionHandler("nexttrack", () => {
apiCommandWithCurrentPlayer(api.playerCommandNext.bind(api));
Expand Down

0 comments on commit 7c487b6

Please sign in to comment.