Hi All,
I want to play music from online mp3 link.
I am reading the music data into a stream and trying to play it using audio track.
But itz giving only noise.No music i could listen.
This is my code.
int intSize = android.media.AudioTrack.getMinBufferSize(8000, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT);
AudioTrack oTrack = new AudioTrack(AudioManager.STREAM_MUSIC, 8000, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, intSize, AudioTrack.MODE_STREAM);
oTrack.play(); oTrack.write(buffer, 0, buffer.length);
here buffer is the audio data i am reading into.
Same buffer I can play in MediaPlayer,,,But i could not play in audiotrack..
Please tell me the solution.
It is urgent.
Thanks Kavitha