Closed junedmmn closed 2 years ago
MAUI's MediaPicker
can get the file path (but doesn't support multiple choices 😂), so it's 2024, can Xamarin.MediaGallery get the file path?
MAUI's MediaPicker can get the file path (
They just make copies of files. This is a bad decision
Summary
Whenever we select or pick a media file using
MediaGallery.PickAsync()
, the result must have a property that holds the path of the actual file we selected. The result is of typeMediaPickResult
that has a property namedFiles
. ThisFile
isIEnumerable<IMediaFile>
andIMediaFile
has properties listed below:Hence, as shown, it doesn't have any property showing path of the actual file that we selected. It is much required feature as we can further operate on the picked file like compressing, showing preview such as thumbnails, and for showing video previews. We can also inject Dependency Services for platform specific functions.
The only thing now we can do is copy the stream to a file using
Stream.CopyToAsync()
. But this creates a duplicate copy of an already existing file. This takes a long time for video files depending on the size. This is not the proper way, it's just a workaround.Adding a feature to provide file path of the selected file will be much appreciable. Thanks.