I have some audio data (raw uncompressed audio waveform, no file format) in memory and want to replay it. Android-internal Mediaplayer seems to support only replaying of files stored somewhere on disk, I could not find a setDataSource()-method that would accept an array of data instead of a path/URL.

So how can I replay waveforms that are not stored on disk?

Thanks!

有帮助吗?

解决方案

Use an AudioTrack. See e.g. this page for an example of how to set up an use an AudioTrack (jump to the "Playing the sample with an AudioTrack" section, and just ignore the JNI-stuff).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top