googlemaps / googlemaps/flutter-navigation-sdk
[Feature request]: Voice Guidance Event Callbacks
- Dominant language
- Dart
- Stars
- 75
- Forks
- 54
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 5
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Use case
When building navigation apps with custom voice announcements (e.g., toll section warnings, speed alerts), there's no way to coordinate timing with the SDK's built-in voice guidance. This causes overlapping speech where neither message is audible, resulting in a poor user experience.
Currently, we can only estimate when the SDK might be speaking based on `NavInfo.distanceToNextStepMeters`, but this is unreliable since:
- Announcement timing varies by maneuver type and road conditions
- Traffic alerts and rerouting announcements are unpredictable
- Different languages have different speech durations
### Proposal
Add event callbacks to notify when voice guidance speech starts and completes:
```
// Option A: Dedicated listener
GoogleMapsNavigator.setVoiceGuidanceListener((VoiceGuidanceEvent event) {
switch (event) {
case VoiceGuidanceStarted(instruction: final text):
// SDK started speaking - pause custom TTS queue
case VoiceGuidanceCompleted():
// SDK finished speaking - resume custom TTS queue
}
});
// Option B: Property on NavigationAudioGuidanceSettings
GoogleMapsNavigator.setAudioGuidance(
NavigationAudioGuidanceSettings(
guidanceType: NavigationAudioGuidanceType.alertsAndGuidance,
onSpeechStart: (String instruction) => ...,
onSpeechComplete: () => ...,
),
);
```
Contributor guide
Assessment
This issue has not been assessed yet.