I’ve coded and designed a videoplayer that works ok. There are some problems however, and I’d like to optimize the code some more. I hope someone comes up with some ideas.
What is the best approach when you have the following things going on:
A Play/pause button that switches apperance everytime you click it (alternating play and pause symbol).
A “scrubber/playhead” that allows you to jump around in the clip.
The playhead jumps back to the beginning when the clip has reached the end.
I have solved the volume slider and mute problem. The strange thing is that the pause/play modes are getting more and more messy and behaving more and more strange.
For example, if you pause the clip and then decide that you’d like to jump ahead with the scrubber, the clip must still be paused when you release the scrubber. But if you move the scrubber when the clip is playing, the clip must continue when you release. While this is going on i also have to update the progress bar that fills with black behind the playhead as you watch the clip.
I’ve gotten around this with a bunch of if-statements, but that’s getting increasingly messy… So now I’m thinking of trying my skills at designing classes to handle the different parts of the videoplayer, perhaps even implement some kind of “design pattern”.
Is there anything that pops up in your heads that might help me along the way?