mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +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) {
|
if (status === PlayerStatus.PAUSED) {
|
||||||
await promise;
|
await promise;
|
||||||
setLocalPlayerStatus(status);
|
setLocalPlayerStatus(status);
|
||||||
|
playerRef.current?.setVolume(startVolume);
|
||||||
} else if (status === PlayerStatus.PLAYING) {
|
} else if (status === PlayerStatus.PLAYING) {
|
||||||
setLocalPlayerStatus(status);
|
setLocalPlayerStatus(status);
|
||||||
await promise;
|
await promise;
|
||||||
@@ -257,7 +258,7 @@ export function WebPlayer() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (status === PlayerStatus.PAUSED) {
|
if (status === PlayerStatus.PAUSED) {
|
||||||
playerRef.current?.setVolume(0);
|
playerRef.current?.setVolume(volume);
|
||||||
setLocalPlayerStatus(PlayerStatus.PAUSED);
|
setLocalPlayerStatus(PlayerStatus.PAUSED);
|
||||||
} else if (status === PlayerStatus.PLAYING) {
|
} else if (status === PlayerStatus.PLAYING) {
|
||||||
playerRef.current?.setVolume(volume);
|
playerRef.current?.setVolume(volume);
|
||||||
|
|||||||
Reference in New Issue
Block a user