问题描述
该文件为Android 的MediaPlayer
显示,不存在无效的状态为重设()
电话: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对象的生命周期。
您可以致电复位有效生命周期之外。
You may be calling reset outside of the valid life cycle.
这篇关于IllegalStateException异常调用MediaPlayer.reset()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!