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
647 stars 297 forks source link

[Feature request] android provide image uri #1083

Closed lwj1994 closed 3 months ago

lwj1994 commented 3 months ago

Platforms

Android

Description

  Future<String?> getMediaUrl() async {
    if (type == AssetType.video || type == AssetType.audio || isLivePhoto) {
      return plugin.getMediaUrl(this);
    }
    return null;
  }

provide image uri

Why

when pick image in webview,it only receive image uri

AlexV525 commented 3 months ago

Would content://media/external/image/media/102 work with WebView? That doesn't sound correct.

lwj1994 commented 3 months ago

Would content://media/external/image/media/102 work with WebView? That doesn't sound correct.

after allow _isAndroidImage get uri, it works . image
image

can i pr this commit?

lwj1994 commented 3 months ago

After my test,in flutter_webview,only uri is effective , https://support.qq.com/products/1368

androidController.setOnShowFileSelector((FileSelectorParams params) async {
      switch (params.mode) {
        case FileSelectorMode.open:
        case FileSelectorMode.openMultiple:
          final assetEntity = await Picker.pickAImage(
              AppMainPage.scaffoldKey.currentContext!);
          if (assetEntity == null) return [];
          return [
            assetEntity.androidUri.isNotEmpty
                ? assetEntity.androidUri
                : assetEntity.filePath
          ];
lwj1994 commented 3 months ago

usring uri seems reasonable that file path cannot be accessed after 30