I am trying to implement the following, for a workout android app:
- A countdown timer is set and counts down time (lets say from 30sec to 0).
- From the moment the timer starts, a repeatable exercise mute video starts playing in a loop, until the timer reaches to 0, where the next exercise video comes, and the timer is reset to 30 counting down again.
- While the timer is running, audio is played simultaneously with the video to indicate to the user various things (ie. "Begin Workout", "3-2-1", "Next Exercise" etc.)
My question is, how do you combine video with Audio? For Video I use ExoPlayer. Is it good to combine ExoPlayer with SoundPool for Audio? Should I create multiple instances of ExoPlayer for both (and if so, to what do I bind the AudioPlayer Instance)?
According to this I found that the best solution was to use ExoPlayer for videos, and SoundPool for short audio speech indications.
I use an observer function in which I listen for timer events (ie tick == 4000) and use soundPool.play() each time the event happens.
For the Video, I listen to Timer Events (PLAYING, PAUSED, STOPPED) and use videoPlayer.play() as well.
See below code as an example: