// 注意用这种方式创建的Media不需要 mediaPlayer.prepare();
// 创建的时候已经调用过了
mMediaPlayer = MediaPlayer.create(this.mContext,
R.raw.voip_call_ring);
AudioManager mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
mAudioManager.setSpeakerphoneOn(false);
mMediaPlayer = new MediaPlayer();
try
{
// content://settings/system/ringtone
Uri alert = RingtoneManager
.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
// alert = Uri
// .parse(VoipLogic.getInstance().getRingFilePath());
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_RING);
mMediaPlayer.setDataSource(mContext,
alert);
mMediaPlayer.prepare();
}
catch (IOException e)
{
e.printStackTrace();
}
break;