force full reset which can get audio working on mobile

This commit is contained in:
Corwin 2024-04-06 02:34:39 +01:00
parent f053915c65
commit 61a7e2fa64
No known key found for this signature in database

View file

@ -51,6 +51,8 @@ function App() {
"agbrswebplayer", "agbrswebplayer",
); );
const [mgbaId, setMgbaId] = useState(0);
const setVolume = (newVolume: number) => const setVolume = (newVolume: number) =>
setState({ volume: newVolume, bindings }); setState({ volume: newVolume, bindings });
const setBindings = (newBindings: Bindings) => const setBindings = (newBindings: Bindings) =>
@ -79,7 +81,7 @@ function App() {
} }
if (reset) { if (reset) {
mgbaRef.current?.restart(); setMgbaId((id) => id + 1);
} }
}; };
@ -111,6 +113,7 @@ function App() {
)} )}
{isPlaying ? ( {isPlaying ? (
<Mgba <Mgba
key={mgbaId}
ref={mgbaRef} ref={mgbaRef}
gameUrl={gameUrl} gameUrl={gameUrl}
volume={volume} volume={volume}