Skip to content

Commit

Permalink
fix audio bug
Browse files Browse the repository at this point in the history
  • Loading branch information
BrightTheBackpack authored and JosiasAurel committed Jul 23, 2024
1 parent e3cd485 commit b37f498
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/big-interactive-pages/mobile-player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ interface MobilePlayerProps {

export default function MobilePlayer(props: MobilePlayerProps) {
const screen = useRef<HTMLCanvasElement>(null)

const cleanup = useRef<(() => void) | null>(null);

const run = () => {
if (cleanup.current) cleanup.current();
const res = runGame(props.code, screen.current!, (_) => { })
if (res.error) console.error(res.error.raw)
cleanup.current = res.cleanup;
return res.cleanup
}

Expand Down Expand Up @@ -69,4 +72,4 @@ export default function MobilePlayer(props: MobilePlayerProps) {
</div>
</div>
)
}
}

0 comments on commit b37f498

Please sign in to comment.