gal icon indicating copy to clipboard operation
gal copied to clipboard

Video saving into Picture folder

Open Riz1ahmed opened this issue 1 year ago β€’ 8 comments

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).

Riz1ahmed avatar Sep 24 '24 11:09 Riz1ahmed

We cannot respond until the DESCRIPTION item is filled

natsuk4ze avatar Sep 24 '24 11:09 natsuk4ze

This behavior is currently as intended.

natsuk4ze avatar Sep 24 '24 11:09 natsuk4ze

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

Riz1ahmed avatar Sep 24 '24 11:09 Riz1ahmed

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.

natsuk4ze avatar Sep 24 '24 11:09 natsuk4ze

Now I have commented. Please check

Riz1ahmed avatar Sep 24 '24 11:09 Riz1ahmed

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πŸ€”

natsuk4ze avatar Sep 24 '24 11:09 natsuk4ze

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

Riz1ahmed avatar Sep 24 '24 12:09 Riz1ahmed

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

natsuk4ze avatar Oct 02 '24 12:10 natsuk4ze

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.

thanglq1 avatar Oct 13 '24 14:10 thanglq1

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.

natsuk4ze avatar Oct 14 '24 00:10 natsuk4ze

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, Thanks for your contribution.

github-actions[bot] avatar Oct 25 '24 00:10 github-actions[bot]

Solved by: I imported the library as a local into my project. And removed the '|| album != null' (from GalPlugin.java:172).

Riz1ahmed avatar Nov 05 '24 06:11 Riz1ahmed

Yes. This change is not intentional for many people and should be made privately.

natsuk4ze avatar Nov 05 '24 06:11 natsuk4ze

I don't understand why many people would want the video to be saved in the Pictures directory.

Riz1ahmed avatar Nov 05 '24 07:11 Riz1ahmed

Read the thread to find out. Let's say you are developing a camera app and you want to have a directory for your app. If you create separate directories depending on whether it was a photo or a video that was taken, users will be confused.

natsuk4ze avatar Nov 05 '24 07:11 natsuk4ze

And there is no motivation to work on this issue unless there is a clear answer regarding the πŸ‘† problem.

natsuk4ze avatar Nov 05 '24 07:11 natsuk4ze

For cases like this (e.g., a camera app), there should be a boolean variable isSingleDir. If false, a separate folder should be created. If true, there are two possible solutions:

  1. The folder could be created inside the Camera (DCIM) folder, where all the images and videos from the camera app will be saved.
  2. The folder could be created in the storage root directory (not inside the Pictures folder) with the specified name.

Alternatively, there might be other solutions, but saving videos in the Pictures folder doesn't seem like the right approach.

Riz1ahmed avatar Nov 06 '24 04:11 Riz1ahmed

I cannot support that approach because it is not aesthetic. And we need to know the use case in more detail: do you want to create your own album in the Movie folder? And your app only stores videos?

natsuk4ze avatar Nov 09 '24 05:11 natsuk4ze

Yes. My app now creates only videos (an image feature could be added in the future). I need to save the video inside the user's video directory (Videos/Movies).

Riz1ahmed avatar Nov 10 '24 08:11 Riz1ahmed

For anyone that came across this issue, you can use my fork https://github.com/Andrew-Bekhiet/gal

I've added support for saving videos to Movies directory with backward compatibility with older versions of the plugin Keep in mind that I only implemented the change on Android and Windows but not darwin platform as I'm not sure how it works on Apple devices and I tested only on android Any feedback or PRs are welcome 🀝

We are developers, we build software to help users achieve their goals πŸ’ͺ🏻

Andrew-Bekhiet avatar Nov 23 '24 12:11 Andrew-Bekhiet

Thank you very much. I am looking for a clean approach on this issue, but currently no quality ideas exist that can be merged into the main branch.

My goal is to make this plugin simple and easy to use for many people, and most importantly, it needs to be supported in the long term. For this reason, I may be cautious about adding features. Thank you for your understanding.

natsuk4ze avatar Nov 23 '24 14:11 natsuk4ze

I think You should have a switch like "UseMovieFolderForVideoAlbums" to some users could switch it on.

Ilia-Nenashev-devX avatar Jul 21 '25 10:07 Ilia-Nenashev-devX