android - fade in and out music while speaking a text -


I have an Android application that uses TTS (Text to Speech) API, everything is working perfectly But now I want to stop music (like the user playing music with the music) in or out, or even when the app speaks a text right now, I think both music and TTS messages are sent to the same stream (music) ), And understanding voice messages is important The Kil be.

I have tried to run the text on a different stream, such as audio manager. STREAM_NOTIFICATIONS stops this music, but when the text is spoken, it does not come back, so I did not achieve the goal. Nothing has been received so far, so I hope someone can help here. Thanks!

Whatever the last thing I'm doing though is not true, in case of a fairly dirty trick. Can help someone:

It is fixed with requestAudioFocus and AudioManager's abandomAudioFocus methods on ADI 8.

But for pre-versions, you can try to run TTS through a different stream channel, say STREAM_NOTIFICATIONS, then you just have to return the audio focus to STREAM_MUSIC how you can get it ? To send a silent string ("") to TTS but this time there will be an effect through STREAM_MUSIC: the music is closed, your TTS will speak the message, and in the end your music will come back after the sound alert. Not good or something to feel proud of, but ... if someone knows differently, I appreciate it.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -