Let's add the feature that allows users to loop over tracks. We have already defined radio buttons to allow three choices, as shown in the following screenshot:
In essence, the player should provide a choice from the following three options:
- No Loop: Play a track and end there
- Loop Current: Play a single track repeatedly
- Loop All: Looping through the entire playlist, one after another
The decision to follow one of these three options needs to be taken immediately after a particular track ends playing. The best place to judge whether a track has come to its end is from within the periodic updates loop that we created earlier. ...