fluffy
fluffy

Reputation: 5314

Loading a network-retrieved asset into SoundPool

In the application I'm working on, we're switching to loading all app assets from a network store so that we can update them independently of app store submissions. However, it seems that SoundPool only allows loading directly from local storage, either via a hardcoded file path or via AssetFileDescriptor.

Are there some methods I'm just not seeing in the API, or do I really have to download the network resource, write it out to a temporary file, and then have SoundPool load it back in from that file?

Note that this is still for UI sound effects that are intended to be pooled, stored in memory, and played with minimal latency. I am not asking for a mechanism for streaming audio from the network.

Upvotes: 0

Views: 119

Answers (1)

Leo
Leo

Reputation: 79

The Android Developer site says

"A SoundPool is a collection of samples that can be loaded into memory from a resource inside the APK or from a file in the file system."

It also mentions that an audio file for the SoundPool must be located in the res/raw folder. There doesn't appear to be support for pooling resources over a network in SoundPool, however MediaPlayer supports audio streaming.

Upvotes: 3

Related Questions