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
693 stars 314 forks source link

Easy way to bypass media caching on AndroidQ to play original video/view original image in full size #393

Closed github3t closed 3 years ago

github3t commented 4 years ago

I use Photo_Manager to display media galleries and assets to pick avatars or attach media to a database entity. When viewing an attached AssetEntity (using .fromId()) using the .originFile getter, the system is always making a deep copy of the original file. In a gallery with lots of videos this explodes the cache considerably and the viewer has to wait a very long time before videos start playing.

Is there an easy solution to get the real original file descriptor to pass to an image/video viewer widget?

The .relativePath getter seems appropriate here, but I have no idea how to use it properly. Do you have any ideas?

When requesting .thumbData or .thumdDataWithSize() the system does not seem to have to make a deep copy. So it appears there is a way to access the real original file.

github3t commented 4 years ago

I've found a way to bypass the cache for video by looking at the wechat_asset_picker code. It uses the .getMediaUrl() function. But this only works for video according to the docs

As camera resolutions keep rising images can be quite large too. Is there a way to bypass the cache for images like video?

AlexV525 commented 3 years ago

When we run into the process of Uri -> Bitmap, the entity must be copied to the cache directory before using it.

AlexV525 commented 3 years ago

Closing with stale state.