The audio program must update some information as soon as an audio track starts playing. Broadly speaking, there are two kinds of updates that the program needs to monitor and update:
- One-time updates: Examples of this include the name of the track and the total length of the track.
- Continuous updates: Examples of this include the position of the seek bar knob and the elapsed play duration. We also need to check continuously whether a track has ended either to play the next track, play the current track again, or stop playing, depending on the loop choice made by the user.
These two kinds of updates will affect sections of the audio player, as shown in the following screenshot:
Let's start with the one-time updates, as they are relatively simple to implement.
Since these updates must occur when the playback starts, let's define...