HERE Android SDK Developer's Guide

AudioPlayer

The class AudioPlayer is a member of com.here.android.mpa.guidance.NavigationManager.

Class Summary

public class NavigationManager.AudioPlayer

extends java.lang.Object

[For complete information, see the section Class Details]

Field Summary

Table 1. Fields in AudioPlayer
Fields

public static final float DEFAULT_AUDIO_VOLUME

Default audio player volume

public static final float DEFAULT_SPEECH_RATE

Default speech rate

Method Summary

Table 2. Methods in AudioPlayer
Methods

public int getStreamId ()

Get the current Audio stream used by NavigationManager

public float getTtsSpeechRate ()

Gets the TTS speech rate used by NavigationManager

public float getVolume ()

Get the Audio Volume used by NavigationManager

public void setDelegate (AudioPlayerDelegate delegate)

Sets NavigationManager.AudioPlayer delegate.

public AudioPlayer setStreamId (int audioStream)

Set the Audio Stream used by NavigationManager .

public void setTtsSpeechRate (float rate)

Set the TTS speech rate used by NavigationManager when a TTS voice skin is chosen through setVoiceSkin.

public AudioPlayer setVolume (float audioVolume)

Set the Audio Volume used by NavigationManager

public void stop ()

Stop the navigation instruction currently being played.

Class Details

Field Details

public static final float DEFAULT_AUDIO_VOLUME

Default audio player volume

public static final float DEFAULT_SPEECH_RATE

Default speech rate

Method Details

public int getStreamId ()

Get the current Audio stream used by NavigationManager

Returns:

the current audio stream id. One of the possible values from {code android.media.AudioManager} stream Id constants.

See also:

android.media.AudioManager

public float getTtsSpeechRate ()

Gets the TTS speech rate used by NavigationManager

Returns:

The TTS speech rate in the range of (0.0f, 2.0f] or DEFAULT_SPEECH_RATE if a custom value is not set.

public float getVolume ()

Get the Audio Volume used by NavigationManager

Returns:

float A float percentage value in the range of [0.0f, 1.0f] or DEFAULT_AUDIO_VOLUME if a custom value is not set

public void setDelegate (AudioPlayerDelegate delegate)

Sets NavigationManager.AudioPlayer delegate. Clients can implement AudioPlayerDelegate to take over playback of audio files and TTS strings. Note: by delegating NavigationManager.AudioPlayer it immediately stops all current audio and TTS playbacks by the SDK.

Parameters:

  • delegate

public AudioPlayer setStreamId (int audioStream)

Set the Audio Stream used by NavigationManager . By default, android.media.AudioManager.STREAM_MUSIC is used.

Parameters:

  • audioStream

    int android.media.AudioManager for the set of system streams

See also:

android.media.AudioManager

public void setTtsSpeechRate (float rate)

Set the TTS speech rate used by NavigationManager when a TTS voice skin is chosen through setVoiceSkin. The specified TTS speech rate is applied immediately if a TTS voice skin is chosen when this is called; otherwise, it will not be applied until a TTS voice skin is chosen.

Parameters:

  • rate

    A value in the range of (0.0f, 2.0f]. Default value is DEFAULT_SPEECH_RATE. Normal speech rate is 1.0. Smaller value results in slower speech.

See also:

DEFAULT_SPEECH_RATE

public AudioPlayer setVolume (float audioVolume)

Set the Audio Volume used by NavigationManager

The volume change will not take effect until the next navigation instruction is played. stop() can be used to stop the currently playing instruction.

Parameters:

  • audioVolume

    float A float percentage value in the range of [0.0f, 1.0f]. A value of DEFAULT_AUDIO_VOLUME can be set to use the system default volume.

See also:

stop()

public void stop ()

Stop the navigation instruction currently being played. Future instructions will continue to be played.

This can be used in conjunction with setVolume(float) to mute the navigation audio immediately.

See also:

setVolume(float)