[update] use aliyun andriod sdk
This commit is contained in:
23
lib/utils/tts_util.dart
Normal file
23
lib/utils/tts_util.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class TtsUtil {
|
||||
static const MethodChannel _channel =
|
||||
MethodChannel('com.example.ai_chat_assistant/tts');
|
||||
|
||||
static Future<T?> execute<T>(String method,
|
||||
[Map<Object, Object>? arguments]) {
|
||||
return _channel.invokeMethod(method, arguments);
|
||||
}
|
||||
|
||||
static Future<bool> start(bool isChinese) async {
|
||||
return await execute('start', {'isChinese': isChinese});
|
||||
}
|
||||
|
||||
static Future<void> send(String text) async {
|
||||
await execute('send', {'text': text});
|
||||
}
|
||||
|
||||
static Future<void> stopTts() async {
|
||||
await execute('stop');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user