mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-19 16:31:30 +00:00
parent
cc1bfec08a
commit
13c1b15dc2
@ -91,24 +91,19 @@ public class OutgoingRinger implements MediaPlayer.OnCompletionListener, MediaPl
|
|||||||
mediaPlayer.setAudioStreamType(AudioManager.STREAM_VOICE_CALL);
|
mediaPlayer.setAudioStreamType(AudioManager.STREAM_VOICE_CALL);
|
||||||
mediaPlayer.setOnCompletionListener(this);
|
mediaPlayer.setOnCompletionListener(this);
|
||||||
mediaPlayer.setOnPreparedListener(this);
|
mediaPlayer.setOnPreparedListener(this);
|
||||||
|
mediaPlayer.setLooping(loopEnabled);
|
||||||
|
|
||||||
String packageName = context.getPackageName();
|
String packageName = context.getPackageName();
|
||||||
Uri dataUri = Uri.parse("android.resource://" + packageName + "/" + currentSoundID);
|
Uri dataUri = Uri.parse("android.resource://" + packageName + "/" + currentSoundID);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mediaPlayer.setDataSource(context, dataUri);
|
mediaPlayer.setDataSource(context, dataUri);
|
||||||
|
mediaPlayer.prepareAsync();
|
||||||
} catch (IllegalArgumentException | SecurityException | IllegalStateException | IOException e) {
|
} catch (IllegalArgumentException | SecurityException | IllegalStateException | IOException e) {
|
||||||
Log.w(TAG, e);
|
Log.w(TAG, e);
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
mediaPlayer.prepareAsync();
|
|
||||||
} catch (IllegalStateException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
Log.w(TAG, e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
@ -131,8 +126,6 @@ public class OutgoingRinger implements MediaPlayer.OnCompletionListener, MediaPl
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onPrepared(MediaPlayer mp) {
|
public void onPrepared(MediaPlayer mp) {
|
||||||
mediaPlayer.setLooping(loopEnabled);
|
|
||||||
|
|
||||||
AudioManager am = ServiceUtil.getAudioManager(context);
|
AudioManager am = ServiceUtil.getAudioManager(context);
|
||||||
|
|
||||||
if (am.isBluetoothScoAvailableOffCall()) {
|
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