Play mediaplayer for certain duration

♀尐吖头ヾ 提交于 2019-12-18 09:38:15

问题


I want to play the mediaplayer for just 10 sec. How to control it?


回答1:


You could use TimerTask to schedule a MediaPlayer.stop() to run after 10 secs.




回答2:


You can implement a CountDownTimer that will stop your MediaPlayer. so you will not have to implement a thread or something.



来源:https://stackoverflow.com/questions/4958003/play-mediaplayer-for-certain-duration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!