Merge pull request #5 from richardr1126/single-page-viewer
Text to click fix
This commit is contained in:
commit
a1136be580
1 changed files with 6 additions and 15 deletions
|
|
@ -416,11 +416,8 @@ export function TTSProvider({ children }: { children: React.ReactNode }) {
|
||||||
const stopAndPlayFromIndex = useCallback((index: number) => {
|
const stopAndPlayFromIndex = useCallback((index: number) => {
|
||||||
abortAudio();
|
abortAudio();
|
||||||
|
|
||||||
// Set the states in the next tick to ensure clean state
|
setCurrentIndex(index);
|
||||||
setTimeout(() => {
|
setIsPlaying(true);
|
||||||
setCurrentIndex(index);
|
|
||||||
setIsPlaying(true);
|
|
||||||
}, 50);
|
|
||||||
}, [abortAudio]);
|
}, [abortAudio]);
|
||||||
|
|
||||||
const setCurrentIndexWithoutPlay = useCallback((index: number) => {
|
const setCurrentIndexWithoutPlay = useCallback((index: number) => {
|
||||||
|
|
@ -437,11 +434,8 @@ export function TTSProvider({ children }: { children: React.ReactNode }) {
|
||||||
if (isPlaying) {
|
if (isPlaying) {
|
||||||
const currentIdx = currentIndex;
|
const currentIdx = currentIndex;
|
||||||
stop();
|
stop();
|
||||||
// Small delay to ensure audio is fully stopped
|
setCurrentIndex(currentIdx);
|
||||||
setTimeout(() => {
|
setIsPlaying(true);
|
||||||
setCurrentIndex(currentIdx);
|
|
||||||
setIsPlaying(true);
|
|
||||||
}, 50);
|
|
||||||
}
|
}
|
||||||
}, [isPlaying, currentIndex, stop]);
|
}, [isPlaying, currentIndex, stop]);
|
||||||
|
|
||||||
|
|
@ -453,11 +447,8 @@ export function TTSProvider({ children }: { children: React.ReactNode }) {
|
||||||
if (isPlaying) {
|
if (isPlaying) {
|
||||||
const currentIdx = currentIndex;
|
const currentIdx = currentIndex;
|
||||||
stop();
|
stop();
|
||||||
// Small delay to ensure audio is fully stopped
|
setCurrentIndex(currentIdx);
|
||||||
setTimeout(() => {
|
setIsPlaying(true);
|
||||||
setCurrentIndex(currentIdx);
|
|
||||||
setIsPlaying(true);
|
|
||||||
}, 50);
|
|
||||||
}
|
}
|
||||||
}, [isPlaying, currentIndex, stop]);
|
}, [isPlaying, currentIndex, stop]);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue