mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
fix compability of display files with previous versions
This commit is contained in:
parent
d88641c31c
commit
a1e3989d0a
1 changed files with 0 additions and 40 deletions
|
|
@ -331,48 +331,13 @@
|
|||
if (_messageImageView.image == nil) {
|
||||
[self loadFirstImage:localImage type:PHAssetMediaTypeImage];
|
||||
_imageGestureRecognizer.enabled = YES;
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^ {
|
||||
UIImage *image = [chatTableView.imagesInChatroom objectForKey:localImage];
|
||||
NSString *name = [NSString stringWithFormat:@"%li-%f.jpg", (long)image.hash, [NSDate timeIntervalSinceReferenceDate]];
|
||||
NSData *data = UIImageJPEGRepresentation(image, 1);
|
||||
[ChatConversationView writeFileInCache:data name:name];
|
||||
[LinphoneManager setValueInMessageAppData:name forKey:@"localimage" inMessage:self.message];
|
||||
});
|
||||
}
|
||||
} else if (localVideo) {
|
||||
if (_messageImageView.image == nil) {
|
||||
[self loadFirstImage:localVideo type:PHAssetMediaTypeVideo];
|
||||
_imageGestureRecognizer.enabled = NO;
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^ {
|
||||
PHFetchResult<PHAsset *> *assets = [PHAsset fetchAssetsWithLocalIdentifiers:[NSArray arrayWithObject:localVideo] options:nil];
|
||||
if (![assets firstObject])
|
||||
return;
|
||||
PHAsset *asset = [assets firstObject];
|
||||
if (asset.mediaType != PHAssetMediaTypeVideo)
|
||||
return;
|
||||
PHVideoRequestOptions *options = [[PHVideoRequestOptions alloc] init];
|
||||
options.version = PHImageRequestOptionsVersionCurrent;
|
||||
options.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic;
|
||||
|
||||
[[PHImageManager defaultManager] requestAVAssetForVideo:asset options:options resultHandler:^(AVAsset * _Nullable asset, AVAudioMix * _Nullable audioMix, NSDictionary * _Nullable info) {
|
||||
AVURLAsset *urlAsset = (AVURLAsset *)asset;
|
||||
NSData *data = [NSData dataWithContentsOfURL:urlAsset.URL];
|
||||
NSString *name = [NSString stringWithFormat:@"IMG-%f.MOV", [NSDate timeIntervalSinceReferenceDate]];
|
||||
[ChatConversationView writeFileInCache:data name:name];
|
||||
[LinphoneManager setValueInMessageAppData:name forKey:@"localvideo" inMessage:self.message];
|
||||
|
||||
}];
|
||||
});
|
||||
}
|
||||
} else if (localFile) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^ {
|
||||
NSURL *url = [VIEW(ChatConversationView) getICloudFileUrl:localFile];
|
||||
NSData *data = [NSData dataWithContentsOfURL:url];
|
||||
[ChatConversationView writeFileInCache:data name:localFile];
|
||||
});
|
||||
|
||||
if ([fileType isEqualToString:@"video"]) {
|
||||
UIImage* image = [UIChatBubbleTextCell getImageFromVideoUrl:[VIEW(ChatConversationView) getICloudFileUrl:localFile]];
|
||||
[self loadImageAsset:nil image:image];
|
||||
|
|
@ -472,11 +437,6 @@
|
|||
NSURL *url = [VIEW(ChatConversationView) getICloudFileUrl:localFile];
|
||||
AVPlayer *player = [AVPlayer playerWithURL:url];
|
||||
[self playVideoByPlayer:player];
|
||||
dispatch_async(dispatch_get_main_queue(), ^ {
|
||||
NSData *data = [NSData dataWithContentsOfURL:url];
|
||||
[ChatConversationView writeFileInCache:data name:localFile];
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
PHVideoRequestOptions *options = [[PHVideoRequestOptions alloc] init];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue