Play music from memory in Android

2019-08-05 03:16发布

问题:

Is there a way to play a song that exists as an array of bytes in memory and not as a file on disk?

I know I could save it in a file temporarily and play it form there but I'd like to avoid this as I'm trying to implement a DRM system that will not expose unencrypted media files.

回答1:

You can use AudioTrack. But it supports raw LPCM data only.