speech_plugin.dart 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import 'dart:async';
  2. import 'package:flutter/services.dart';
  3. class SpeechPlugin {
  4. static const MethodChannel _channel =
  5. const MethodChannel('speech_plugin');
  6. static final SpeechPlugin _instance = SpeechPlugin();
  7. static SpeechPlugin get instance => _instance;
  8. static Future<String> get platformVersion async {
  9. final String version = await _channel.invokeMethod('getPlatformVersion');
  10. return version;
  11. }
  12. Future<void> initSdk() {
  13. return _channel.invokeMethod("initSpeechSdk");
  14. }
  15. Future<Map> evaluatorByAudio(String pathEvaluatorDecode, int index, String videoId, String recordPath, String en) {
  16. return _channel.invokeMethod("evaluatorByAudio", {
  17. "pathEvaluatorDecode": pathEvaluatorDecode,
  18. "index": index,
  19. "videoId": videoId,
  20. "recordPath": recordPath,
  21. "en": en
  22. });
  23. }
  24. Future<Map> evaluatorByMp4(String pathEvaluatorDecode, int index, String videoId, String recordPath, String en) {
  25. return _channel.invokeMethod("evaluatorByMp4", {
  26. "pathEvaluatorDecode": pathEvaluatorDecode,
  27. "index": index,
  28. "videoId": videoId,
  29. "recordPath": recordPath,
  30. "en": en
  31. });
  32. }
  33. }