mediaPlayerLoadResourceFromMediaData method

Future<Map> mediaPlayerLoadResourceFromMediaData(
  1. int index,
  2. dynamic mediaData,
  3. int startPosition
)

Implementation

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