fluttercandies / flutter_photo_manager

A Flutter plugin that provides images, videos, and audio abstraction management APIs without interface integration, available on Android, iOS, macOS and OpenHarmony.
https://pub.dev/packages/photo_manager
Apache License 2.0
651 stars 299 forks source link

When obtaining album images and videos, only the images will be displayed and the content of the videos will not be displayed #1156

Closed changewhite closed 20 hours ago

changewhite commented 2 days ago

Version

3.2.0

Platforms

Android

Device Model

SM-S911U

flutter info

[√] Flutter (Channel stable, 3.19.6, on Microsoft Windows [版本 10.0.22631.3737], locale zh-CN)
    • Flutter version 3.19.6 on channel stable at D:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (2 months ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\lalal\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: D:\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2023.3)
    • Android Studio at D:\Android Studio
    • 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 17.0.10+0--11572160)

[√] Connected device (4 available)
    • SM S911U (mobile) • RFCW901E96K • android-arm64  • Android 14 (API 34)
    • Windows (desktop) • windows     • windows-x64    • Microsoft Windows [版本 10.0.22631.3737]
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 126.0.6478.127
    • Edge (web)        • edge        • web-javascript • Microsoft Edge 126.0.2592.56

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

How to reproduce?

Using content retrieval in the demo

Logs

No response

Example code (optional)

Using var albums = await PhotoManager.getAssetPathList();  to directly display the obtained image does not include video content

Contact

No response

AlexV525 commented 2 days ago

Screenshots?

jasminder commented 23 hours ago

Same issue. Only on Android. iOS is working fine.

jasminder commented 22 hours ago

Solved it. I had following line in AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

This does not work on higher android devices. Do the following:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:replace="android:maxSdkVersion" android:maxSdkVersion="28" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>

Also, make sure you go to app settings and disallow and then allow the photos and videos again. Make sure you request photos, videos through the following code:

final PermissionState ps = await PhotoManager.requestPermissionExtend();
    if (ps.isAuth || ps.hasAccess) {
//Your code
}

DO NOT USE: var status = await Permission.photos.request();

changewhite commented 21 hours ago

Thank you for your answer, but I have tried it on my end and it still doesn't work. However, the video captured through wechat_camera_picker can be obtained using photo_manage <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="28" /> <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" /> <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" /> <uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>

jasminder commented 21 hours ago

Thank you for your answer, but I have tried it on my end and it still doesn't work. However, the video captured through wechat_camera_picker can be obtained using photo_manage <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="28" /> <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" /> <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" /> <uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>

Updated my comment. Check the last part.

changewhite commented 21 hours ago

Thank you for your answer, but I have tried it on my end and it still doesn't work. However, the video captured through wechat_camera_picker can be obtained using photo_manage <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="28" /> <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" /> <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" /> <uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>

Updated my comment. Check the last part.

I have already obtained permission to modify the video before obtaining it, and the status returned is: PermissionStatus. granted

jasminder commented 21 hours ago

Uninstall the app and try again. Permission.photos.request do not seem to work as said.

changewhite commented 21 hours ago

Uninstall the app and try again. Permission.photos.request do not seem to work as said.

I always reinstall after adding permissions

changewhite commented 21 hours ago

Maybe you can create a demo and try it out @jasminder