MediaPlayer error类型汇总

这篇博客详细介绍了MediaPlayer在播放过程中可能遇到的各种错误代码,包括MEDIA_ERROR_UNKNOWN、MEDIA_ERROR_SERVER_DIED等,涵盖了从文件错误到不支持的媒体格式等各种情况。对于每个错误代码,都提供了相应的处理建议,如释放并重建MediaPlayer对象或检查文件格式的正确性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

/** 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;

/** The video is streamed and its container is not valid for progressive
 * playback i.e the video's index (e.g moov atom) is not at the start of the
 * file.
 * @see android.media.MediaPlayer.OnErrorListener
 */
public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK = 200;

/** 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;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值