add progress callback

add progress callback
pull/166/head
xufulong 4 years ago
parent a93bd3d420
commit d96ec26c64
  1. 2
      app/src/main/java/com/frank/ffmpeg/FFmpegCmd.java
  2. 5
      app/src/main/java/com/frank/ffmpeg/handler/FFmpegHandler.java

@ -70,6 +70,7 @@ public class FFmpegCmd {
* @param onHandleListener the callback for executing command
*/
public static void execute(final List<String[]> commands, final OnHandleListener onHandleListener) {
mProgressListener = onHandleListener;
new Thread(new Runnable() {
@Override
public void run() {
@ -87,6 +88,7 @@ public class FFmpegCmd {
if (onHandleListener != null) {
onHandleListener.onEnd(result, null);
}
mProgressListener = null;
}
}).start();
}

@ -89,6 +89,11 @@ public class FFmpegHandler {
mHandler.obtainMessage(MSG_BEGIN).sendToTarget();
}
@Override
public void onProgress(int progress, int duration) {
mHandler.obtainMessage(MSG_PROGRESS, progress, duration).sendToTarget();
}
@Override
public void onEnd(int resultCode, String resultMsg) {
Log.i(TAG, "handle onEnd...");

Loading…
Cancel
Save