fix(player): fix initial visual offset jump check

This commit is contained in:
nick-delirium 2023-03-31 17:27:43 +02:00
parent 629dd34870
commit 9f4ac12f93

View file

@ -31,6 +31,7 @@ function WebPlayer(props: any) {
const [activeTab, setActiveTab] = useState('');
const [showNoteModal, setShowNote] = useState(false);
const [noteItem, setNoteItem] = useState<Note | undefined>(undefined);
const [visuallyAdjusted, setAdjusted] = useState(false);
// @ts-ignore
const [contextValue, setContextValue] = useState<IPlayerContext>(defaultContextValue);
@ -84,8 +85,9 @@ function WebPlayer(props: any) {
if (activeTab === '' && !showNoteModal && isPlayerReady && contextValue.player) {
contextValue.player.play()
if (visualOffset !== 0) {
if (visualOffset !== 0 && !visuallyAdjusted) {
contextValue.player.jump(visualOffset)
setAdjusted(true)
}
}
}, [activeTab, isPlayerReady, showNoteModal, visualOffset])