Closed rameerez closed 5 months ago
Related: https://github.com/terikon/cordova-plugin-photo-library/issues/13
Update on the issue:
After learning you can pass a dictionary of options to getLibrary
(please, try to improve the docs and/or default example, the basic plugin functioning is not clear at all) I managed to use the itemsInChunk
and chunkTimeSec
properties which allowed me to slow down the process and avoid freezing the device instantly.
Still, I believe chunks don't work as expected, getLibrary
gets a bunch of chunks at first and after a while the phone freezes again as thousands of messages like [Generic] Failed to load image data for asset <PHAsset: 0x100eeb5d0>
start showing up in the console.
I've tried using the new includeCloudData: false
property added in 2.1.0
(https://github.com/terikon/cordova-plugin-photo-library/pull/74), with no luck. Not only it does not work because the GetLibraryOptions
interface in @ionic-native/photo-library
does not reflect that property addition, but even after manually adding the property in the interface file and compiling the app, the plugin refuses to fetch any photos and all it does is to throw [Generic] Failed to load image data for asset
messages.
At this point, all I would like to do is to fetch the first, say 100 images without my phone freezing and consuming all its CPU and memory resources.
Are you displaying the pictures directly after loading them?
I noticed that my device kept freezing if you try to display too many pictures at once. I ended up displaying the pictures in batches (3 thumbnails every 30ms) and have not seen any issues ever since. It would be amazing if someone found out how to fix this, but I haven't been able to look into it. (Just to clarify, I'm talking about actually displaying the thumbnails in your app. Loading the metadata from the device always worked without any issues for me.)
Hi, I've trying to set up the basic example as shown in the README and in the Ionic official docs (https://ionicframework.com/docs/native/photo-library/). Clean app, just that example code.
I then run
ionic cordova build ios
to compile and then I launch the app through Xcode on my iPhone (iOS 10.3.1).The console then outputs 3 huge sets of messages.
First set (1800+ different messages like this one. I masked out the photo ID):
2017-08-24 10:04:31.220200+0200 MyApp[3829:1920603] [Generic] Failed to load image data for asset <PHAsset: 0x100eeb5d0> XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/XX/XXXX mediaType=1/0, sourceType=1, (1280x960), creationDate=2017-05-01 02:23:52 +0000, location=0, hidden=0, favorite=0 with format 9999
Second set (Another 1800+ messages. The proper console output, I masked out the lat/long coordinates and pic ID for privacy):
It then outputs
2017-08-24 10:05:57.190426+0200 MyApp[3829:1920364] could not get photos
And then the third set (the last 1800+ messages. Again, masked out pic ID):
2017-08-24 10:06:28.002895+0200 MyApp[3829:1920364] WARNING: sanitizing unsafe URL value cdvphotolibrary://thumbnail?photoId=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX%2FXX%2FXXX&width=512&height=384&quality=0.5 (see http://g.co/ng/security#xss)
Then the app freezes. It does not crash, though, but it freezes and doesn't respond to any UI action.
Please point out if I'm missing something or this is a bug. I'd me more than happy to provide more info on this error.
I'm using
among others.