[bugfix]: restart timestamp when adding to queue

This commit is contained in:
Kendall Garner 2024-05-10 12:27:33 -07:00
parent c5e8472746
commit 168153b211
No known key found for this signature in database
GPG key ID: 18D2767419676C87

View file

@ -29,6 +29,7 @@ import {
} from '/@/renderer/features/player/utils'; } from '/@/renderer/features/player/utils';
import { queryKeys } from '/@/renderer/api/query-keys'; import { queryKeys } from '/@/renderer/api/query-keys';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { PlayersRef } from '/@/renderer/features/player/ref/players-ref';
const getRootQueryKey = (itemType: LibraryItem, serverId: string) => { const getRootQueryKey = (itemType: LibraryItem, serverId: string) => {
let queryKey; let queryKey;
@ -179,6 +180,15 @@ export const useHandlePlayQueueAdd = () => {
} else { } else {
mpvPlayer!.setQueueNext(playerData); mpvPlayer!.setQueueNext(playerData);
} }
} else {
const player =
playerData.current.player === 1
? PlayersRef.current?.player1
: PlayersRef.current?.player2;
const underlying = player?.getInternalPlayer();
if (underlying) {
underlying.currentTime = 0;
}
} }
// We should only play if the queue was empty, or we are doing play NOW // We should only play if the queue was empty, or we are doing play NOW