Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Welcome, Guest. Please login or register.
November 25, 2017, 04:19:47 AM
Home Help Search Login Register
News: Please DM @puremvc on Twitter to gain forum access. Spambots are why we can't have nice things.
Pages: [1]
Print
Author Topic: PureMVC with netStream / netConnection / Camera / Microphone objects  (Read 3999 times)
benissimo
Jr. Member
**
Posts: 13


View Profile WWW
« on: February 25, 2012, 07:26:16 AM »

Hi

I read an old thread in these forums which said that basically netStream objects could be thought of as dataProviders to a video object, and therefore needn't be part of the Model but could be bundled into the view component.

I'd like to continue this discussion if possible...

I can see the reasoning behind the above. A netStream doesn't really contribute to the domain model, its just a platform-specific (and therefore non-portable) method of transporting data to the view tier. If this is the case and I understand it correctly, then what does this mean for the various other players in a video application?

Does this mean the netConnection is also part of the view? After all, its also platform-specific and tells us nothing about the domain model. In which case where should the actual netConnection object be created and where should it be stored?
To the netStream we also likely need to attach Camera and Microphone objects. These are clearly view components, but should they be created inside the stream viewer component? And for setting various options (eg camera bandwidth, microphone codec) should the view component expose those objects and let a command set the properties?
Maybe its better to create a WebcamVO object to hold these relevant parameters, and pass that VO into the webcam view component, in which case does this VO belong in the model since its just a convenient way to group together a bucket of numbers.

I guess if I can summarise those random thoughts into a coherent whole:
when using these built-in AS3 classes such as netConnection are these immediately good candidates to stay out of the model since they are necessarily platform-dependent? And more generally are there good rules of thumb to determine where object creation and storage should be carried out?

Thanks,

Ben.



Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW
« Reply #1 on: February 25, 2012, 04:40:34 PM »

Consider a simple form. Username, password, and 'remember me' fields. You define the text inputs and the check boxes that gather input from the user's mouse and keyboard inside a 'Form' view component of some sort, and then mediate it to carry away information from it or pass data to it (e.g., populating the form from a cookie).

So, why would we treat camera and microphone inputs any differently? Certainly we can pass a WebCamSettingsVO to such a component by sending it off in a note that it's mediator is interested in. When input streams into the component, we can send progress events with data that the mediator can send off to a command for processing before storage, or even straight to a proxy method that will store the data if you're say, streaming to disk or across the 'net. Those packets of data can be handled by the Proxy, who only needs to know about the data object and what to do with it, and is not tied to the business of webcams and microphones beyond handling data VOs and settings VOs.

Don't put the NetStream, Camara or Microphone management into a command (which should be isolated from the boundaries where input comes from), or a mediator (which should just shuttle data to and from the view component). Make the view components, just like simple, boring forms, handle getting the data from the user and dispatching it as need be in events.

-=Cliff>
Logged
benissimo
Jr. Member
**
Posts: 13


View Profile WWW
« Reply #2 on: April 18, 2012, 06:07:16 AM »

Hi

just wanted to say thanks for the thorough, and quick, response to my question - much appreciated!

I also want to add that I got down to work building an app using the puremvc framework with the help of your O'Reilly book "Actionscript Developer's Guide to PureMVC". I would wholeheartedly recommend this book to anyone using PureMVC. It has been next to my keyboard the entire time I've been coding and I find myself constantly referring to it and occasionally lifting techniques wholesale. Its been invaluable to me during this project. No connection with the author here, just glad to pay back with a good reference.

I'll almost certainly have more questions as I learn more, but in the meantime thanks Cliff for leading the way with this framework!

Ben.

Logged
Pages: [1]
Print
Jump to: