Skip to content
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

[Bug report] Load thumbnail stuck and failed to load #931

Closed
HongZhiQing opened this issue Apr 25, 2023 · 14 comments
Closed

[Bug report] Load thumbnail stuck and failed to load #931

HongZhiQing opened this issue Apr 25, 2023 · 14 comments

Comments

@HongZhiQing
Copy link

Version

2.6.0

Platforms

Android

Device Model

荣耀 Magic3 Pro

flutter info

[!] Flutter (Channel stable, 3.7.6, on macOS 12.6 21G115 darwin-arm64, locale zh-Hans-CN)
    • Flutter version 3.7.6 on channel stable at /Users/neal/fvm/versions/3.7.6
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/2.17.6/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/neal/fvm/versions/3.7.6. Consider adding
      /Users/neal/fvm/versions/3.7.6/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 12cb4eb7a0 (8 weeks ago), 2023-03-01 10:29:26 -0800
    • Engine revision ada363ee93
    • Dart version 2.19.3
    • DevTools version 2.20.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[!] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/neal/Library/Android/sdk/
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] VS Code (version 1.75.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.62.0

[✓] Connected device (5 available)

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 2 categories.

How to reproduce?

When I use wechat_assets_picker 8.4.2, when I open the picture selection page, the loading interface is stuck, and it is restored after a long time, and the thumbnail of the picture is not displayed.

SVID_20230425_144544_1.mp4

log:

log.txt

Logs

No response

Example code (optional)

No response

Contact

[email protected]

@AlexV525
Copy link
Member

Can you try if the issues can be resolved with these lines commented out?

if (width == 0 || height == 0) {
try {
if (type == MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE && !mimeType.contains("svg")) {
val uri = getUri(id, getMediaType(type))
context.contentResolver.openInputStream(uri)?.use {
ExifInterface(it).apply {
width = getAttribute(ExifInterface.TAG_IMAGE_WIDTH)?.toInt() ?: width
height = getAttribute(ExifInterface.TAG_IMAGE_LENGTH)?.toInt() ?: height
}
}
} else if (type == MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO) {
val mmr = MediaMetadataRetriever()
mmr.setDataSource(path)
width = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH)?.toInt() ?: 0
height = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH)?.toInt() ?: 0
orientation = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION)?.toInt()
?: orientation
if (isAboveAndroidQ) mmr.close() else mmr.release()
}
} catch (e: Throwable) {
LogUtils.error(e)
}
}

@HongZhiQing
Copy link
Author

Can you try if the issues can be resolved with these lines commented out?

if (width == 0 || height == 0) {
try {
if (type == MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE && !mimeType.contains("svg")) {
val uri = getUri(id, getMediaType(type))
context.contentResolver.openInputStream(uri)?.use {
ExifInterface(it).apply {
width = getAttribute(ExifInterface.TAG_IMAGE_WIDTH)?.toInt() ?: width
height = getAttribute(ExifInterface.TAG_IMAGE_LENGTH)?.toInt() ?: height
}
}
} else if (type == MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO) {
val mmr = MediaMetadataRetriever()
mmr.setDataSource(path)
width = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH)?.toInt() ?: 0
height = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH)?.toInt() ?: 0
orientation = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION)?.toInt()
?: orientation
if (isAboveAndroidQ) mmr.close() else mmr.release()
}
} catch (e: Throwable) {
LogUtils.error(e)
}
}

I tried to comment out on the above code, but it didn't solve the problem, and the effect was the same as the video above.

@HongZhiQing
Copy link
Author

It is normal for me to load thumbnails when I use the example project in flutter_photo_manager, while the example project using flutter_wechat_assets_picker cannot be loaded, or it will take a long time to load. Please see the video below.

AADFDE53-1075-41F2-B077-7DBAEC3DB238.1.mp4

@AlexV525
Copy link
Member

AlexV525 commented Jun 8, 2023

Good to know about the difference. Can you differentiate the difference between their FilterOptionGroup to find which option causes the issue?

@HongZhiQing
Copy link
Author

image
image
image

@HongZhiQing
Copy link
Author

image

On the left is the FilterOptionGroup of the example project of flutter_photo_manager. I don't have the phone with the problem at present, and I can't tell which parameter is set wrong.

@HongZhiQing
Copy link
Author

When I comment out the code in ``DefaultAssetPickerProvider```, as shown in the figure, I can load thumbnails normally. Is it because this phone has more than 3,000 photo albums? There are often many photo albums on Android phones.
1686294017721

SVID_20230609_150449_1.mp4

@AlexV525
Copy link
Member

You can try to set needTitle as false for image filter option.

@111111155555588887774
Copy link

any solution?

@AlexV525
Copy link
Member

AlexV525 commented Jun 9, 2024

@HongZhiQing Do you still running into the same issue when using the latest version of this plugin and the picker?

@HongZhiQing
Copy link
Author

I am not using the latest version, but the issue still exists in version 9.0.3.

@AlexV525
Copy link
Member

fluttercandies/flutter_wechat_assets_picker#526 (comment) What about setting onlyAll for the filtering?

@AlexV525
Copy link
Member

This should be solved by fluttercandies/flutter_wechat_assets_picker#596.

@HongZhiQing
Copy link
Author

I'm glad to hear that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants