import { Audio } from 'expo-av'; import request from './RequestUtils'; async function play(sound) { console.log(sound); const soundObject = new Audio.Sound(); try { await soundObject.loadAsync({ uri: sound }); await soundObject.playAsync(); await soundObject.unloadAsync(); } catch (error) { // An error occurred! } } function SoundPlay(info) { const infos = info.split('_'); console.log(infos); request.get(`/voice/get/${infos[1]}`).then((res) => { console.log(res); if (res.url) { play(res.url); } }); } export { SoundPlay };