mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 08:47:46 +00:00
parent
cc1bfec08a
commit
13c1b15dc2
@ -91,24 +91,19 @@ public class OutgoingRinger implements MediaPlayer.OnCompletionListener, MediaPl
|
||||
mediaPlayer.setAudioStreamType(AudioManager.STREAM_VOICE_CALL);
|
||||
mediaPlayer.setOnCompletionListener(this);
|
||||
mediaPlayer.setOnPreparedListener(this);
|
||||
mediaPlayer.setLooping(loopEnabled);
|
||||
|
||||
String packageName = context.getPackageName();
|
||||
Uri dataUri = Uri.parse("android.resource://" + packageName + "/" + currentSoundID);
|
||||
|
||||
try {
|
||||
mediaPlayer.setDataSource(context, dataUri);
|
||||
mediaPlayer.prepareAsync();
|
||||
} catch (IllegalArgumentException | SecurityException | IllegalStateException | IOException e) {
|
||||
Log.w(TAG, e);
|
||||
// TODO Auto-generated catch block
|
||||
return;
|
||||
}
|
||||
try {
|
||||
mediaPlayer.prepareAsync();
|
||||
} catch (IllegalStateException e) {
|
||||
// TODO Auto-generated catch block
|
||||
Log.w(TAG, e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
@ -131,8 +126,6 @@ public class OutgoingRinger implements MediaPlayer.OnCompletionListener, MediaPl
|
||||
}
|
||||
|
||||
public void onPrepared(MediaPlayer mp) {
|
||||
mediaPlayer.setLooping(loopEnabled);
|
||||
|
||||
AudioManager am = ServiceUtil.getAudioManager(context);
|
||||
|
||||
if (am.isBluetoothScoAvailableOffCall()) {
|
||||
@ -144,6 +137,10 @@ public class OutgoingRinger implements MediaPlayer.OnCompletionListener, MediaPl
|
||||
}
|
||||
}
|
||||
|
||||
mediaPlayer.start();
|
||||
try {
|
||||
mp.start();
|
||||
} catch (IllegalStateException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user