generate

fun generate(voiceInstruction: VoiceInstructions, consumer: MapboxNavigationConsumer<Expected<SpeechError, SpeechValue>>)

Given VoiceInstructions the method will try to generate the voice instruction SpeechAnnouncement including the synthesized speech mp3 file from Mapbox's API Voice. NOTE: this method will try downloading an mp3 file from server. If you use voice instructions predownloading (see VoiceInstructionsPrefetcher), invoke generatePredownloaded instead of this method in your VoiceInstructionsObserver.

See also

Parameters

voiceInstruction

VoiceInstructions object representing VoiceInstructions

consumer

is a SpeechValue including the announcement to be played when the announcement is ready or a SpeechError including the error information and a fallback with the raw announcement (without file) that can be played with a text-to-speech engine.