force re-init players after stop() to ckeck impact on 2810

This commit is contained in:
sonora 2016-07-25 14:20:18 +02:00
parent e7138a76e2
commit f16db6c958
3 changed files with 9 additions and 3 deletions

View file

@ -410,9 +410,6 @@ public class OsmandApplication extends MultiDexApplication {
} }
} else { } else {
// Test for Issues #1351 and #2810
//player = null;
if (player == null || !Algorithms.objectEquals(voiceProvider, player.getCurrentVoice()) || force) { if (player == null || !Algorithms.objectEquals(voiceProvider, player.getCurrentVoice()) || force) {
appInitializer.initVoiceDataInDifferentThread(uiContext, voiceProvider, run, showDialog); appInitializer.initVoiceDataInDifferentThread(uiContext, voiceProvider, run, showDialog);
} }

View file

@ -61,6 +61,11 @@ public class MediaCommandPlayerImpl extends AbstractPrologCommandPlayer implemen
if (mediaPlayer != null){ if (mediaPlayer != null){
mediaPlayer.stop(); mediaPlayer.stop();
} }
// TODO: Issue #2810: Audio focus issues when ongoing prompt is interrupted by stop(), i.e. when off-route is detected. Temp workaround is to nullify and always re-init player.
//if (ctx != null && ctx.getSettings().AUDIO_STREAM_GUIDANCE.get() == 0) {
mediaPlayer.release();
mediaPlayer = null;
//}
if (ctx != null) { if (ctx != null) {
abandonAudioFocus(); abandonAudioFocus();
} }

View file

@ -134,6 +134,10 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
if (mTts != null){ if (mTts != null){
mTts.stop(); mTts.stop();
} }
// TODO: Issue #2810: Audio focus issues when ongoing prompt is interrupted by stop(), i.e. when off-route is detected. Temp workaround is to nullify and always re-init player.
//if (ctx != null && ctx.getSettings().AUDIO_STREAM_GUIDANCE.get() == 0) {
mTts = null;
//}
if (ctx != null) { if (ctx != null) {
abandonAudioFocus(); abandonAudioFocus();
} }