Building reusable MVC groups or "How do I have 3 of the same video player on stage"
I've been digging around the forums for about an hour now and so I apologize if this answer is already covered in a previous thread and I just wasn't able to find it.
Basically I'm building a reusable video player and I'd like to do an MVC approach where the model holds/handles the netconnection, netstream and actual video object. The view is given a reference to the video object via a signal and adds it to stage. Video controls on the view trigger commands, which affect the model, which updates the video/stream, which is then reflected in the view. However, in a scenario where I have 3 of these video players on screen at the same time, how do I prevent collisions from occurring? From reading some of Stray's comments I figure that I can subclass my view/mediators and that'll take care of those guys adding/removing properly.. but how do I deal with the models if they're supposed to just be firing Signals which are injected into my mediators? Won't VideoModelA's Signal get picked up by VideoMediatorA, VideoMediatorB and VideoMediatorC? I could inject the model directly into the mediator and listen to it that way, but I prefer to just inject my signals...Should I do a bunch of named injections and use some kind of ID system? Or is it time to think about maybe wrapping each MVC relationship in a module of some kind to isolate them from one another?
Thanks for any feedback :)
- Rob
Comments are currently closed for this discussion. You can start a new one.
2 Posted by creynders on 20 Mar, 2011 07:52 AM
Personally I wouldn't do this in RL. This is a single component and doesn't use/need any other components/services/whatever. You're making it unnecessarily complex, IMO.
If you do want to use a MVC approach though I'd instantiate and resolve dependencies manually.
3 Posted by rob on 20 Mar, 2011 04:12 PM
Yeah that idea has been tugging at me. I'll take your advice and wrap it all up as a non RL MVC component. Thanks!
rob closed this discussion on 20 Mar, 2011 04:12 PM.