Problem when use Audio

#1

Hi, I’m trying to develop an app which can send sound message and can play the sound. I want to use Audio to do the sound play.
My design is to transfer the sound file location to the component, and then the component can play the sound. However, the ‘require’ function can only have a string as a parameter, but we want to use a parameter name. The sound file is in local, so we seems can’t use ‘uri’ either. Is there any solution about this?

const soundObject = new Expo.Audio.Sound();
soundObject.loadAsync(source);

How can I use a parameter to set the source in above code instead of write a specific file stress?

closed #2

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.