Skip to content

Commit

Permalink
fix: replay voice memos (#902)
Browse files Browse the repository at this point in the history
Fixed replay voice memos; Thanks @aldenquimby
  • Loading branch information
AhyoungRyu authored Dec 28, 2023
1 parent cddb057 commit cf06818
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/hooks/VoicePlayer/dux/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ export default function voicePlayerReducer(
const { groupKey } = action.payload as OnCurrentTimeUpdatePayload;
const { currentTime, duration } = state.currentPlayer as HTMLAudioElement;
const audioUnit = (state.audioStorage?.[groupKey] ? state.audioStorage[groupKey] : AudioUnitDefaultValue()) as AudioStorageUnit;
if (currentTime > 0 && duration > 0) {
// sometimes the final time update is fired AFTER the pause event when audio is finished
if (audioUnit.playbackTime === audioUnit.duration && audioUnit.playingStatus === VOICE_PLAYER_STATUS.PAUSED) {
audioUnit.playbackTime = 0;
} else if (currentTime > 0 && duration > 0) {
audioUnit.playbackTime = currentTime;
audioUnit.duration = duration;
}
Expand Down

0 comments on commit cf06818

Please sign in to comment.