diff --git a/src/components/Player/BackgroundMusicThroughVideo.tsx b/src/components/Player/BackgroundMusicThroughVideo.tsx index ddcc241..9a17751 100644 --- a/src/components/Player/BackgroundMusicThroughVideo.tsx +++ b/src/components/Player/BackgroundMusicThroughVideo.tsx @@ -33,20 +33,20 @@ export default function BackgroundMusicThroughVideo() { }, [playerState, bgMusicVol]) // TODO: Implement video play pause handling with ref forwarding - useEffect(() => { - videoRef.current.addEventListener("pause", handleVideoPlayPause) - - return (() => { - try { - videoRef.current.removeEventListener("pause", handleVideoPlayPause) - } catch (error) { - console.log(error) - } - }) - }, []) - - function handleVideoPlayPause() { - } + // useEffect(() => { + // videoRef.current.addEventListener("pause", handleVideoPlayPause) + + // return (() => { + // try { + // videoRef.current.removeEventListener("pause", handleVideoPlayPause) + // } catch (error) { + // console.log(error) + // } + // }) + // }, []) + + // function handleVideoPlayPause() { + // } return ( // Fixed position tiny invisible video diff --git a/src/components/Player/PlayerControls.tsx b/src/components/Player/PlayerControls.tsx index 0f0dc6a..46e70b2 100644 --- a/src/components/Player/PlayerControls.tsx +++ b/src/components/Player/PlayerControls.tsx @@ -113,9 +113,6 @@ export default function PlayerControls() { // Ref value is used to determine, what to do next function speechCompleteCallback() { console.log("Speech has ended") - if (speechEndReasonRef.current === "pause") { - setPlayerState("paused") - } if (speechEndReasonRef.current === "forward") { setSpeakingSentenceIndex((speakingSentenceIndex + 1)) } @@ -162,6 +159,7 @@ export default function PlayerControls() { setIsPlayerOpen(false) // Using button click, since calling rewind(), playPause(), forward() functions mess up the state unpredictably. TODO: Need to figure out why this happens. + // Button click also causes issues if the element is currently focussed. if (event.key === "ArrowLeft") rewindButton.current.click() @@ -189,6 +187,7 @@ export default function PlayerControls() { if (playerState === "playing") { speechSynthesis.cancel() speechEndReasonRef.current = "pause" + setPlayerState("paused") } if (playerState === "paused") { setPlayerState("playing") diff --git a/src/constants/appConstants.ts b/src/constants/appConstants.ts index cadbc95..6a52ca5 100644 --- a/src/constants/appConstants.ts +++ b/src/constants/appConstants.ts @@ -14,7 +14,7 @@ For best listening experience, here are some recommendations. On desktop devices If you like Listen, you can install it as an app on your phone or desktop. Even more, you can quickly integrate it on your blog or webpages, so that your readers can instantly listen to your pages. Okay bye bye!` -export const CORS_ERROR_MESSAGE = `[LISTEN]: To fetch the article, make sure to allow cross origin requests (CORS) on your server from https://www.vivek.nexus. See https://github.com/vivek-nexus/listen/blob/main/README.md#passing-a-link-to-fetch.` +export const CORS_ERROR_MESSAGE = `[LISTEN]: To fetch the article, make sure to allow cross origin requests (CORS) on your server from https://www.vivek.nexus. See https://github.com/vivek-nexus/listen?tab=readme-ov-file#listen.` export const PROXY_SERVER_URL = "https://render-express-server-q222.onrender.com" export const SpeechSettingDefaultValues = { rate: 10,