fix: setpositionstate error

This commit is contained in:
ThaUnknown 2022-04-11 01:08:51 +02:00
parent 61da6ae049
commit 1a0adfc472
3 changed files with 3 additions and 5 deletions

View file

@ -1,6 +1,6 @@
{
"name": "Miru",
"version": "1.2.6",
"version": "1.2.7",
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
"main": "src/index.js",
"homepage": "https://github.com/ThaUnknown/miru#readme",

View file

@ -552,7 +552,7 @@
$: navigator.mediaSession?.setPositionState({
duration: Math.max(0, duration || 0),
playbackRate: 1,
position: Math.min(duration || 0, currentTime || 0)
position: Math.max(0, Math.min(duration || 0, currentTime || 0))
})
$: mediaChange(current)

View file

@ -60,9 +60,7 @@ const codes = {
511: 'Network Authentication Required'
}
export const alID =
!!alToken &&
alRequest({ method: 'Viewer', token: alToken })
export const alID = !!alToken && alRequest({ method: 'Viewer', token: alToken })
function printError (error) {
console.warn(error)