New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[expo-media-library] [ios] show if an asset is an icloud asset #8541
Comments
Hey! Yeah, it sounds like a good idea! 🙂 |
That's a valid point, I would say |
Great, feel free to open a PR if you'd like! |
Something like |
Interesting point, I will be working on this on the weekend so will look into that |
Thanks @jarvisluong! Let me know if I can help 😄 |
@awaisabir @byCedric The ability to generate a thumbnail is certainly possible since there is an API for that: https://developer.apple.com/documentation/photokit/phimagemanager/1616964-requestimageforasset?language=objc Also, I see that this is already implemented in expo/packages/expo-image-manipulator/ios/EXImageManipulator/EXImageManipulatorModule.m Line 73 in 8fa0b00
So basically for now we can use |
One more thing, also thanks to this PR: #8304, if we just want the thumbnail for the asset, upgrading to latest |
@jarvisluong thanks for your investigation and information! I was able to find pretty good success generating thumbnails for icloud videos with expo-image-picker@8.1.0. However, sometimes (~20%) i'd still get a blank thumbnail (without an error being thrown). For what it's worth I did find a slightly better "success" rate when resizing the image to my exact needs vs maintaining the original size. I updated to expo-image-picker@8.2.1 and saw an even better "success" rate. Maybe 90% instead of 80%? I'm not really familiar with native iOS development or the APIs available so sorry I'm not adding more intelligent feedback / commentary to the discussion, but:
Edit: RE (2), I tried running manipulateAsync on an interval and noted that blank thumbnails were replaced successfully with proper thumbnails after the first retry and that a properly generated thumbnail was never replaced with a blank thumbnail by a subsequent retry. Makes me my theory about the failed network request may be correct and that once the asset is fetched successfully, the thumbnail will not fail to generate |
@awinograd Sorry if my comments are making the informations misleading, but actually what I mean was:
For your point (1), since the call I suggest you can try to get the thumbnail like this: (with version 8.2.1 of
|
@jarvisluong I must have misread your comments incorrectly. Thanks for the extra clarification. Using Thanks again for your help on this issue. |
So I've been building an app which need to create a media picker. The problem is when user's phone has images or videos stored on icloud (and not yet locally). In order to display those icloud asset properly I would need to wait until the asset is downloaded (as already defined in here:
expo/packages/expo-media-library/ios/EXMediaLibrary/EXMediaLibrary.m
Line 407 in e166a8d
To listen for download updates, it is also already possible since expo-media-library has a delegated method:
expo/packages/expo-media-library/ios/EXMediaLibrary/EXMediaLibrary.m
Line 567 in e166a8d
My suggestion would be to add this key
isIcloudAsset: boolean
to the return value ofMediaLibrary.getAssetInfoAsync(asset)
, so that the user of this library know that this asset needs to wait for download before showing it. In order to do this, we can check this key (PHImageResultIsInCloudKey
) inside theinfo
object of this callback:expo/packages/expo-media-library/ios/EXMediaLibrary/EXMediaLibrary.m
Line 422 in e166a8d
I'm happy to include a PR to about this issue as well.
Reference: https://www.swiftjectivec.com/icloud-photo-handling/
The text was updated successfully, but these errors were encountered: