import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class DubbingLib {

  static final DubbingLib _instance = DubbingLib();

  static DubbingLib get instance => _instance;

  static const MethodChannel _channel =
  const MethodChannel('dubbing_lib');

  static Future<String> get platformVersion async {
    final String version = await _channel.invokeMethod('getPlatformVersion');
    return version;
  }

  Future<void> setExtraFullScreen() {
    //todo 暂时视频播放时全屏StatusBar bug
    return _channel.invokeMethod("setExtraFullScreen");
  }

  Future<String> mixinAudio(
      {List<String> audioPaths, String bgmPath,
        List<int> startTimeList, List<int> durationList, List<int> endTimeList,
        String decodeDirPath, String mixinFilePath, String resultPath}) {
    return _channel.invokeMethod("mixinAudio",
        {
          "audioPaths": audioPaths,
          "bgmPath": bgmPath,
          "durationList": durationList, // Android used only
          "endTimeList": endTimeList, // Android used only
          "decodeDirPath": decodeDirPath, // Android used only
          "mixinFilePath": mixinFilePath, // Android used only
          "resultPath": resultPath,
          "startTimeList": startTimeList, // iOS used only
        });
  }

  Future<String> mixinVideoAndAudio(
      {String bgmPath, String videoPath, String resultPath}) {
    return _channel.invokeMethod("mixinVideoAndAudio",
        {
          "bgmPath": bgmPath,
          "videoPath": videoPath,
          "resultPath": resultPath,
        });
  }
}
