My code tries to play an MP3 file from res/raw.
FileDescriptor fd =
appContext.getResources().openRawResourceFd(R.raw.ringtone)
.getFileDescriptor();
player = new MediaPlayer();
try
{
player.setAudioStreamType(AudioManager.STREAM_RING);
player.setDataSource(fd);
player.prepare();
}
catch (IllegalArgumentException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
player = null;
return;
}
catch (IllegalStateException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
player = null;
return;
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
player = null;
return;
}
player.setLooping(true);
player.start();
The log shows:
02-21 15:18:18.360: ERROR/PlayerDriver(51): Command
PLAYER_SET_DATA_SOURCE completed with an error or info
PVMFErrNotSupported
02-21 15:18:18.380: ERROR/MediaPlayer(693): error (1, -4)
02-21 15:18:18.390: WARN/PlayerDriver(51):
PVMFInfoErrorHandlingComplete
After player.prepare() is called.
I really don't have a hint.
I won't use MediaPlayer.create() because I need
player.setAudioStreamType(AudioManager.STREAM_RING);
Would appreciate any help on this...
--
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