Skip to content

Commit

Permalink
feat: add seeking in podcast episode
Browse files Browse the repository at this point in the history
  • Loading branch information
chhoumann committed Jul 11, 2022
1 parent 9bca9fc commit 8a3f80b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/ui/PodcastView/EpisodePlayer.svelte
Expand Up @@ -31,6 +31,22 @@
currentTime.set(percent * $duration);
}
let isDragging: boolean = false;
function onDragStart() {
isDragging = true;
}
function onDragEnd() {
isDragging = false;
}
function handleDragging(e: MouseEvent) {
if (!isDragging) return;
onClickProgressbar(e);
}
onMount(() => {
const playedEps = $playedEpisodes;
const currentEp = $currentEpisode;
Expand Down Expand Up @@ -153,6 +169,9 @@
max={$duration}
value={$currentTime}
on:click={onClickProgressbar}
on:mousedown={onDragStart}
on:mouseup={onDragEnd}
on:mousemove={handleDragging}
/>
<span>{formatSeconds($duration - $currentTime, "HH:mm:ss")}</span>
</div>
Expand Down

0 comments on commit 8a3f80b

Please sign in to comment.