6

The problem comes when during the video processing user closes the application himself from the task manager then its processing stops.

I am working on video file processing in android using FFMpeg, which is working perfectly but when I do close the application during processing from task manager then video processing has stopped working even I added all the work in work manager.

    @Override 
public Result doWork() {
        shellCommand = new ShellCommand();
        ffmpegBinary = new String[] {
            FileUtils.getFFmpeg(context).getAbsolutePath()
        };
        command = concatenate(ffmpegBinary, command);
        CommandResult commandResult = getCommandResult(command);
        if (command`enter code here`Result.success) {
            onSuccess(videoPath);
        } else {
            onFailure(videoPath);
        }
    }
    //getCommandResult
    private CommandResult getCommandResult(String[] command) {
        try {
            process = shellCommand.run(command, null);
    
            if (process == null) {
                return CommandResult.getDummyFailureResponse();
            }
            checkAndUpdateProcess();
            return CommandResult.getOutputFromProcess(process);
        } catch(Exception e) {} finally {
            Util.destroyProcess(process);
        }
        return CommandResult.getDummyFailureResponse();
    }

As far as I can tell, when the application closes from the background then the parent process destroys it and is destroying all of its sub-process too, FFMpeg is using the android process to execute the command and check the video file status during video processing.

Looking forward to hear from you. Thanks

i30mb1
  • 3,894
  • 3
  • 18
  • 34
Naseer Attari
  • 659
  • 6
  • 18

0 Answers0