@magiclane/maps-sdk
    Preparing search index...

    Class SoundPlayingServiceAbstract

    High-level static API for playing sounds and TTS through the SDK.

    This class exposes only static members and acts as a thin bridge to the native sound engine. Use SoundPlayingListener to observe playback lifecycle events, and SoundPlayingPreferences to configure per-severity playback settings.

    Index

    Constructors

    Accessors

    • get audioLowLatencyOutputFrameSize(): number

      Get the audio low-latency output frame size (Android only).

      On iOS this returns 0.

      Returns number

      The frame size in samples, or 0 when not supported

    • get audioOutput(): AudioOutput

      Returns the currently selected audio output type.

      Returns AudioOutput

      The active AudioOutput value

    • set audioOutput(audioOutput: AudioOutput): void

      Select the audio output type.

      Parameters

      Returns void

    • get callTimingDelay(): number

      Returns the current call timing delay (milliseconds).

      Returns number

      The delay in milliseconds

    • set callTimingDelay(delay: number): void

      Set call timing delay in milliseconds.

      Only relevant when audio is played as a Bluetooth phone call.

      Parameters

      • delay: number

        Delay in milliseconds

      Returns void

    • get canPlaySounds(): boolean

      Returns whether automatic playback of TTS instructions is enabled.

      Returns boolean

      True when automatic playback is enabled, false otherwise

    • set canPlaySounds(canPlaySound: boolean): void

      Enable or disable automatic playback of TTS instructions.

      Parameters

      • canPlaySound: boolean

        True to enable automatic playback, false to disable it

      Returns void

      cancelNavigationSoundsPlaying - Cancel currently playing navigation sounds

    • get nativeOutputSampleRate(): number

      Get the native audio output sample rate (Android only).

      On iOS this returns 0.

      Returns number

      The native sample rate, or 0 when not supported

    • get soundPlayingListener(): SoundPlayingListener

      Obtain the singleton SoundPlayingListener used to observe playback events.

      The listener is created once and registered with the platform. Use SoundPlayingListener.registerOnStart and SoundPlayingListener.registerOnStop to receive playback events.

      Returns SoundPlayingListener

      The singleton SoundPlayingListener instance

    • get soundSessionRequestPreferences(): SoundSessionRequestPreferences

      Return the currently configured sound session request preferences.

      The returned instance is a copy; set soundSessionRequestPreferences to persist changes.

      Returns SoundSessionRequestPreferences

      A SoundSessionRequestPreferences instance

    • set soundSessionRequestPreferences(
          preferences: SoundSessionRequestPreferences,
      ): void

      Apply sound session request preferences used when requesting audio focus from the platform.

      Parameters

      Returns void

    • get ttsDefaultLanguage(): Language
      Experimental

      Return the Language currently being used in the system as the default TTS language.

      Returns Language

      The default TTS Language

      SdkSettings.getVoice - The currently applied voice settings

    • get voiceVolume(): number

      Returns the current voice (TTS) volume.

      Returns number

      Integer volume in the range 0..10

      warningsVolume - Get or set the warnings volume

    • set voiceVolume(volume: number): void

      Set the voice (TTS) volume (0..10).

      If a system interruption is active (e.g., a phone call), the volume change may be deferred until the interruption ends.

      Parameters

      • volume: number

        Integer volume in range 0..10

      Returns void

      warningsVolume - Get or set the warnings volume

    • get warningsVolume(): number

      Returns the current warnings volume.

      Returns number

      Integer volume in the range 0..10

      voiceVolume - Get or set the voice (TTS) volume

    • set warningsVolume(volume: number): void

      Set the warnings volume (0..10).

      If a system interruption is active (e.g., a phone call), the volume change may be deferred until the interruption ends.

      Parameters

      • volume: number

        Integer volume in range 0..10

      Returns void

      voiceVolume - Get or set the voice (TTS) volume

    Methods

    • Cancel currently playing navigation sounds.

      Use this to immediately stop navigation-related audio playback.

      Returns void

    • Retrieve sound playback preferences for the given severity.

      The returned instance is a copy; call setSoundPlayingPreferences to persist modifications.

      Parameters

      • severity: AlertSeverity = AlertSeverity.information

        Alert severity to retrieve preferences for

      Returns SoundPlayingPreferences

      A SoundPlayingPreferences instance for the requested severity

    • Play a pre-recorded sound by id.

      Parameters

      • soundId: any

        Platform-specific identifier for the sound to play

      Returns void

    • Play the given text using TTS.

      Parameters

      • text: string

        The text to be synthesized and played

      • severity: AlertSeverity = AlertSeverity.information

        Optional severity used to select preferences (defaults to AlertSeverity.information)

      Returns void

    • Internal

      Reset cached listener. Should not be called by API users.

      Returns void

    • Apply sound playback preferences for the given severity.

      Only fields present in the provided SoundPlayingPreferences instance are applied. To change preferences, modify an instance returned by getSoundPlayingPreferences and call this method to persist the change.

      This method does not take into account any ongoing system interruptions.

      Parameters

      • soundPlayingPreferences: SoundPlayingPreferences

        Preferences to apply

      • severity: AlertSeverity = AlertSeverity.information

        Target alert severity (defaults to AlertSeverity.information)

      Returns void