This commit is contained in:
sonora 2019-07-27 21:28:19 +02:00
parent 700419c477
commit 3400b01da0

View file

@ -178,10 +178,11 @@ public class MediaCommandPlayerImpl extends AbstractPrologCommandPlayer implemen
.setContentType(AudioAttributes.CONTENT_TYPE_SPEECH) .setContentType(AudioAttributes.CONTENT_TYPE_SPEECH)
.build()); .build());
} }
if (Build.VERSION.SDK_INT < 26) { //if (Build.VERSION.SDK_INT < 26) {
// Deprecated in API Level 26, use above AudioAtrributes instead // Deprecated in API Level 26, use above AudioAtrributes instead
// TODO: convert code to replace deprecated setAudioStreamType and requestAudioFocus(AudioManager.OnAudioFocusChangeListener l, int streamType, int durationHint)
mediaPlayer.setAudioStreamType(streamType); mediaPlayer.setAudioStreamType(streamType);
} //}
mediaPlayer.setDataSource(file.getAbsolutePath()); mediaPlayer.setDataSource(file.getAbsolutePath());
mediaPlayer.prepare(); mediaPlayer.prepare();
mediaPlayer.setOnCompletionListener(this); mediaPlayer.setOnCompletionListener(this);