Skip to content

feat: next waypoint, simulation speed and voice volume - #30

Merged
mfazekas merged 4 commits into
mainfrom
feat/session-controls
Oct 28, 2026
Merged

mfazekas merged 4 commits into
mainfrom
feat/session-controls

Conversation

@mfazekas

@mfazekas mfazekas commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Adds advancing to the next waypoint, simulation speed and voice volume, which ATOMIQTECH and Google's SDK offer (competitor report items 6, 7 and 11; homee #69, #83, #50; pawan-pk #25).

Navigation.advanceToNextLeg(): void;
Navigation.setAutoAdvanceLegs(enabled: boolean): void; // default true
Navigation.setSimulationSpeed(multiplier: number): void; // default 1
Navigation.setVoiceVolume(volume: number): void; // 0..1, independent of setVoiceMuted

They are process-wide setters like setVoiceMuted, so they also apply to <NavigationView> and <RNNavigationView>. The RNNavigationView example screen gets a "Next stop: on arrival / manual" toggle, a two-stop route (Ferry Building, then Treasure Island) and Next stop / speed (1×, 2×, 4×) / volume chips.

How it works:

  1. Legs: iOS uses CoreConfig.multilegAdvancing = .manually { autoAdvanceLegs } and switchLeg; Android an ArrivalController returning autoAdvanceLegs and navigateNextRouteLeg. Both SDKs ask once per arrival, so turning auto-advance on while waiting at a waypoint doesn't move on.
  2. Speed: Android sets MapboxReplayer.playbackSpeed. On iOS the SDK's simulator speed is internal, so at 1× with auto-advance (the default) iOS simulates with the SDK's LocationSource.simulation exactly as before. At another speed or with manual advancing, RNMBXNavigationSimulator drives guidance as a custom location source. Changing either mid-route swaps the source and carries on from the current location; the swap waits while an instruction is spoken, since it replaces the speech synthesizer.
  3. Android's replay and the iOS custom simulator go one leg at a time, waiting at a waypoint until guidance moves on. Simulated locations report the route's speed, not multiplied, on both platforms.
  4. Volume: Android MapboxVoiceInstructionsPlayer.volume, iOS speechSynthesizer.volume = .override(v). The iOS system voice fallback (e.g. offline) ignores it.

Verified: yarn lint, typecheck, test, docs, and a device pass on the iOS simulator and an Android emulator, simulated, on the RNNavigationView screen. Auto-advance continues past the Ferry Building on its own at 1×, 2× and 4× on both platforms; the single-stop route arrives normally, and iOS at 1× matches a build with the SDK's default advancing. Manual mode waits at the stop until "Next stop". Speed changes apply mid-route, and the simulation keeps moving while the map is panned. Volume and mute apply on both, and are re-applied on iOS after a simulator swap (checked in logs; devices were muted).

Limitations:

  1. Higher simulation speeds can make guidance go off-route at sharp turns and reroute (seen at U-turns from 4× on Android and at 8× on iOS). Android's replay doesn't follow reroutes, so it can then stop short of the destination.
  2. "Next stop" away from the waypoint makes guidance reroute from where it is, and in simulation again after the jump to the next leg, so it reroutes twice.
  3. On iOS, the second leg of the two-stop route speaks the first leg's voice instructions while the banner is right. A build without this PR does the same; Android is fine.

…otype)

Adds Navigation.advanceToNextLeg, setAutoAdvanceLegs, setSimulationSpeed and
setVoiceVolume on iOS and Android, with controls on the RNNavigationView
example screen. iOS simulates with its own route simulator, since the SDK's
speed multiplier isn't public.
… legs

Uses RNMBXNavigationSimulator only at another speed or with manual leg
advancing, and switches between the two mid-route. Simulated locations
report the route's speed on both platforms.
Switching between the SDK's simulator and ours applies a new core config,
which replaces the speech synthesizer; wait until it stops speaking.
Documents the reroutes when skipping a leg mid-way and at 4× and above,
and drops 8× from the example.
@mfazekas mfazekas changed the title feat: next waypoint, simulation speed and voice volume (prototype) feat: next waypoint, simulation speed and voice volume Oct 28, 2026
@mfazekas
mfazekas marked this pull request as ready for review October 28, 2026 20:08
@mfazekas
mfazekas merged commit eea531a into main Oct 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant