I was wondering what the state machine for a video player would be like.
I can think of two states : playing and paused.
- When the video is playing and the user clicks on a point in the progress bar the video is paused (the video player transitions from the playing state to paused state) until the user stops pressing the mouse button. When the mouse is released the video begins to play again from the selected point (the video player transitions from the paused state to the playing state).
- However if the video was paused before the user clicked on the progress bar the video jumps to the specified point but does not start playing (the video player remains in the paused state).
The state transitions would be :
playing (begin click on progress bar)--> paused (end click on progress bar)--> playing paused (begin click on progress bar)--> paused (end click on progress bar)--> paused
If there was a method to change the position of the video in the paused state, then calling that method would result in a different state depending on the previous state. I was wondering if there is an alternate state machine design for a video player where the transitions from each state do not depend on any previous state.