State pattern, nesting video player states?

View: New views
1 Messages — Rating Filter:   Alert me  

State pattern, nesting video player states?

by bartclaessens :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi list!

I got a question concerning the State pattern. I'm coding a video player in Flash and I'm trying to use the State Pattern to handle all the different states of the player. A few days ago there was a similar post about this topic but no answer could solve my questions.

I'm creating a videoplayer that should have following states:

- idle (nothing happening, all buttons disabled, video screen black)
- show preroll (all buttons disabled, video screen showing a short flv)
- show video (some buttons enabled, video screen showing the real flv)
- show postroll (all buttons disabled, video screen showing a short flv)

I currently have a statemachine which controls the following states of the overall video player: PlayState, StopState, PauseState (all implementing the IState interface).

How do I continue? Something is telling me that creating a PreRollState, PostRollState, RealVideoState and adding them to the list of states (like PlayState, StopState, ...) isn't a correct solution. (Because all the states have to implement methodes they do not need, like: stopPlay(), startPlay(), ...)

- Do I have to nest the states of the above list with the states I already made for the playing, stopping, ...
- Do I have to use the playstate, stopstate, pausestate for the controls only? But what with the overall states of the video player in the list above

I'm a bit stuck at the moment :)
Would be nice if somebody could give me a little push in the right direction.

Thanks in advance!