Skip to content

Commit

Permalink
fix(corner-player): pause playback when player finishes (RSSNext#646)
Browse files Browse the repository at this point in the history
* fix(corner-player): pause playback when player finishes

* fix(corner-player): seek full when player finishes
  • Loading branch information
HydenLiu authored Sep 26, 2024
1 parent b993ae0 commit 71bb323
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/renderer/src/modules/feed-column/corner-player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,16 @@ const PlayerProgress = () => {
const { currentTime = 0, duration = 0 } = playerValue
const [controlledCurrentTime, setControlledCurrentTime] = useState(currentTime)
const [isDraggingProgress, setIsDraggingProgress] = useState(false)

useEffect(() => {
if (isDraggingProgress) return
if (duration > 0 && currentTime >= duration) {
AudioPlayer?.pause()
AudioPlayer?.seek(duration)
return
}
setControlledCurrentTime(currentTime)
}, [currentTime, isDraggingProgress])
}, [currentTime, isDraggingProgress, duration])

const getTimeIndicator = (time: number) => {
return dayjs()
Expand Down

0 comments on commit 71bb323

Please sign in to comment.