android - Audiomanager.abandonAudioFocus doesn't resume playing -
I Audio Player'm trying to silence, while there is a phrase spoken by the text-to-speech system. Audio supervisor, as is required, the amount is requested when audio focus decreases, but called Odiyo focus on movement, so the volume is not restored and no callback Odiyo focus to leave the This is my code:
Private Class SpeakRunnable Tools Runnabel {String mText; Public speech (lesson of letters) {mText = text; } @ Override Public Wide Run () {stream_volume = am.getStreamVolume (AudioManager.STREAM_MUSIC); am.requestAudioFocus (New OnAudioFocusChangeListener () {@Override public void onAudioFocusChange (integer focusChange) {// if the focus ..... HashMap of & lt Czech, string, string & gt; parameter = new HashMap & LT; string, string & gt; (); parameters. put (TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "no"); talker.speak (MTEXT, TextToSpeech.QUEUE_ADD, parameters);}}, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK); }} and:
talker.setOnUtteranceProgressListener (New UtteranceProgressListener () {@Override public void OnStart (string utteranceId) {} @Override public zero onError (string utteranceId) {} @Override callback for public void onDone (string utteranceId) {am.abandonAudioFocus (new OnAudioFocusChangeListener () {@Override public void onAudioFocusChange (integer focusChange) {Log.v (APP_ID, "" );}});}}}; Any ideas? thank you in advanced.
You need the same AudioManager.OnAudioFocusChangeListener passing < Code> Discard Audio Focus which you have passed from requestAudioFocus . It is described in: Public Intensity Absence Audio Focus (Audio Manager. OnOio Focus Change Listener L) Parameter I listener with whom the focus was requested. Also, I do not think you the onOudioFocusChange to call as a result of leaving your audience should expect legal audio focus when you leave the audio focus, audio focus of will be communicated to other Audio focus client requesting that received focus you Want to read that it works internally in Android So how is it you can see it.
Comments
Post a Comment