mirror of
https://github.com/AzuraCast/AzuraCast.git
synced 2024-06-14 13:16:37 +00:00
Now playing position (#7001)
* Add position state to now playing * fix seeking bug
This commit is contained in:
parent
035799679b
commit
7d083ab93d
|
@ -46,11 +46,24 @@ export default function useNowPlaying(props) {
|
||||||
{src: np_new.now_playing.song.art}
|
{src: np_new.now_playing.song.art}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setPositionState(np_new.now_playing.duration, np_new.now_playing.elapsed);
|
||||||
|
|
||||||
|
navigator.mediaSession.setActionHandler("seekto", function () {
|
||||||
|
setPositionState(np_new.now_playing.duration, np_new.now_playing.elapsed);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
document.dispatchEvent(new CustomEvent("now-playing", {
|
document.dispatchEvent(new CustomEvent("now-playing", {
|
||||||
detail: np_new
|
detail: np_new
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
function setPositionState(duration, position) {
|
||||||
|
navigator.mediaSession.setPositionState({
|
||||||
|
duration,
|
||||||
|
position,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.useSse) {
|
if (props.useSse) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user