import {Audio} from 'expo-av';
useEffect(() =>
const enableAudio = async () => {
await Audio.setAudioModeAsync({
playsInSilentModeIOS: true,
staysActiveInBackground: false,
// interruptionModeAndroid: INTERRUPTION_MODE_ANDROID_DO_NOT_MIX,
shouldDuckAndroid: false,
});
};
enableAudio();
playSound();
}, []);
const enableAudio = async () => {
await Audio.setAudioModeAsync({
playsInSilentModeIOS: true,
staysActiveInBackground: false,
// interruptionModeAndroid: INTERRUPTION_MODE_ANDROID_DO_NOT_MIX,
shouldDuckAndroid: false,
});
};
const playSound = () => {
try {
const { sound: s } = await Audio.Sound.createAsync(
require('../../assets/sounds/strongClick.wav'),
);
setSound(s);
await s.playAsync();
} catch (err) {
console.log(err);
}
};
No sound. What am i doing wrong?
My bad. I didn't have the volume up on the simulator. For those having the same problem, just click the left side button on the simulator near the top and drag up.