The weeb for the next gen discord boat - Wamellow wamellow.com
bot discord
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: tts auto play buffer (#28)

authored by

Luna and committed by
GitHub
d5b9b421 dd835305

+22 -3
+3 -1
app/(home)/text-to-speech/page.tsx
··· 6 6 AudioPlayerDuration, 7 7 AudioPlayerProgress, 8 8 AudioPlayerProvider, 9 - AudioPlayerTime 9 + AudioPlayerTime, 10 + AutoPlay 10 11 } from "@/components/ui/audio-player"; 11 12 import { Button } from "@/components/ui/button"; 12 13 import { InputBase, InputBaseTextarea } from "@/components/ui/input-base"; ··· 128 129 {audioUrl && ( 129 130 <div className="rounded-xl bg-linear-to-br from-violet-300/8 to-violet-200/5 p-5 mt-4"> 130 131 <AudioPlayerProvider> 132 + <AutoPlay url={audioUrl} /> 131 133 <div className="flex items-center gap-4"> 132 134 <div className="flex items-center gap-2"> 133 135 <Button asChild>
+2 -2
components/footer.tsx
··· 8 8 import { BiCopyright, BiLogoGithub, BiLogoGmail, BiLogoReddit, BiLogoYoutube } from "react-icons/bi"; 9 9 import { BsDiscord } from "react-icons/bs"; 10 10 import { FaBluesky } from "react-icons/fa6"; 11 - import { HiBookOpen, HiCloud, HiCube, HiGlobe, HiHand, HiLibrary, HiUserAdd } from "react-icons/hi"; 11 + import { HiBookOpen, HiCloud, HiCube, HiGlobe, HiHand, HiLibrary, HiMusicNote, HiUserAdd } from "react-icons/hi"; 12 12 import { SiDiscord, SiKofi } from "react-icons/si"; 13 13 14 14 import { Badge } from "./ui/badge"; ··· 153 153 className="text-primary/75 hover:text-primary/65 duration-200 flex items-center gap-2" 154 154 href="/text-to-speech" 155 155 > 156 - <HiCloud /> 156 + <HiMusicNote /> 157 157 Text to Speech 158 158 </Link> 159 159 <Link
+17
components/ui/audio-player.tsx
··· 89 89 return api; 90 90 } 91 91 92 + export function AutoPlay({ url }: { url: string; }) { 93 + const player = useAudioPlayer(); 94 + const lastUrl = useRef<string | null>(null); 95 + 96 + useEffect(() => { 97 + if (lastUrl.current === url) return; 98 + 99 + lastUrl.current = url; 100 + void player.play({ 101 + id: url, 102 + src: url 103 + }); 104 + }, [url]); 105 + 106 + return null; 107 + } 108 + 92 109 const AudioPlayerTimeContext = createContext<number | null>(null); 93 110 94 111 export const useAudioPlayerTime = () => {