Skip to content

Commit

Permalink
fix: production error Audio reference not found
Browse files Browse the repository at this point in the history
  • Loading branch information
DikDns committed Oct 9, 2024
1 parent b17bd20 commit 34047f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/providers/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { AnimatePresence, motion } from "framer-motion";
export function Loading({ children }: { children: React.ReactNode }) {
const [isLoading, setIsLoading] = useState(true);
const [isSoundPlaying, setIsSoundPlaying] = useState(false);
const audio = new Audio("/assets/sound-bg-1.mp3"); // Initialize audio

useEffect(() => {
const timer = setTimeout(() => {
Expand All @@ -17,6 +16,7 @@ export function Loading({ children }: { children: React.ReactNode }) {
}, []);

const handlePlaySound = () => {
const audio = new Audio("/assets/sound-bg-1.mp3");
audio.loop = true;
audio.volume = 0.75;
audio.play().catch((error) => console.error("Error playing sound:", error));
Expand Down

0 comments on commit 34047f1

Please sign in to comment.