dev_android
dev_android

Reputation: 8818

Play mediaplayer for certain duration

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

Upvotes: 0

Views: 3019

Answers (2)

user611447
user611447

Reputation:

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

Upvotes: 3

techi.services
techi.services

Reputation: 8533

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

Upvotes: 1

Related Questions