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}
|
||||
]
|
||||
});
|
||||
|
||||
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", {
|
||||
detail: np_new
|
||||
}));
|
||||
|
||||
function setPositionState(duration, position) {
|
||||
navigator.mediaSession.setPositionState({
|
||||
duration,
|
||||
position,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (props.useSse) {
|
||||
|
|
Loading…
Reference in New Issue