I'm developing an android app that will play mp3 files. However the mp3 files are encrypted on the sd card . Either ways, after decryption, i'll have a stream of bytes. I hav used audio track class but unable to play the audio.plz help me. thank you in advance.
You could save the stream to a temporary (mp3) file and then play this file with MediaPlayer
EDIT to address comment:
The file would not be persistent, something like
File temp = File.createTempFile("whatever", "mp3", getCacheDir());
temp.deleteOnExit();
FileOutputStream fStream = new FileOutputStream(temp);
fStream.write(passYourStream);
fStream.close();
FileInputStream fStream2 = new FileInputStream(temp);
yourMediaPlayerInstance.setDataSource(fStream2.getFD());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.