fix seeking bug
This commit is contained in:
parent
3a1482932f
commit
3e86755e75
|
@ -47,15 +47,23 @@ export default function useNowPlaying(props) {
|
|||
]
|
||||
});
|
||||
|
||||
navigator.mediaSession.setPositionState({
|
||||
duration: np_new.now_playing.duration,
|
||||
position: np_new.now_playing.elapsed,
|
||||
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