If you have used the app and done some physical workout along with it, you will be missing the exercise pause functionality badly. The workout just does not stop till it reaches the end. We need to fix this behavior.
To pause the exercise, we need to stop the timer and stop all the sound components. Also, we need to add a button somewhere in the view that allows us to pause and resume the workout. We plan to do this by drawing a button overlay over the exercise area in the center of the page. When clicked, it will toggle the exercise state between paused and running. We will also add keyboard support to pause and resume the workout using the key binding p or P. Let's start with fixing our controller.