03-23 22:53:16.229: E/MediaPlayer(19185): pause called in state 803-23 22:53:16.229: E/MediaPlayer(19185): error (-38,0) 03-23 22:53:16.449: E/MediaPlayer(19185): Error (-38,0)03-23 22:53:16.449: D/Openglrenderer(19185): Flushing caches (mode 0) 03-23 22:53:16.459: D/Openglrenderer(19185): Flushing caches (mode 0)03-23 22:53:17.759: D/Openglrenderer(19185): Flushing caches (mode 0) 03-23 22:53:17.809: W/MediaPlayer-JNI(19185): MediaPlayer finalized without being released03-23 22:53:17.809: W/MediaPlayer-JNI(19185): MediaPlayer finalized without being released03-23 22:53:17.809: W/MediaPlayer-JNI(19185): MediaPlayer finalized without being released解决方法 您可以使用简单的if-check来处理暂停.试试这个:
MediaPlayer mp = MediaPlayer.create(this,Uri.parse(Environment.getExternalStorageDirectory().getPath()+ "/Music/jaihind.mp3"));if(mp.isPlaying()) { mp.pause();} else { mp.start();}
注意:
mp = MediaPlayer.create(...);
已经准备好返回的MediaPlayer,因此您无法再次调用prepare(或其变体)(并且也不需要onPreparedListener).
总结以上是内存溢出为你收集整理的android:媒体播放器 – 在状态8中调用暂停全部内容,希望文章能够帮你解决android:媒体播放器 – 在状态8中调用暂停所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)