[Opt3.0]自动切换Tts实现
This commit is contained in:
@@ -53,11 +53,24 @@ public class AIAssist {
|
||||
private AIAssist(Context context) {
|
||||
try {
|
||||
// 暂时换成反射,解决死锁问题
|
||||
// TODO:("支持切换思必驰和科大讯飞")
|
||||
Class<?> clazz = Class.forName("com.mogo.tts.pad.PadTTS");
|
||||
// Class<?> clazz = Class.forName("com.mogo.tts.iflytek.IFlyTekTts");
|
||||
mTTS = (IMogoTTS) clazz.getConstructor().newInstance();
|
||||
mTTS.init(context);
|
||||
Class<?> clazz1 = null;
|
||||
Class<?> clazz2 = null;
|
||||
try {
|
||||
clazz1 = Class.forName("com.mogo.tts.pad.PadTTS");
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
try {
|
||||
clazz2 = Class.forName("com.mogo.tts.iflytek.IFlyTekTts");
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
if (clazz1 != null) {
|
||||
mTTS = (IMogoTTS) clazz1.getConstructor().newInstance();
|
||||
} else if (clazz2 != null) {
|
||||
mTTS = (IMogoTTS) clazz2.getConstructor().newInstance();
|
||||
}
|
||||
if (mTTS != null) {
|
||||
mTTS.init(context);
|
||||
}
|
||||
// mTTS = (IMogoTTS) ARouter.getInstance().build(MogoTTSConstants.API_PATH).navigation(context.getApplicationContext());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user