android.media.MediaPlayer错误码:
/** Unspecified media player error.
* @see android.media.MediaPlayer.OnErrorListener
*/
public static final int MEDIA_ERROR_UNKNOWN = 1;
/** Media server died. In this case, the application must release the
* MediaPlayer object and instantiate a new one.
* @see android.media.MediaPlayer.OnErrorListener
*/
public static final int MEDIA_ERROR_SERVER_DIED = 100;
/** File or network related operation errors. */
public static final int MEDIA_ERROR_IO = -1004;
/** Bitstream is not conforming to the related coding standard or file spec. */
public static final int MEDIA_ERROR_MALFORMED = -1007;
/** Bitstream is conforming to the related coding standard or file spec, but
* the media framework does not support the feature. */
public static final int MEDIA_ERROR_UNSUPPORTED = -1010;
/** Some operation takes too long to complete, usually more than 3-5 seconds. */
public static final int MEDIA_ERROR_TIMED_OUT = -110;
/** Unspecified low-level system error. This value originated from UNKNOWN_ERROR in
* system/core/include/utils/Errors.h
* @see android.media.MediaPlayer.OnErrorListener
* @hide
*/
public static final int MEDIA_ERROR_SYSTEM = -2147483648;
/**
* 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).
*/
public interface OnErrorListener
{
/**
* Called to indicate an error.
*
* @param mp the MediaPlayer the error pertains to
* @param what the type of error that has occurred:
*
*
{@link #MEDIA_ERROR_UNKNOWN}*
{@link #MEDIA_ERROR_SERVER_DIED}*
* @param extra an extra code, specific to the error. Typically
* implementation dependent.
*
*
{@link #MEDIA_ERROR_IO}*
{@link #MEDIA_ERROR_MALFORMED}*
{@link #MEDIA_ERROR_UNSUPPORTED}*
{@link #MEDIA_ERROR_TIMED_OUT}*
MEDIA_ERROR_SYSTEM (-2147483648)
- low-level system error.
*
* @return 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.
*/
boolean onError(MediaPlayer mp, int what, int extra);
}
/** Unspecified media player info.
* @see android.media.MediaPlayer.OnInfoListener
*/
public static final int MEDIA_INFO_UNKNOWN = 1;
/** The player was started because it was used as the next player for another
* player, which just completed playback.
* @see android.media.MediaPlayer#setNextMediaPlayer(MediaPlayer)
* @see android.media.MediaPlayer.OnInfoListener
*/
public static final int MEDIA_INFO_STARTED_AS_NEXT = 2;
/** The player just pushed the very first video frame for rendering.
* @see android.media.MediaPlayer.OnInfoListener
*/
public static final int MEDIA_INFO_VIDEO_RENDERING_START = 3;
/** The video is too complex for the decoder: it can't decode frames fast
* enough. Possibly only the audio plays fine at this stage.
* @see android.media.MediaPlayer.OnInfoListener
*/
public static final int MEDIA_INFO_VIDEO_TRACK_LAGGING = 700;
/** MediaPlayer is temporarily pausing playback internally in order to
* buffer more data.
* @see android.media.MediaPlayer.OnInfoListener
*/
public static final int MEDIA_INFO_BUFFERING_START = 701;
/** MediaPlayer is resuming playback after filling buffers.
* @see android.media.MediaPlayer.OnInfoListener
*/
public static final int MEDIA_INFO_BUFFERING_END = 702;
/** Estimated network bandwidth information (kbps) is available; currently this event fires
* simultaneously as {@link #MEDIA_INFO_BUFFERING_START} and {@link #MEDIA_INFO_BUFFERING_END}
* when playing network files.
* @see android.media.MediaPlayer.OnInfoListener
* @hide
*/
public static final int MEDIA_INFO_NETWORK_BANDWIDTH = 703;
/** Bad interleaving means that a media has been improperly interleaved or
* not interleaved at all, e.g has all the video samples first then all the
* audio ones. Video is playing but a lot of disk seeks may be happening.
* @see android.media.MediaPlayer.OnInfoListener
*/
public static final int MEDIA_INFO_BAD_INTERLEAVING = 800;
/** The media cannot be seeked (e.g live stream)
* @see android.media.MediaPlayer.OnInfoListener
*/
public static final int MEDIA_INFO_NOT_SEEKABLE = 801;
/** A new set of metadata is available.
* @see android.media.MediaPlayer.OnInfoListener
*/
public static final int MEDIA_INFO_METADATA_UPDATE = 802;
/** A new set of external-only metadata is available. Used by
* JAVA framework to avoid triggering track scanning.
* @hide
*/
public static final int MEDIA_INFO_EXTERNAL_METADATA_UPDATE = 803;
/** Informs that audio is not playing. Note that playback of the video
* is not interrupted.
* @see android.media.MediaPlayer.OnInfoListener
*/
public static final int MEDIA_INFO_AUDIO_NOT_PLAYING = 804;
/** Informs that video is not playing. Note that playback of the audio
* is not interrupted.
* @see android.media.MediaPlayer.OnInfoListener
*/
public static final int MEDIA_INFO_VIDEO_NOT_PLAYING = 805;
/** Failed to handle timed text track properly.
* @see android.media.MediaPlayer.OnInfoListener
*
* {@hide}
*/
public static final int MEDIA_INFO_TIMED_TEXT_ERROR = 900;
/** Subtitle track was not supported by the media framework.
* @see android.media.MediaPlayer.OnInfoListener
*/
public static final int MEDIA_INFO_UNSUPPORTED_SUBTITLE = 901;
/** Reading the subtitle track takes too long.
* @see android.media.MediaPlayer.OnInfoListener
*/
public static final int MEDIA_INFO_SUBTITLE_TIMED_OUT = 902;
/**
* Interface definition of a callback to be invoked to communicate some
* info and/or warning about the media or its playback.
*/
public interface OnInfoListener
{
/**
* Called to indicate an info or a warning.
*
* @param mp the MediaPlayer the info pertains to.
* @param what the type of info or warning.
*
*
{@link #MEDIA_INFO_UNKNOWN}*
{@link #MEDIA_INFO_VIDEO_TRACK_LAGGING}*
{@link #MEDIA_INFO_VIDEO_RENDERING_START}*
{@link #MEDIA_INFO_BUFFERING_START}*
{@link #MEDIA_INFO_BUFFERING_END}*
MEDIA_INFO_NETWORK_BANDWIDTH (703)
-
* bandwidth information is available (as extra
kbps)
*
{@link #MEDIA_INFO_BAD_INTERLEAVING}*
{@link #MEDIA_INFO_NOT_SEEKABLE}*
{@link #MEDIA_INFO_METADATA_UPDATE}*
{@link #MEDIA_INFO_UNSUPPORTED_SUBTITLE}*
{@link #MEDIA_INFO_SUBTITLE_TIMED_OUT}*
* @param extra an extra code, specific to the info. Typically
* implement