Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-30-2007, 10:33 PM   #1
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,140
Default Video Player as OOP project

Hi Guys,

I'm okay with code, so I'm not asking about that. However, I'd like to get a little help with coming up with a OOP structure for a video player; you know, just the standard youtube player.

From what I've learn so far I can rule out the use of several patterns:
Factory - doesn't seem to be any need for a factory
Adapter - I'm creating the code from scratch so no need.
Iterator - I won't be storing any list of data, and if I do it will be xml
Composite - I wont be having grouping of videos with sub videos so that is out.
State - while there will be different states of the player (playing, paused), i don't think this pattern will be used
Facade - i could use it, but i think it is over kill
Decorator - i don't see how right now
So that leaves me with:
Observer - this is built into the way flash event handling
Strategy - maybe?
Command - eh.....
But I also want to keep in mind (and what I haven't in the the past) is "A class should have only one reason to change" e.g. 1 class 1 job.

Could I get some help how to make a OO video player
Cheers
__________________
trace("Good bye Flash.") Log.i(TAG, "Hello Droid");
Flash Gordon is offline   Reply With Quote
Old 09-01-2007, 04:11 AM   #2
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,140
Default

I've just started reading about MVC, and that seems like the perfect design. Though I'm up for discussion.......
__________________
trace("Good bye Flash.") Log.i(TAG, "Hello Droid");
Flash Gordon is offline   Reply With Quote
Old 09-03-2007, 06:00 AM   #3
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,140
Default

Well....i think I'll do it 2 ways for fun:
  • State Pattern
  • MVC
__________________
trace("Good bye Flash.") Log.i(TAG, "Hello Droid");
Flash Gordon is offline   Reply With Quote
Old 10-22-2007, 05:33 AM   #4
m23
Registered User
 
Join Date: Jan 2006
Posts: 10
Default Progress?

I am working on the same project. How has it been going?

I definitely see using the state pattern, but I'm not sure exactly how it fits into an mvc pattern. For example, I'm thinking that the model would be the context in the state pattern, and that the controllers would be the states.

The view would be the user interface. Would each ui element be a view? I'm working on the code but I'm not sure how it will all work in the end. Is there a pattern for the views calling the controllers? Or do you just hard code that in, since you're dealing with ui elements using flash event handling?

Also, I'm looking at using the Observer pattern as well. The model would be the subject in the observer pattern, with the views being the observers.

Last edited by m23; 10-22-2007 at 05:39 AM. Reason: forgot something
m23 is offline   Reply With Quote
Old 10-22-2007, 06:39 AM   #5
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,140
Default

on the adobe site, they have a tutorial how to do it as a state pattern. It looked pretty stupid to me. The MVC turned out great.
__________________
trace("Good bye Flash.") Log.i(TAG, "Hello Droid");
Flash Gordon is offline   Reply With Quote
Old 10-23-2007, 05:11 PM   #6
m23
Registered User
 
Join Date: Jan 2006
Posts: 10
Default

So which patterns did you use?

Also, why did the state pattern not work for you? (I'm not looking to debate any particular pattern, just curious about your experience.)

Last edited by m23; 10-23-2007 at 05:13 PM.
m23 is offline   Reply With Quote
Old 10-23-2007, 06:03 PM   #7
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,140
Default

Adobe State Pattern Tutorial

I used MVC. State Pattern doesn't make sense to me for this. There really are no "states" for a video player.
__________________
trace("Good bye Flash.") Log.i(TAG, "Hello Droid");
Flash Gordon is offline   Reply With Quote
Old 10-23-2007, 06:13 PM   #8
m23
Registered User
 
Join Date: Jan 2006
Posts: 10
Default

I'm guess I'm looking for various code examples. So you used an mvc framework like this? Colin Moock provides some class files for implementing mvc.

http://www.adobe.com/devnet/flash/ar...ontroller.html

If you could post any example code, I would greatly appreciate it!

Can I see your video player online as well? Let's see your handy work
m23 is offline   Reply With Quote
Old 10-23-2007, 07:09 PM   #9
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,140
Default

The video player is propritary. I can't give you any help there, other than just guiding you.

Your best best is just to start coding it in several pattern and find the limitations yourself. For me and what I wanted, MVC made the most sense. You may have different needs.
__________________
trace("Good bye Flash.") Log.i(TAG, "Hello Droid");
Flash Gordon is offline   Reply With Quote
Old 10-23-2007, 09:10 PM   #10
m23
Registered User
 
Join Date: Jan 2006
Posts: 10
Default eh?

Not looking for anything for free. Just some code examples. So I didn't mean to imply that. I couldn't post any code from actual production projects either.

If anyone would like to post some examples of design patterns they have used and found suited to a video player, I would appreciate it.

For example, to me, in the mvc pattern, it makes sense to use the observer pattern between the view and the model, with the model being the subject and view being the observer. So, within mvc, there are multiple design patterns used to implement mvc. That's my understanding. I working this out in uml and I would be glad to post selected examples later.
m23 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to detect video stream freeze in player jgpandit Flash 8 General Questions 3 07-30-2007 03:27 PM
Building a Custom Multi-Video Player senan Components 0 09-22-2006 02:05 PM
Custom FLV Streaming Video Player - Smooth Scrub/Seek Needed jrock ActionScript 2.0 4 07-24-2006 05:32 PM
video buffer not behaving in Firefox with player 7 sho nuff ActionScript 2.0 0 04-24-2006 07:55 PM


All times are GMT. The time now is 05:44 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.