| |
| |
| |
| |
| |
| |
|
|
| import { db } from './database'; |
|
|
| export interface PlaybackSnapshot { |
| sceneIndex: number; |
| actionIndex: number; |
| consumedDiscussions: string[]; |
| sceneId?: string; |
| } |
|
|
| |
| |
| |
| |
| export async function savePlaybackState( |
| stageId: string, |
| snapshot: PlaybackSnapshot, |
| ): Promise<void> { |
| await db.playbackState.put({ |
| stageId, |
| sceneIndex: snapshot.sceneIndex, |
| actionIndex: snapshot.actionIndex, |
| consumedDiscussions: snapshot.consumedDiscussions, |
| sceneId: snapshot.sceneId, |
| updatedAt: Date.now(), |
| |
| } as any); |
| } |
|
|
| |
| |
| |
| |
| export async function loadPlaybackState(stageId: string): Promise<PlaybackSnapshot | null> { |
| const record = await db.playbackState.get(stageId); |
| if (!record) return null; |
|
|
| return { |
| sceneIndex: record.sceneIndex, |
| actionIndex: record.actionIndex, |
| consumedDiscussions: record.consumedDiscussions, |
| |
| sceneId: (record as any).sceneId as string | undefined, |
| }; |
| } |
|
|
| |
| |
| |
| export async function clearPlaybackState(stageId: string): Promise<void> { |
| await db.playbackState.delete(stageId); |
| } |
|
|