mirror of
https://github.com/aleksilassila/reiverr.git
synced 2026-04-18 07:53:15 +02:00
Work on components, Video player and more
This commit is contained in:
25
src/lib/components/VideoPlayer/VideoPlayer.ts
Normal file
25
src/lib/components/VideoPlayer/VideoPlayer.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { writable } from 'svelte/store';
|
||||
import { modalStack } from '../../stores/modal.store';
|
||||
import VideoPlayer from './VideoPlayer.svelte';
|
||||
import { jellyfinItemsStore } from '../../stores/data.store';
|
||||
|
||||
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: '' });
|
||||
jellyfinItemsStore.refresh();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const playerState = createPlayerState();
|
||||
Reference in New Issue
Block a user