提交 756878a9 作者: 王苏进

feat: fix

上级 29fa1f76
......@@ -36,4 +36,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 0212500e480860ee905e9b132693e030f85d651b
COCOAPODS: 1.15.2
COCOAPODS: 1.14.3
......@@ -33,9 +33,10 @@ class _MyAppState extends State<MyApp> {
initPlatformState();
_aivoicePlugin.onAsrResultReceived.listen((event) {
setState(() {
_text = event["text"];
});
final a = event["finish"];
setState(() {});
_text = "$a";
// print(event["text"]);
});
_aivoicePlugin.prepareEnvironment({"appId": "2301072440"});
......@@ -84,7 +85,14 @@ class _MyAppState extends State<MyApp> {
onPressed: () {
_aivoicePlugin.ttsSynthesis({});
},
child: const Text('合成'))
child: const Text('合成')),
TextButton(
onPressed: () {
_aivoicePlugin.ttsStartEngineBtnClick(
{"text": "引擎启动成功,收到该回调后,在单次合成场景下收到该回调时语音合成已经开始,同时数据字段为该次请求的请求 ID; 连续合成场景下还需要再发送合成指令,才真正的开始合成。"});
_aivoicePlugin.ttsSynthesis({});
},
child: const Text('一件开始'))
// TextButton(
// onPressed: () {
// _aivoicePlugin.initEngine(configMap);
......
......@@ -193,7 +193,7 @@ static int TTS_MAX_RETRY_COUNT = 3;
// // 按装机量授权,不限制 APP 的包名和使用次数,但是限制使用离线合成的设备数量
// //【必需配置】离线合成鉴权相关:Authenticate Address
// [self.curEngine setStringParam:SDEF_AUTHENTICATE_ADDRESS forKey:SE_PARAMS_KEY_AUTHENTICATE_ADDRESS_STRING];
// //【必需配置】离线合成鉴权相关:Authenticate Uri
// //【必需配置】离��合成鉴权相关:Authenticate Uri
// [self.curEngine setStringParam:SDEF_AUTHENTICATE_URI forKey:SE_PARAMS_KEY_AUTHENTICATE_URI_STRING];
// NSString* curBusinessKey = [self.settings getString:SETTING_BUSINESS_KEY];
// NSString* curAuthenticateSecret = [self.settings getString:SETTING_AUTHENTICATE_SECRET];
......@@ -660,7 +660,7 @@ static int TTS_MAX_RETRY_COUNT = 3;
case SEConnectTimeout:
case SEReceiveTimeout:
case SENetLibError:
// 遇到网络错误时建议重,重试次数不超过 3 次
// 遇到网络错误时建议重��,重试次数不超过 3 次
needStop = ![self retrySynthesis];
if (needStop) {
self.engineErrorOccurred = TRUE;
......@@ -743,7 +743,7 @@ static int TTS_MAX_RETRY_COUNT = 3;
dispatch_async(dispatch_get_main_queue(), ^{
// self.pauseResumeButton.enabled = TRUE;
self.ttsPlayingProgress = 0.0;
// [self updateTtsResultText:playingId];
[self updateTtsResultText:playingId];
});
}
......@@ -774,26 +774,29 @@ static int TTS_MAX_RETRY_COUNT = 3;
- (void)speechFinishPlaying :(NSData *)data {
NSString* playingId = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"TTS finish playing: %@", playingId);
// if (![self.settings getBool:SETTING_TTS_ENABLE_DUMP_NOVEL_TTS_DETAIL]) {
// [self.ttsSynthesisMap removeObjectForKey:playingId];
// }
// if (![self.settings getBool:SETTING_TTS_ENABLE_DUMP_NOVEL_TTS_DETAIL]) {
// [self.ttsSynthesisMap removeObjectForKey:playingId];
// }
dispatch_async(dispatch_get_main_queue(), ^{
self.ttsPlayingProgress = 1.0;
[self updateTtsResultText:playingId];
});
if (self.ttsSynthesisFromPlayer) {
if( self.ttsSynthesisIndex == (self.ttsSynthesisText.count - 1)) {
if(self.ttsSynthesisIndex == 0) {
// 播放完第一遍后自动停止
[self stopEngineBtnClicked];
if([self.delegate respondsToSelector:@selector(onRecieve:)]) {
[self.delegate onRecieve:@{@"finish" : @(true)}];
}
} else {
[self triggerSynthesis];
self.ttsSynthesisFromPlayer = FALSE;
}
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论