Skip to content

Commit 1c62d16

Browse files
committed
fix first play bug
1 parent 99b953e commit 1c62d16

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/components/ListenToPlayer/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const ListenToPlayer = ({ slug }) => {
2727
html5: true,
2828
onload: () => {
2929
setSound(audioPlayer)
30+
setTimeRemaining(audioPlayer.duration())
3031
},
3132
onplay: () => setIsPlaying(true),
3233
onpause: () => setIsPlaying(false),
@@ -83,6 +84,7 @@ const ListenToPlayer = ({ slug }) => {
8384
sound.pause()
8485
} else {
8586
sound.play()
87+
setTimeRemaining(sound.duration() - sound.seek())
8688
setStartedPlaying(true)
8789
setIsPlaying(true)
8890
setShowWidget(true)

0 commit comments

Comments
 (0)