Skip to content

fix(mobile): resync TTS after foreground restore#436

Open
codedogQBY wants to merge 1 commit into
mainfrom
codex/fix-mobile-tts-foreground-sync
Open

fix(mobile): resync TTS after foreground restore#436
codedogQBY wants to merge 1 commit into
mainfrom
codex/fix-mobile-tts-foreground-sync

Conversation

@codedogQBY

@codedogQBY codedogQBY commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Analysis

  • [Bug] 语音朗读与文本不同步问题 #403 reports mobile TTS/text synchronization drifting out of sync.
  • [Bug] 听小说时页面显示会暂停 #212 reports the same state mismatch from the UI side: audio keeps playing while the page shows paused, and returning to the listening/reader view can no longer locate the scrolling text.
  • Android can keep React Native TrackPlayer audio moving while React effects and JS timers are paused in the background.
  • The reader foreground resync used a CFI captured before native playback position was polled again, so it could jump/highlight stale text when the app returned.
  • Background notification controls also bypassed the TTS store in PlaybackService, which could leave store state behind native playback.

Changes

  • Sync Edge and DashScope TrackPlayer players from the native active track when the app returns to the foreground, then restart progress polling from that position.
  • Resolve the reader foreground highlight/jump target after the WebView resumes from the latest TTS store state and segment refs.
  • Route PlaybackService remote controls through the TTS store while keeping direct TrackPlayer calls as a native fallback.

Verification

  • pnpm exec biome check packages/app-expo/src/lib/platform/track-player-edge-player.ts packages/app-expo/src/lib/platform/track-player-dashscope-player.ts packages/app-expo/src/screens/reader/useReaderTTS.ts packages/app-expo/src/services/PlaybackService.ts
  • pnpm --filter @readany/app-expo exec tsc --noEmit
  • git diff --check

Fixes #403
Fixes #212

@codedogQBY codedogQBY added bug Something isn't working priority:p1 High: important feature broken or major platform/workflow regression area:reader Reader, pagination, scrolling, layout, TOC area:tts Text-to-speech and read-aloud playback area:mobile Mobile, tablet, React Native, Android, iOS labels Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:mobile Mobile, tablet, React Native, Android, iOS area:reader Reader, pagination, scrolling, layout, TOC area:tts Text-to-speech and read-aloud playback bug Something isn't working priority:p1 High: important feature broken or major platform/workflow regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 语音朗读与文本不同步问题 [Bug] 听小说时页面显示会暂停

1 participant