mediaPlayerLoadResource method

Future<Map> mediaPlayerLoadResource(
  1. int index,
  2. String path
)

Implementation

Future<Map<dynamic, dynamic>> mediaPlayerLoadResource(
    int index, String path) async {
  final map = {};
  if (_mediaPlayers[index] == null) {
    map["errorCode"] = 1;
    return Future.value(map);
  }
  await (() {
    Map completerMap = createCompleter();
    _mediaPlayers[index]
        .instance
        .loadResource(path, completerMap["success"], completerMap["fail"]);
    return completerMap["completer"].future;
  })();
  map["errorCode"] = 0;
  return Future.value(map);
}