natsuk4ze / gal

How to Save Image or Video to Photo Gallery in Flutter
https://pub.dev/packages/gal
BSD 3-Clause "New" or "Revised" License
108 stars 16 forks source link

Video saving into Picture folder #236

Open Riz1ahmed opened 3 weeks ago

Riz1ahmed commented 3 weeks ago

Did you check the documentation and it did not help?

When I am saving video with an album name (e.g. await Gal.putVideo(tmpVideoPath.path, album: 'Intro Maker');) the video saving into 'Picture/Intro Maker' directory.

My phone is a Galaxy s8, android v10 (Custom ROM).

natsuk4ze commented 3 weeks ago

We cannot respond until the DESCRIPTION item is filled

natsuk4ze commented 3 weeks ago

This behavior is currently as intended.

Riz1ahmed commented 3 weeks ago

What I will give in the description?


Now I have checked your inner code. In native you called same for both video and image

GalPlugin.java (line63)

switch (call.method) { case "putVideo": case "putImage": { new Thread(() -> { try {

And in the createContentValues method The condition Is (I think not right).

GalPlugin.java (line167)

private ContentValues createContentValues(boolean isImage, String name, String extension,
            String album) {
        ContentValues values = new ContentValues();
        String dirPath = isImage || album != null ? Environment.DIRECTORY_PICTURES
                : Environment.DIRECTORY_MOVIES;
 ......

Here set Environment.DIRECTORY_PICTURES if album null. But I have passed album value

natsuk4ze commented 3 weeks ago

What I will give in the description?

Simply fill in the items as per the template. You have erased it and it is no longer visible.

Riz1ahmed commented 3 weeks ago

Now I have commented. Please check

natsuk4ze commented 3 weeks ago

When specifying a custom album, it is intended that it be created under Picture. I don't remember, but I think there was a reason it couldn't be created under VideošŸ¤”

Riz1ahmed commented 3 weeks ago

After removing the album != null from the createContentValues method, The video has been saved in the 'Movies/Intro Maker' directory. So I think it is possible

And it is not good practice to use your code by changing on my side as there could be more conditions I don't know.

So please handle it

natsuk4ze commented 2 weeks ago

One thing I just remembered. I believe that this will result in a behavior that is not as intended for many people.

For example, when you save a file with the folder name MyFolder, if you save it in Pictures for images and Movies for videos, two folders named MyFolder will be created. @Riz1ahmed

thanglq1 commented 1 week ago

Any update? Same issue with android 13, Samsung Galaxy A71. await Gal.putVideo(filePath, album: 'MyAlbum');. MyAlbum saved in Pictures instead of Movies and the video does not show in the Gallery.

natsuk4ze commented 1 week ago

As you can see from the thread above, this behavior is intentional and will not be changed. And this issue will be closed soon as there has been no reply from the author.