fix: remove audio pause during zero-delay verse transitions - #3318
Open
Mubashir78 wants to merge 1 commit into
Open
fix: remove audio pause during zero-delay verse transitions#3318Mubashir78 wants to merge 1 commit into
Mubashir78 wants to merge 1 commit into
Conversation
The audio player always paused before seeking to the next verse during repeat mode, even when the delay between verses was set to zero. This created an audible gap (voice cutoff) at verse boundaries. Split the REPEAT_AYAH transition into two guarded paths: - When verseDelay > 0: preserve existing pause-then-seek behavior so users who configured a delay still hear the intended pause. - When verseDelay === 0: skip the pause entirely and seek directly to the next verse timestamp while audio keeps playing, producing a seamless transition with no voice cutoff. Added hasVerseDelay guard to the audio player state machine to distinguish between the two cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
During repeat mode playback, the audio player always pauses before seeking to the next verse, even when the delay between verses is set to zero. This creates an audible gap (voice cutoff) at verse boundaries.
The issue is in the
REPEAT_AYAHaction of the audio player state machine, which unconditionally callspauseAudiobeforesetAudioPlayerCurrentTime.Root Cause
In
audioPlayerMachine.ts, theREPEAT_AYAHtransition inPLAYING.ACTIVEstate always:pauseAudio)setAudioPlayerCurrentTime)DELAYINGstateEven when
verseDelay === 0(no configured delay), the pause creates a brief silence between verses.Fix
Split the
REPEAT_AYAHtransition into two guarded paths:verseDelay > 0: Preserves existing behavior (pause, seek, go to DELAYING state) for users who configured a delay between verses.verseDelay === 0: Skips the pause entirely and seeks directly to the next verse timestamp while audio keeps playing, going straight back toPLAYING.ACTIVE. This produces seamless transitions with no voice cutoff.Changes
src/xstate/actors/audioPlayer/audioPlayerMachine.ts:REPEAT_AYAHhandler from a single transition into two guarded transitionshasVerseDelayguard:(context, event) => event.verseDelay > 0Testing
Standalone state machine tests verified all assertions pass:
verseDelay > 0: machine pauses audio and enters DELAYING stateverseDelay === 0: machine skips pause and stays in PLAYING.ACTIVE