mirror of
https://github.com/aleksilassila/reiverr.git
synced 2026-04-18 07:53:15 +02:00
26 lines
697 B
TypeScript
26 lines
697 B
TypeScript
import { library } from '$lib/stores/library.store';
|
|
import { writable } from 'svelte/store';
|
|
import { modalStack } from '../Modal/Modal';
|
|
import VideoPlayer from './VideoPlayer.svelte';
|
|
|
|
const initialValue = { visible: false, jellyfinId: '' };
|
|
export type PlayerStateValue = typeof initialValue;
|
|
|
|
function createPlayerState() {
|
|
const store = writable<PlayerStateValue>(initialValue);
|
|
|
|
return {
|
|
...store,
|
|
streamJellyfinId: (id: string) => {
|
|
store.set({ visible: true, jellyfinId: id });
|
|
modalStack.create(VideoPlayer, {}); // FIXME
|
|
},
|
|
close: () => {
|
|
store.set({ visible: false, jellyfinId: '' });
|
|
library.refresh();
|
|
}
|
|
};
|
|
}
|
|
|
|
export const playerState = createPlayerState();
|