Added in API level 1

OnErrorListener


interface OnErrorListener
android.media.MediaPlayer.OnErrorListener

Interface definition of a callback to be invoked when there has been an error during an asynchronous operation (other errors will throw exceptions at method call time).

Summary

Public methods
abstract Boolean
onError(mp: MediaPlayer!, what: Int, extra: Int)

Called to indicate an error.

Public methods

onError

Added in API level 1
abstract fun onError(
    mp: MediaPlayer!,
    what: Int,
    extra: Int
): Boolean

Called to indicate an error.

Parameters
mp MediaPlayer!: the MediaPlayer the error pertains to
what Int: the type of error that has occurred:
extra Int: an extra code, specific to the error. Typically implementation dependent.
Return
Boolean True if the method handled the error, false if it didn't. Returning false, or not having an OnErrorListener at all, will cause the OnCompletionListener to be called.