Android音频开始慢慢播放蓝牙sco

时间:2016-10-20 08:51:06

标签: android audio bluetooth text-to-speech bluetooth-sco

我开发的应用程序将通过蓝牙SCO播放TextToSpeech音频。连接到目标蓝牙设备(汽车音响),然后指示TextToSpeech引擎说话后,音频开始播放大约需要15秒,即使我在连接SCO和播放TextToSpeech之间等待几秒钟。

以下是我用于通过SCO连接的代码:

AudioManager audioM = (AudioManager) getApplicationContext().getSystemService(getApplicationContext().AUDIO_SERVICE);
audioM.setMode(audioM.MODE_IN_COMMUNICATION);
audioM.setBluetoothScoOn(true);
audioM.startBluetoothSco();
audioM.setSpeakerphoneOn(false);

以下是我用来播放TextToSpeech的代码:

String text = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
HashMap<String, String> ttsParams = new HashMap<String, String>();
ttsParams.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_VOICE_CALL));
mTts.speak(text, TextToSpeech.QUEUE_FLUSH, ttsParams);

其他Android应用程序(包括VOIP和内置电话应用程序)不会受到此延迟的影响。我创建的等效iOS应用程序没有延迟。所以我知道问题不在于立体声。

非常感谢任何帮助,谢谢

1 个答案:

答案 0 :(得分:1)

事实证明这个问题特定于我正在测试的低端设备。我试过的所有其他设备都会立即播放。