mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-17 15:09:31 +02:00
Made some changes in video upload for debugging only
This commit is contained in:
@@ -801,13 +801,42 @@ NSString* MXKFileSizes_description(MXKFileSizes sizes)
|
||||
AVAssetImageGenerator *assetImageGenerator = [AVAssetImageGenerator assetImageGeneratorWithAsset:selectedVideo];
|
||||
assetImageGenerator.appliesPreferredTrackTransform = YES;
|
||||
CMTime time = CMTimeMake(1, 1);
|
||||
CGImageRef imageRef = [assetImageGenerator copyCGImageAtTime:time actualTime:NULL error:nil];
|
||||
// CGImageRef imageRef = [assetImageGenerator copyCGImageAtTime:time actualTime:NULL error:nil];
|
||||
|
||||
if ([selectedVideo isKindOfClass:[AVURLAsset class]]) {
|
||||
NSLog(@"AVURLAsset");
|
||||
} else {
|
||||
NSLog(@"Kein AVURLAsset");
|
||||
}
|
||||
// dispatch_async(dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0), ^{
|
||||
[assetImageGenerator generateCGImagesAsynchronouslyForTimes:@[[NSValue valueWithCMTime:time]] completionHandler:^(CMTime requestedTime, CGImageRef cgImage, CMTime actualTime, AVAssetImageGeneratorResult result, NSError *error) {
|
||||
// dispatch_async(dispatch_get_main_queue(), ^{
|
||||
NSLog(@"Error: %@", error);
|
||||
NSLog(@"Error: %@", error.localizedDescription);
|
||||
|
||||
NSError *dummy = error;
|
||||
|
||||
if (result == AVAssetImageGeneratorSucceeded) {
|
||||
UIImage *thumbnailImage = [UIImage imageWithCGImage:cgImage];
|
||||
NSLog(@"success: %@", thumbnailImage);
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
[self.delegate roomInputToolbarView:self sendVideoAsset:selectedVideo withThumbnail:thumbnailImage];
|
||||
});
|
||||
} else if (result == AVAssetImageGeneratorFailed) {
|
||||
NSLog(@"Error: %@", error.localizedDescription);
|
||||
|
||||
NSLog(@"Fehler beim Erstellen des Thumbnails: %@", error);
|
||||
} else if (result == AVAssetImageGeneratorCancelled) {
|
||||
NSLog(@"Thumbnail-Erstellung abgebrochen");
|
||||
}
|
||||
// });
|
||||
}];
|
||||
// });
|
||||
// Finalize video attachment
|
||||
UIImage* videoThumbnail = [[UIImage alloc] initWithCGImage:imageRef];
|
||||
CFRelease(imageRef);
|
||||
// UIImage* videoThumbnail = [[UIImage alloc] initWithCGImage:imageRef];
|
||||
// CFRelease(imageRef);
|
||||
|
||||
[self.delegate roomInputToolbarView:self sendVideoAsset:selectedVideo withThumbnail:videoThumbnail];
|
||||
// [self.delegate roomInputToolbarView:self sendVideoAsset:selectedVideo withThumbnail:videoThumbnail];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -8078,18 +8078,36 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
}
|
||||
});
|
||||
}];
|
||||
} else if ([itemProvider hasItemConformingToTypeIdentifier:(NSString *)UTTypeMovie]) {
|
||||
[itemProvider loadItemForTypeIdentifier:(NSString *)UTTypeMovie options:nil completionHandler:^(id _Nullable object, NSError * _Nullable error) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if ([object isKindOfClass:[NSURL class]]) {
|
||||
NSURL *url = object;
|
||||
if(url) {
|
||||
AVURLAsset *selectedVideo = [AVURLAsset assetWithURL:url];
|
||||
} else if ([itemProvider hasItemConformingToTypeIdentifier:@"public.movie"]) {
|
||||
[itemProvider loadFileRepresentationForTypeIdentifier:@"public.movie" completionHandler:^(NSURL *videoURL, NSError *error) {
|
||||
if (error) {
|
||||
NSLog(@"Fehler beim Laden des Videos: %@", error);
|
||||
} else {
|
||||
NSLog(@"Video URL: %@", [videoURL absoluteString]);
|
||||
NSString *dummy = [videoURL absoluteString];
|
||||
if(videoURL) {
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
AVURLAsset *selectedVideo = [AVURLAsset assetWithURL:videoURL];
|
||||
[self sendVideoAsset:selectedVideo isPhotoLibraryAsset:NO];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
// NSData *videoData = [NSData dataWithContentsOfURL:videoURL];
|
||||
|
||||
// Hier können Sie mit dem geladenen videoData arbeiten
|
||||
// z.B. es in einem AVPlayer anzeigen oder auf einen Server hochladen
|
||||
}
|
||||
}];
|
||||
// [itemProvider loadItemForTypeIdentifier:(NSString *)UTTypeMovie options:nil completionHandler:^(id _Nullable object, NSError * _Nullable error) {
|
||||
// dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// if ([object isKindOfClass:[NSURL class]]) {
|
||||
// NSURL *url = object;
|
||||
// if(url) {
|
||||
// AVURLAsset *selectedVideo = [AVURLAsset assetWithURL:url];
|
||||
// [self sendVideoAsset:selectedVideo isPhotoLibraryAsset:NO];
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user