Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/image_picker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## 0.5.0+4
## 0.5.0+5

* Fixed record video has two files on IOS.

Preserve transparency when saving images.
## 0.5.0+4
* Preserve transparency when saving images.

## 0.5.0+3

Expand Down
8 changes: 5 additions & 3 deletions packages/image_picker/ios/Classes/ImagePickerPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,19 @@ - (void)imagePickerController:(UIImagePickerController *)picker
return;
}
if (videoURL != nil) {
NSData *data = [NSData dataWithContentsOfURL:videoURL];
NSString *guid = [[NSProcessInfo processInfo] globallyUniqueString];
NSString *tmpFile = [NSString stringWithFormat:@"image_picker_%@.MOV", guid];
NSString *tmpDirectory = NSTemporaryDirectory();
NSString *tmpPath = [tmpDirectory stringByAppendingPathComponent:tmpFile];
NSString *videoPath = [videoURL.absoluteString stringByReplacingOccurrencesOfString:@"file://"
withString:@""];
NSError *error = nil;

if ([[NSFileManager defaultManager] createFileAtPath:tmpPath contents:data attributes:nil]) {
if ([[NSFileManager defaultManager] moveItemAtPath:videoPath toPath:tmpPath error:&error]) {
_result(tmpPath);
} else {
_result([FlutterError errorWithCode:@"create_error"
message:@"Temporary file could not be created"
message:[NSString stringWithFormat:@"%@", error]
details:nil]);
}
} else {
Expand Down