tanersener / mobile-ffmpeg

FFmpeg for Android, iOS and tvOS. Not maintained anymore. Superseded by FFmpegKit.
https://tanersener.github.io/mobile-ffmpeg
GNU General Public License v3.0
3.85k stars 787 forks source link

UI not changed in main thread. #704

Closed ParthSilversky closed 3 years ago

ParthSilversky commented 3 years ago

Hello, I am using mobile ffmpeg and trying to show progress using log delegate. Works all fine but when I changed UI in main thread it will not work perfectly. Because log delegate called immediately when I changed ui in main thread. After all logs are completed then main thread is called and changed UI. But I want to change my UI immediate when getting 1 log message.

Execution Code I execute method in main thread

        DispatchQueue.main.async {
            let rc = MobileFFmpeg.execute(withArguments: [str])
            if rc == RETURN_CODE_SUCCESS {
                print("output file : " + outputFilePath.absoluteString)
                print("Command execution completed successfully.\n")
            } else if rc == RETURN_CODE_CANCEL {
                print("Command execution cancelled by user.\n")
            } else {
                print("Command execution failed with rc=\(rc) and output=\(MobileFFmpegConfig.getLastCommandOutput() ?? "").\n")
            }
        }

Log Delegate Code I am setting Label text like below Here progress is calculating from log message time.

DispatchQueue.main.async {
//This part will not called till all logs are completed.
    self.lblPercentageProgress.text = String(format: "%.2f", progress)
}

Any idea about these?