android - Handle "Cannot play this video" in VideoView -
is there way handle cannot play video in android video view programatically.
you have implement mediaplayer.onerrorlistener
, provide following videoview
method
public void setonerrorlistener (mediaplayer.onerrorlistener l)
it may
mediaplayer.onerrorlistener onerrorlistener = new mediaplayer.onerrorlistener() { @override public boolean onerror(mediaplayer mp, int what, int extra) { log.e(getpackagename(), string.format("error(%s%s)", what, extra)); return true; } };
mp mediaplayer error pertains to
what type of error has occurred: media_error_unknown media_error_server_died
extra code, specific error. typically implementation dependent. media_error_io media_error_malformed media_error_unsupported media_error_timed_out
media_error_unsupported
constant represents state looking for.
returns true if method handled error, false if didn't. returning false, or not having onerrorlistener @ all, cause oncompletionlistener called.
Comments
Post a Comment