, MediaDataSource setDataSource .
, - :
byte[] data = Base64.decode(base64FormattedString, Base64.DEFAULT);
mediaPlayer.setDataSource(new MediaDataSource() {
@Override
public long getSize() {
return data.length;
}
@Override
public int readAt(long position, byte[] buffer, int offset, int size) {
int length = getSize();
if (position >= length) return -1;
if (position + size > length)
size = length - position;
System.arraycopy(data, (int) position, buffer, offset, size);
return size;
}
@Override
public synchronized void close() throws IOException {
}
});
MediaDataSource .
: 23 API. -23 byte[] ( , URL- ). , , , , .
2: N0un answer, , API 3 AudioTrack MediaPlayer.