I used MediaPlayer for play an amr file and it work good. Now I'd like
to play an amr stream progressive. I must use a my socket connection
to get audio stream (no rtp no http but a private protocol). Can I
play a buffer amr using ParcelFileDescriptor.fromSocket(_sc); ?
I read the doc about ParcelFileDescriptor but is not clear how must be
used. I written that little code but it does't work
if (_pfd==null){
// INIT THE PLAYER
_pfd = ParcelFileDescriptor.fromSocket(_sc);
player.setDataSource(_pfd.getFileDescriptor());
player = new MediaPlayer();
Parcel data = null;
data = Parcel.obtain();
' HEADER AMR
data.writeString("#!AMR");
_pfd.writeToParcel(data, 0);
}
else{
' WRITE FRAME AUDIO
Parcel data = null;
data = Parcel.obtain();
data.writeByteArray(_byBuf);
_pfd.writeToParcel(data, 0);
if (_iNAudioFrames==300){ // play the stream after 300 frames
received
player.prepare();
player.start();
}
}
somebody can help ? Is possible do it ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---