Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Initial file gets cached and not deleted after compression #168

Open
chaniotisalex opened this issue Aug 25, 2023 · 6 comments
Open

Initial file gets cached and not deleted after compression #168

chaniotisalex opened this issue Aug 25, 2023 · 6 comments
Labels
Fixed Will be in the next release

Comments

@chaniotisalex
Copy link

chaniotisalex commented Aug 25, 2023

When the lib retrieves the file in order to compress it, it caches it inside /data/user/0/com.your.project.package/ . After compression is complete, the file doesn't get deleted, leaving a file which only has a name in form of currentTimeMillis and the size of the initial file.

@AbedElazizShe
Copy link
Owner

Thank you @chaniotisalex for pointing this out. I have fixed the issue.

@AbedElazizShe AbedElazizShe added the Fixed Will be in the next release label Sep 27, 2023
@SamAmco
Copy link

SamAmco commented Oct 13, 2023

I'm also having this issue. My app size is now 8GB on my device. The only way for me to reduce it is to "clear data" which would also delete all other data related to the app and essentially reduce it to a fresh install. I would suggest that you probably shouldn't store any files in this location at all. If you need to cache a temporary file you could use cacheDir and File.createTempFile: https://developer.android.com/training/data-storage/app-specific#internal-create-cache .. One thing to consider here is if the app process is killed in the middle of the compression job will the file still be deleted/deletable. If you use the cacheDir it will be. The system or the user can clear the cache for the app at any point without affecting the proper functioning of the app. If you put temporary files in the root data directory and the app is killed before it gets chance to delete that file, the opportunity is lost and it will be stuck there until the user clears all data for the app.

@waterdrake
Copy link

waterdrake commented Oct 16, 2023

It would be great if we could just pass in a full path for the output file. The old version used to do that. By passing in a full path to a file, the developer could specify if they want to save it to the private caches folder, permanent storage, etc. Right now, everything goes into the files directory.

@CristianMG
Copy link
Contributor

CristianMG commented Nov 29, 2023

Open pull request #182 to fix this problem and make more flexible library @AbedElazizShe

@karlovm
Copy link

karlovm commented Mar 6, 2024

Same issue. Not fixed in 1.3.2

@Andrey-Ageenko
Copy link

Andrey-Ageenko commented Sep 4, 2024

The problem described by the author persists in version 1.3.3.
If you shoot video with a phone camera, an intermediate file is created in the application folder, it has a name like currentTimeMillis and has no extension.

Additional information:
I have an error on Android 12.
When VideoCompressor.getMediaPath() throws an exception and returns file.absolutePath

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fixed Will be in the next release
Projects
None yet
Development

No branches or pull requests

7 participants