I am using the default Android Media Player in an Activity, trying to play back a couple of video files. However I have a problem with programming what I want. The desired program outcome would be the following:
How am I to program this? Currently, I use a paradigm like the following:
playVideo(int)
So I pass it the first file. onPrepared(MediaPlayer)
. onCompletion(MediaPlayer)
listener of the media player shows the dialog to the user by calling showDialog()
. dismiss()
on the dialog, the player object is started for the next file by calling playVideo(int)
. This works, but it feels a bit quirky and not clean. And it's of course very procedural. The problems are:
Has anyone got an idea?
For the pause, you could use the AlarmManager to schedule an alarm five seconds from now. It will launch an intent, and that intent could call playVideo(int)
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.