DeepMedia logo
Open Source

Search...

Other versions of this page

Improve this page on GitHub

Search

Events

Transcoding will happen on a background thread, but we will send updates through the TranscoderListener interface, which can be applied when building the request:

kotlin logokotlin
Transcoder.into(filePath) .setListenerHandler(handler) .setListener(object: TranscoderListener { override fun onTranscodeProgress(progress: Double) = Unit override fun onTranscodeCompleted(successCode: Int) = Unit override fun onTranscodeCanceled() = Unit override fun onTranscodeFailed(exception: Throwable) = Unit }) // ...

All of the listener callbacks are called:

  • If present, on the handler specified by setListenerHandler()
  • If it has a handler, on the thread that started the transcode() call
  • As a last resort, on the UI thread

onTranscodeProgress

This simply sends a double indicating the current progress. The value is typically between 0 and 1, but can be a negative value to indicate that we are not able to compute progress (yet?).

This is the right place to update a ProgressBar, for example.

onTranscodeCanceled

The transcoding operation was canceled. This can happen when the Future returned by transcode() is cancelled by the user.

onTranscodeFailed

This can happen in a number of cases and is typically out of our control. Input options might be wrong, write permissions might be missing, codec might be absent, input file might be not supported or simply corrupted.

You can take a look at the Throwable being passed to know more about the exception.

onTranscodeCompleted

Transcoding operation did succeed. The success code can be:

CodeMeaning
Transcoder.SUCCESS_TRANSCODEDTranscoding was executed successfully. Transcoded file was written to the output path.
Transcoder.SUCCESS_NOT_NEEDEDTranscoding was not executed because it was considered not needed by the Validator.

Subscribe to the DeepMedia Newsletter

The latest news about DeepMedia products, open source projects and software development at our company.

By clicking “Subscribe”, you agree that DeepMedia may use your email address to send you newsletters, including commercial communications, and to process your personal data for this purpose. You agree that DeepMedia may process said data using third-party services for this purpose in accordance with the DeepMedia Privacy Policy. You can revoke this consent at any time using the unsubscribe link included in each email or by writing at contact@deepmedia.io.