mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20:12 +02:00
fix mediasession play hotkey on after pause on web (#1758)
- chrome (and other browsers) determine that the audio element is inactive if the volume is set to 0 when paused, leading to the resume (play) mediasession event to no longer be available
This commit is contained in:
@@ -84,6 +84,7 @@ export function WebPlayer() {
|
||||
if (status === PlayerStatus.PAUSED) {
|
||||
await promise;
|
||||
setLocalPlayerStatus(status);
|
||||
playerRef.current?.setVolume(startVolume);
|
||||
} else if (status === PlayerStatus.PLAYING) {
|
||||
setLocalPlayerStatus(status);
|
||||
await promise;
|
||||
@@ -257,7 +258,7 @@ export function WebPlayer() {
|
||||
}
|
||||
} else {
|
||||
if (status === PlayerStatus.PAUSED) {
|
||||
playerRef.current?.setVolume(0);
|
||||
playerRef.current?.setVolume(volume);
|
||||
setLocalPlayerStatus(PlayerStatus.PAUSED);
|
||||
} else if (status === PlayerStatus.PLAYING) {
|
||||
playerRef.current?.setVolume(volume);
|
||||
|
||||
Reference in New Issue
Block a user