dubbing_lib.dart 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import 'dart:async';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter/services.dart';
  4. class DubbingLib {
  5. static final DubbingLib _instance = DubbingLib();
  6. static DubbingLib get instance => _instance;
  7. static const MethodChannel _channel =
  8. const MethodChannel('dubbing_lib');
  9. static Future<String> get platformVersion async {
  10. final String version = await _channel.invokeMethod('getPlatformVersion');
  11. return version;
  12. }
  13. Future<void> setExtraFullScreen() {
  14. //todo 暂时视频播放时全屏StatusBar bug
  15. return _channel.invokeMethod("setExtraFullScreen");
  16. }
  17. Future<String> mixinAudio(
  18. {List<String> audioPaths, String bgmPath,
  19. List<int> startTimeList, List<int> durationList, List<int> endTimeList,
  20. String decodeDirPath, String mixinFilePath, String resultPath}) {
  21. return _channel.invokeMethod("mixinAudio",
  22. {
  23. "audioPaths": audioPaths,
  24. "bgmPath": bgmPath,
  25. "durationList": durationList, // Android used only
  26. "endTimeList": endTimeList, // Android used only
  27. "decodeDirPath": decodeDirPath, // Android used only
  28. "mixinFilePath": mixinFilePath, // Android used only
  29. "resultPath": resultPath,
  30. "startTimeList": startTimeList, // iOS used only
  31. });
  32. }
  33. Future<String> mixinVideoAndAudio(
  34. {String bgmPath, String videoPath, String resultPath}) {
  35. return _channel.invokeMethod("mixinVideoAndAudio",
  36. {
  37. "bgmPath": bgmPath,
  38. "videoPath": videoPath,
  39. "resultPath": resultPath,
  40. });
  41. }
  42. }