The file descriptor used for a MediaPlayer must be seekable, which a socket is not.
On Tue, Mar 24, 2009 at 3:22 AM, Pawel Defee <[email protected]> wrote: > > > Trying to set a file descriptor originating from a LocalSocket on a > MediaPlayer fails in Android, both the SDK emulator and the actual > devices. > > This problem was originally described in the link below, but the > discussion got (unfortunately) sidetracked: > > http://groups.google.com/group/android-developers/browse_thread/thread/6cf46cf5d1c8af45 > > The link gives example code to reproduce the problem - I am listing > the necessary steps here as well for reference: > > 1) Create a thread with a LocalSocket that receives raw audio data > (e.g. an OGG file), for example from another LocalSocket. > > 2) Connect the socket and a new MediaPlayer using > mediaPlayer.setDataSource( receivingSocket.getFileDescriptor()); > > The code will fail with UNKNOWN_ERROR on C side with the following > exception on Java side: > > java.io.IOException: setDataSourceFD failed: status=0x80000000 > at android.Media.MediaPlayer.setDataSource(Native Method) > at android.Media.MediaPlayer.setDataSource(MediaPlayer.java:251) > > I studied the C implementation of MediaPlayer APIs, but could not find > out why the method MediaPlayer::getMediaPlayerService fails to return > a valid media player service in this particular case. > > > Thanks in advance for any help, > Pawel > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

