I can’t reproduce this in a snack because I can’t seem to get an Audio file to play in a Snack.
If I play a Audio.Sound.create(require('./example.wav'), { shouldPlay: true })
and use the Expo.Speech.say()
together, the speaking will fade out after the audio plays.
The sounds I’m playing are beeps that are less than a second playing after a barcode scan.
A workaround I have come up with is to await the sound completing before attempting to say anything.
function play() {
return new Promise(async (resolve, reject) => {
try {
const { sound } = await Audio.Sound.create(r, { shouldPlay: true });
sound.setOnPlaybackStatusUpdate(async ({ didJustFinish }) => {
if (didJustFinish) {
await sound.stopAsync()
resolve()
}
});
} catch (ex) {
reject(ex);
}
});
}