esysberlin / esys-flutter-share

A Flutter plugin for sharing files & text with other applications.
Apache License 2.0
130 stars 147 forks source link

Instagram sharing not working. #50

Open kodemon-com opened 4 years ago

kodemon-com commented 4 years ago

Instagram sharing now working on my app. Working fine on all platform. It is showing "Unable to process video" event thought my sharable content is image.

here is my code. ` static Future shareMedia({String url, String type = 'image'}) async { File file = File(url);

var newFile = basename(file.path);
var newFileName = basenameWithoutExtension(file.path);

var type = "video/mp4";

if (type == 'image') {
  type = 'image/jpg';
}

//
var request = await HttpClient().getUrl(
  Uri.parse(url),
);
var response = await request.close();

Uint8List bytes = await consolidateHttpClientResponseBytes(response);

//

await Share.file(
  newFileName,
  newFile,
  bytes,
  type,
  text: AppConfig.msg + '\n' + AppConfig.appUrl,
);

}`

Am I doing something wrong???