feat: add real-time playback position sync and skip buttons
Backend (Rust): - Add position tracking based on elapsed wall clock time - SharedState now tracks playback start time and position at start - get_state() returns real-time position instead of stale value - Position automatically pauses/resumes with playback Frontend (Svelte): - Replace dumb setInterval timer with backend polling (500ms) - Poll get_playback_state to sync position from Rust - Add onSkipBack/onSkipForward handlers to NowPlayingBar - Add onSkipBack/onSkipForward handlers to FullScreenNowPlaying - Wire skip buttons to handlers (restart if >3s, otherwise previous) - Add keyboard shortcuts: Ctrl+Left/Right for skip
This commit is contained in:
1 parent
b354161d82
commit
d1a13110ea
4 files changed
+177
-32
No files matched your search
@@ -22,6 +22,8 @@
|
||||
qualityLevel?: number;
|
||||
isPlaying?: boolean;
|
||||
onTogglePlay?: () => void;
|
||||
onSkipBack?: () => void;
|
||||
onSkipForward?: () => void;
|
||||
currentTime?: number;
|
||||
duration?: number;
|
||||
onSeek?: (time: number) => void;
|
||||
@@ -45,6 +47,8 @@
|
||||
qualityLevel = 5,
|
||||
isPlaying = false,
|
||||
onTogglePlay,
|
||||
onSkipBack,
|
||||
onSkipForward,
|
||||
currentTime = 201,
|
||||
duration = 345,
|
||||
onSeek,
|
||||
@@ -157,7 +161,7 @@
|
||||
>
|
||||
<Shuffle size={20} />
|
||||
</button>
|
||||
<button class="control-btn primary">
|
||||
<button class="control-btn primary" onclick={onSkipBack}>
|
||||
<SkipBack size={24} />
|
||||
</button>
|
||||
<button class="play-btn" onclick={onTogglePlay}>
|
||||
@@ -167,7 +171,7 @@
|
||||
<Play size={24} fill="white" color="white" class="play-icon" />
|
||||
{/if}
|
||||
</button>
|
||||
<button class="control-btn primary">
|
||||
<button class="control-btn primary" onclick={onSkipForward}>
|
||||
<SkipForward size={24} />
|
||||
</button>
|
||||
<button
|
||||
|
||||
Reference in new issue
Block a user