IllegalStateException异常调用MediaPlayer.reset() [英] IllegalStateException calling MediaPlayer.reset()

查看:4788
本文介绍了IllegalStateException异常调用MediaPlayer.reset()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该文件为Android 的MediaPlayer 显示,不存在无效的状态为重设()电话:<一个href="http://developer.android.com/reference/android/media/MediaPlayer.html#Valid_and_Invalid_States" rel="nofollow">http://developer.android.com/reference/android/media/MediaPlayer.html#Valid_and_Invalid_States (无效状态被列为{},或无)。

The documentation for the Android MediaPlayer shows that there are no invalid states for the reset() call: http://developer.android.com/reference/android/media/MediaPlayer.html#Valid_and_Invalid_States (the invalid states are listed as {}, or "none.").

不过,我已经看到了 IllegalStateException异常同时呼吁抛出复位()

However, I have seen an IllegalStateException thrown while calling reset():

java.lang.IllegalStateException
at android.media.MediaPlayer._reset(Native Method)
at android.media.MediaPlayer.reset(MediaPlayer.java:1061)
at com.example.android.player.AsyncPlayer$AsyncHandler.handleMessage(AsyncPlayer.java:654)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.os.HandlerThread.run(HandlerThread.java:60)

时的文件不正确?

Is the documentation incorrect?

推荐答案

很难说没有看到您的code,但我想你可能会调用reset()调用释放后()?

Hard to say without seeing your code but I think you may be calling reset() after you call release() ?

该文档状态

在使用新的或重置后的()被调用时,它处于空闲状态刚刚创建的MediaPlayer对象;和释放后()被调用时,它处于结束状态。这两种状态之间的MediaPlayer对象的生命周期。

When a MediaPlayer object is just created using new or after reset() is called, it is in the Idle state; and after release() is called, it is in the End state. Between these two states is the life cycle of the MediaPlayer object.

您可以致电复位有效生命周期之外。

You may be calling reset outside of the valid life cycle.

这篇关于IllegalStateException异常调用MediaPlayer.reset()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆