mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 06:28:51 +00:00
Tweak/use sound mount before its ready to play (#128)
* Make useSound use soundProvider and be sure its mounted! * Remove console.log
This commit is contained in:
1 parent
e9e22ce9bc
commit
a579d7bb8d
6 files changed
+207
-165
No files matched your search
@@ -16,7 +16,16 @@ export const ExampleApp = () => {
|
||||
const exampleString = useExample();
|
||||
const example = useApp('EXAMPLE');
|
||||
const [soundName, setSound] = useState('pixel.ogg');
|
||||
const { play, playing, stop } = useSound('media/ringtones/' + soundName);
|
||||
const { play, playing, stop } = useSound('./media/ringtones/' + soundName);
|
||||
|
||||
const toggleSound = () => {
|
||||
if (soundName === 'pixel.ogg') {
|
||||
setSound('marimba.ogg');
|
||||
return;
|
||||
}
|
||||
setSound('pixel.ogg');
|
||||
};
|
||||
|
||||
return (
|
||||
<ExampleThemeProvider>
|
||||
<AppWrapper>
|
||||
@@ -29,9 +38,7 @@ export const ExampleApp = () => {
|
||||
<IconButton onClick={() => (playing ? stop() : play())}>
|
||||
{playing ? <StopIcon /> : <PlayIcon />}
|
||||
</IconButton>
|
||||
<Button onClick={() => setSound('marimba.ogg')}>
|
||||
Change sound on the fly
|
||||
</Button>
|
||||
<Button onClick={toggleSound}>Change sound on the fly</Button>
|
||||
</AppContent>
|
||||
</AppWrapper>
|
||||
</ExampleThemeProvider>
|
||||
|
||||
Reference in new issue
Block a user