I want to play audio from an external folder (music/data or any other) using the GvrAudioEngine API by Google VR in an Android Studio App. However, I am unable to do so. The only thing that seems to work is an audio file placed in the Assets folder. However, that does not serve my problem. Is there any workaround to solve the problem? Or is there any other Library/API I could use for spatial audio rendering?
Code is as follows:
GvrAudioEngine gvrAudioEngine = new GvrAudioEngine(this, GvrAudioEngine.RenderingMode.BINAURAL_HIGH_QUALITY);
String SOUND_FILE = "cube_sound.wav" // Preload the sound file
gvrAudioEngine.preloadSoundFile(SOUND_FILE); // Create the 'sourceId' sound object. // You can create multiple sound objects using the same sound file.
int sourceId = gvrAudioEngine.createSoundObject(SOUND_FILE);
where cube_sound.wav is located in the Assets Folder (this works)
However, if I replace the SOUND_FILE with an external storage path(/storage/emulated/0/cube_sound.wav), I get sourceId = -1 (Invalid). I have ensured that the audio file is located at this place.