mirror of
https://github.com/DmcSDK/cordova-plugin-mediaPicker
synced 2026-05-03 00:00:04 +08:00
Add files via upload
This commit is contained in:
+11
-10
@@ -118,8 +118,9 @@
|
||||
}
|
||||
|
||||
-(void)videoToSandboxCompress:(PHAsset *)asset dmcPickerPath:(NSString*)dmcPickerPath aListArray:(NSMutableArray*)aListArray selectArray:(NSMutableArray*)selectArray index:(int)index{
|
||||
|
||||
[[PHImageManager defaultManager] requestExportSessionForVideo:asset options:nil exportPreset:AVAssetExportPresetPassthrough resultHandler:^(AVAssetExportSession *exportSession, NSDictionary *info) {
|
||||
NSString *compressStartjs = [NSString stringWithFormat:@"MediaPicker.compressEvent('%@',%i)", @"start",index];
|
||||
[self.commandDelegate evalJs:compressStartjs];
|
||||
[[PHImageManager defaultManager] requestExportSessionForVideo:asset options:nil exportPreset:AVAssetExportPresetMediumQuality resultHandler:^(AVAssetExportSession *exportSession, NSDictionary *info) {
|
||||
|
||||
|
||||
NSString *fullpath=[NSString stringWithFormat:@"%@/%@.%@", dmcPickerPath,[[NSProcessInfo processInfo] globallyUniqueString], @"mp4"];
|
||||
@@ -130,25 +131,23 @@
|
||||
exportSession.outputFileType=AVFileTypeMPEG4;
|
||||
|
||||
exportSession.outputURL=outputURL;
|
||||
|
||||
|
||||
[exportSession exportAsynchronouslyWithCompletionHandler:^{
|
||||
|
||||
|
||||
if (exportSession.status == AVAssetExportSessionStatusFailed) {
|
||||
|
||||
[self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"compress failed"] callbackId:callbackId];
|
||||
NSLog(@"failed");
|
||||
|
||||
} else if(exportSession.status == AVAssetExportSessionStatusCompleted){
|
||||
|
||||
NSLog(@"completed!");
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
||||
NSLog(@"completed!");
|
||||
NSString *compressCompletedjs = [NSString stringWithFormat:@"MediaPicker.compressEvent('%@',%i)", @"completed",index];
|
||||
[self.commandDelegate evalJs:compressCompletedjs];
|
||||
NSDictionary *dict=[NSDictionary dictionaryWithObjectsAndKeys:fullpath,@"path",@"video",@"mediaType" ,[NSNumber numberWithInt:index],@"index", nil];
|
||||
[aListArray addObject:dict];
|
||||
if([aListArray count]==[selectArray count]){
|
||||
[self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:aListArray] callbackId:callbackId];
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}];
|
||||
@@ -156,6 +155,8 @@
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
|
||||
-(NSString*)thumbnailVideo:(NSString*)path quality:(NSInteger)quality {
|
||||
UIImage *shotImage;
|
||||
//视频路径URL
|
||||
|
||||
Reference in New Issue
Block a user