Using java Syntax Highlighting
- 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();
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
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...




