简体   繁体   English

播放Mediaplayer一定时间

[英]Play mediaplayer for certain duration

I want to play the mediaplayer for just 10 sec. 我只想播放媒体播放器10秒钟。 How to control it? 如何控制呢?

You can implement a CountDownTimer that will stop your MediaPlayer . 您可以实现CountDownTimer来停止MediaPlayer so you will not have to implement a thread or something. 因此您不必实现线程或其他东西。

您可以使用TimerTask来安排MediaPlayer.stop()在10秒后运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM