Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
aivoice_plugin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
王苏进
aivoice_plugin
Commits
4677cd35
提交
4677cd35
authored
10月 30, 2024
作者:
王苏进
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: android bug fix
上级
703d80e6
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
72 行增加
和
7 行删除
+72
-7
AivoicePlugin.kt
...c/main/kotlin/com/example/aivoice_plugin/AivoicePlugin.kt
+72
-7
没有找到文件。
android/src/main/kotlin/com/example/aivoice_plugin/AivoicePlugin.kt
浏览文件 @
4677cd35
...
@@ -58,54 +58,119 @@ class AivoicePlugin: FlutterPlugin, MethodCallHandler, EventChannel.StreamHandle
...
@@ -58,54 +58,119 @@ class AivoicePlugin: FlutterPlugin, MethodCallHandler, EventChannel.StreamHandle
override
fun
onMethodCall
(
@NonNull
call
:
MethodCall
,
@NonNull
result
:
Result
)
{
override
fun
onMethodCall
(
@NonNull
call
:
MethodCall
,
@NonNull
result
:
Result
)
{
when
(
call
.
method
)
{
when
(
call
.
method
)
{
"initEngine"
->
{
"initEngine"
->
{
try
{
asrConfig
=
call
.
arguments
as
Map
<
String
,
String
>?
asrConfig
=
call
.
arguments
as
Map
<
String
,
String
>?
// 现有的实现
asrCenter
.
initEngineBtnClicked
()
asrCenter
.
initEngineBtnClicked
()
result
.
success
(
true
)
}
catch
(
e
:
Exception
)
{
result
.
error
(
"INIT_ERROR"
,
e
.
message
,
null
)
}
}
}
"stopEngine"
->
{
"stopEngine"
->
{
// 现有的实现
try
{
asrCenter
.
stopEngineBtnClicked
()
asrCenter
.
stopEngineBtnClicked
()
result
.
success
(
true
)
}
catch
(
e
:
Exception
)
{
result
.
error
(
"STOP_ERROR"
,
e
.
message
,
null
)
}
}
}
"uninitEngine"
->
{
"uninitEngine"
->
{
// 现有的实现
try
{
asrCenter
.
uninitEngineBtnClicked
()
asrCenter
.
uninitEngineBtnClicked
()
result
.
success
(
true
)
}
catch
(
e
:
Exception
)
{
result
.
error
(
"UNINIT_ERROR"
,
e
.
message
,
null
)
}
}
}
"startOrStopEngine"
->
{
"startOrStopEngine"
->
{
try
{
Log
.
i
(
"aivoic_plugin"
,
"开始识别了"
)
Log
.
i
(
"aivoic_plugin"
,
"开始识别了"
)
asrCenter
.
startEngineBtnClicked
()
asrCenter
.
startEngineBtnClicked
()
result
.
success
(
true
)
}
catch
(
e
:
Exception
)
{
result
.
error
(
"START_ERROR"
,
e
.
message
,
null
)
}
}
}
"prepareEnvironment"
->
{
"prepareEnvironment"
->
{
try
{
val
re
=
SpeechEngineGenerator
.
PrepareEnvironment
(
context
,
context
as
Application
?)
val
re
=
SpeechEngineGenerator
.
PrepareEnvironment
(
context
,
context
as
Application
?)
result
.
success
(
re
)
}
catch
(
e
:
Exception
)
{
result
.
error
(
"PREPARE_ERROR"
,
e
.
message
,
null
)
}
}
}
"ttsStartEngineBtnClick"
->
{
"ttsStartEngineBtnClick"
->
{
ttsNovelCenter
.
startEngineBtnClicked
(
call
.
argument
(
"text"
));
try
{
ttsNovelCenter
.
startEngineBtnClicked
(
call
.
argument
(
"text"
))
result
.
success
(
true
)
}
catch
(
e
:
Exception
)
{
result
.
error
(
"TTS_START_ERROR"
,
e
.
message
,
null
)
}
}
}
"ttsSynthesis"
->
{
"ttsSynthesis"
->
{
try
{
ttsNovelCenter
.
synthesisBtnClicked
()
ttsNovelCenter
.
synthesisBtnClicked
()
result
.
success
(
true
)
}
catch
(
e
:
Exception
)
{
result
.
error
(
"TTS_SYNTHESIS_ERROR"
,
e
.
message
,
null
)
}
}
}
"ttsStopEngineBtnClicked"
->
{
"ttsStopEngineBtnClicked"
->
{
try
{
ttsNovelCenter
.
stopEngineBtnClicked
()
ttsNovelCenter
.
stopEngineBtnClicked
()
result
.
success
(
true
)
}
catch
(
e
:
Exception
)
{
result
.
error
(
"TTS_STOP_ERROR"
,
e
.
message
,
null
)
}
}
}
"ttsPausePlayback"
->
{
"ttsPausePlayback"
->
{
try
{
ttsNovelCenter
.
pausePlayback
()
ttsNovelCenter
.
pausePlayback
()
result
.
success
(
true
)
}
catch
(
e
:
Exception
)
{
result
.
error
(
"TTS_PAUSE_ERROR"
,
e
.
message
,
null
)
}
}
}
"ttsResumePlayback"
->
{
"ttsResumePlayback"
->
{
try
{
ttsNovelCenter
.
resumePlayback
()
ttsNovelCenter
.
resumePlayback
()
result
.
success
(
true
)
}
catch
(
e
:
Exception
)
{
result
.
error
(
"TTS_RESUME_ERROR"
,
e
.
message
,
null
)
}
}
}
"ttsInitEngine"
->
{
"ttsInitEngine"
->
{
try
{
ttsConfig
=
call
.
arguments
()
ttsConfig
=
call
.
arguments
()
ttsNovelCenter
.
initEngineInternal
()
ttsNovelCenter
.
initEngineInternal
()
result
.
success
(
true
)
}
catch
(
e
:
Exception
)
{
result
.
error
(
"TTS_INIT_ERROR"
,
e
.
message
,
null
)
}
}
}
"ttsUnInitEngine"
->
{
"ttsUnInitEngine"
->
{
try
{
ttsNovelCenter
.
uninitEngine
()
ttsNovelCenter
.
uninitEngine
()
result
.
success
(
true
)
}
catch
(
e
:
Exception
)
{
result
.
error
(
"TTS_UNINIT_ERROR"
,
e
.
message
,
null
)
}
}
}
"destoryTtsNovel"
->
{
"destoryTtsNovel"
->
{
try
{
ttsNovelCenter
.
destroy
()
ttsNovelCenter
.
destroy
()
result
.
success
(
true
)
}
catch
(
e
:
Exception
)
{
result
.
error
(
"TTS_DESTROY_ERROR"
,
e
.
message
,
null
)
}
}
}
"destoryAsrVoice"
->
{
"destoryAsrVoice"
->
{
asrCenter
.
destroy
();
try
{
asrCenter
.
destroy
()
result
.
success
(
true
)
}
catch
(
e
:
Exception
)
{
result
.
error
(
"ASR_DESTROY_ERROR"
,
e
.
message
,
null
)
}
}
}
else
->
{
else
->
{
result
.
notImplemented
()
result
.
notImplemented
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论