Play audio through tts

There is one embedded TTS engine integrated in Voice Assistant, other apps can also play through the same TTS engine, for example, play Nav audio guidance, Voice Assistant will base on the stream type it filled to manage audio focus. Please integrate the following Intent and broadcast to support the play.

  • Action: com.telenav.assistant.PLAY_AUDIO
  • Bundle Fields:
Key Value ValueType
text "turn right" String
stream_type Navigation, Music, etc. String enum, for Voice Assistant to manage audio focus priority, refer to: https://source.android.com/devices/automotive/audio/audio-focus
mode queue mode The queuing strategy to use, QUEUE_ADD or QUEUE_FLUSH
  • Code Example of how to send the Intent to Voice Assistant:
1
2
3
4
5
6
7
    val intentAction = "com.telenav.assistant.PLAY_AUDIO"
    val assistantIntent = Intent(intentAction)
    assistantIntent.putExtra("text", textToSpeak)
    assistantIntent.putExtra("stream_type",streamType)
    assistantIntent.putExtra("mode",mode)

    context.sendBroadcast(assistantIntent)