Improve MPV initialization and restore (#222)

- set mpv settings only after it has successfully started (at least on linux, settings were not taken)
- change timing of restore queue to behave properly
This commit is contained in:
Kendall Garner 2023-08-25 01:28:50 +00:00 committed by GitHub
parent b60ba27892
commit 1acfa93f1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 13 deletions

View file

@ -73,6 +73,7 @@ export const App = () => {
mpvPlayer?.volume(properties.volume);
}
mpvPlayer?.restoreQueue();
};
if (isElectron() && playbackType === PlaybackType.LOCAL) {
@ -94,8 +95,6 @@ export const App = () => {
useEffect(() => {
if (isElectron()) {
mpvPlayer!.restoreQueue();
mpvPlayerListener!.rendererSaveQueue(() => {
const { current, queue } = usePlayerStore.getState();
const stateToSave: Partial<Pick<PlayerState, 'current' | 'queue'>> = {