Let AudioAttributes supercede in API 26 and above

This commit is contained in:
sonora 2019-07-27 20:28:02 +02:00
parent a35e627432
commit 700419c477

View file

@ -178,7 +178,10 @@ public class MediaCommandPlayerImpl extends AbstractPrologCommandPlayer implemen
.setContentType(AudioAttributes.CONTENT_TYPE_SPEECH)
.build());
}
mediaPlayer.setAudioStreamType(streamType);
if (Build.VERSION.SDK_INT < 26) {
// Deprecated in API Level 26, use above AudioAtrributes instead
mediaPlayer.setAudioStreamType(streamType);
}
mediaPlayer.setDataSource(file.getAbsolutePath());
mediaPlayer.prepare();
mediaPlayer.setOnCompletionListener(this);