MapboxVoiceInstructionsPlayer

class MapboxVoiceInstructionsPlayer @JvmOverloads constructor(    context: Context,     accessToken: String,     language: String,     options: VoiceInstructionsPlayerOptions = defaultOptions(),     audioFocusDelegate: AsyncAudioFocusDelegate = defaultAudioFocusDelegate(context, options),     timerFactory: Provider<Timer> = defaultTimerFactory())

Hybrid implementation of MapboxVoiceInstructionsPlayer combining VoiceInstructionsTextPlayer and VoiceInstructionsFilePlayer speech players.

Parameters

context

Context

accessToken

String

language

Locale language (in a format acceptable by Locale)

audioFocusDelegate
timerFactory

Provider (optional)

Constructors

Link copied to clipboard
fun MapboxVoiceInstructionsPlayer(    context: Context,     accessToken: String,     language: String,     options: VoiceInstructionsPlayerOptions = defaultOptions(),     audioFocusDelegate: AudioFocusDelegate)
Link copied to clipboard
fun MapboxVoiceInstructionsPlayer(    context: Context,     accessToken: String,     language: String,     options: VoiceInstructionsPlayerOptions = defaultOptions(),     audioFocusDelegate: AsyncAudioFocusDelegate = defaultAudioFocusDelegate(context, options),     timerFactory: Provider<Timer> = defaultTimerFactory())

Functions

Link copied to clipboard
fun clear()

Clears any announcements queued.

Link copied to clipboard
fun play(announcement: SpeechAnnouncement, consumer: MapboxNavigationConsumer<SpeechAnnouncement>)

Given SpeechAnnouncement the method will play the voice instruction. If a voice instruction is already playing or other announcement are already queued, the given voice instruction will be queued to play after.

Link copied to clipboard
fun shutdown()

Releases the resources used by the speech player. If called while an announcement is currently playing, the announcement should end immediately and any announcements queued should be cleared.

Link copied to clipboard
fun volume(state: SpeechVolume)

The method will set the volume to the specified level from SpeechVolume. Volume is specified as a float ranging from 0 to 1 where 0 is silence, and 1 is the maximum volume (the default behavior).