-
Notifications
You must be signed in to change notification settings - Fork 320
Fix: Same first voice instruction is played in Offline and Online player. #6758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Same first voice instruction is played in Offline and Online player. #6758
Conversation
…ls to both MapboxSpeechApi and MapboxVoiceInstructionsPlayer. As a result, MapboxAudioGuidanceVoice will wait until the player finishes playing the previous announcement before attempting to play the next one. Using coroutines also allows for API and Player cancellation alongside the parent Job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting that I tested this downstream in 1TAP with a SNAPSHOT
and can't reproduce NAVAND-1001
🎉
It does not fix the root cause of instruction being played twice, although it does reduce the probability of such a situation. |
BTW, soon we might want to interrupt the instruction if the new one arrives (https://mapbox.atlassian.net/browse/NAVSDK-775). |
I've opened a draft PR that would fix the issue that a described here: #6766. |
Looking good to me, I've tested downstream in 1TAP with a |
@@ -147,7 +148,8 @@ internal constructor( | |||
.filter { it.voiceInstructions != lastPlayedInstructions } | |||
.flatMapConcat { | |||
lastPlayedInstructions = it.voiceInstructions | |||
audioGuidance.speak(it.voiceInstructions) | |||
val announcement = audioGuidance.speak(it.voiceInstructions) | |||
flowOf(announcement) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you emit a flow with a single value, you can use a simple map
instead of flatMapConcat
.
After that you can replace two consecutive map
s with one map
.
Closing in favor of #6766 |
Closes NAVAND-1001
Description
Updated
MapboxAudioGuidanceVoice
to use coroutines to synchronize calls to bothMapboxSpeechApi
andMapboxVoiceInstructionsPlayer
. As a result,MapboxAudioGuidanceVoice
will wait until the player finishes playing the previous announcement before attempting to play the next one. Using coroutines also allows API and Player cancellation alongside the parentJob
.