laravel-ffmpeg icon indicating copy to clipboard operation
laravel-ffmpeg copied to clipboard

[Question] Cleanup temporary files

Open cristiansoftlead opened this issue 1 year ago • 0 comments

Hello,

I try to use cleanupTemporaryFiles() but it doesn't work. I have a job that runs in the background using workers and I tried to put this method inside onProgress ( there is no documentation how to use it ).

$ffmpeg->onProgress(function ($percent) {
            $this->video->hls_progress = $percent;
            $this->video->save();
            
            if((int)$percent === 100) {
                try {
                    FFMpeg::cleanupTemporaryFiles();
                } catch(\Exception) {}
            }
        });

But this isn't working....the temporary files are still there. Should I just chain this method here, like this, and he will know to delete temp files only after everything is done?

$ffmpeg = FFMpeg::fromDisk('s3')
            ->open($this->video->url)
            ->exportForHLS()
            ->toDisk('s3')
            ->cleanupTemporaryFiles();

Thank you

cristiansoftlead avatar Jul 29 '24 06:07 cristiansoftlead