fixed / industriesalonfunk

0 stars 0 forks source link

Implement Video component #4

Closed fixed closed 11 years ago

fixed commented 11 years ago

Add effect base class and a few effects. Look into mixer/video.js and media/audio/audio for examples, as well as the Seriously.js documentation

alponet commented 11 years ago

yep, I'm already diving into it :)

fixed commented 11 years ago

Alright. So just as a heads-up. When there are effects in the station, you build a chain where effects' "target" parameters are connected to the "source" of the next one. The <video> element will, of course, be the "source" of the first effect, and when you attach that whole chain to the mixer, you use mixer.video.attachSource(lastEffect)

alponet commented 11 years ago

I've been chewing your code for ages now, but I cannot make run even one filter that is not written directly into the VideoMixer, but placed in another file. Probably that's my lack of grasp concerning the namespacing, require.js or whatsoever.

As an example, let's assume we have one file "example.js":

define([
],function(){
    function Example(){
        console.info("Hello world");
    }

    return Example;
});

and a second

define([
    'example'
],function(){
    new Example();
});

I would get an Uncaught ReferenceError: Example is not defined Could you give me a briefing of how this works, keywords to feed google or links to fill my knowledge gaps?

fde31 commented 11 years ago

You are missing the parameter in the function you are passing to define. It has to look like this:

define([
    'example'
], function(Example) {
    new Example();
});
fixed commented 11 years ago

Also, make sure that the paths to your modules are correct (the base directory is "src/js" regardless of where you want to include the module).

fixed commented 11 years ago

Another thing: have you updated your git-repo correctly? Because we are referencing Seriously.js as submodule in "src/js/lib/seriouslyjs", make sure that the directory is there and populated.

fde31 commented 11 years ago

@alponet does this help you, did you get it working? Some status report would be cool :) And of course let me know if you need any further help or encounter any other problems.

alponet commented 11 years ago

Sorry, I should give some feedback to your assistance, you're right. Well, it did not really help.

As my first approach for getting into this, I tried to create an instance of Example directly inside the function VideoMixer() of mixer/video.js, which just does not work, neither with the definition parameter you mentioned above.

So now I instantiate the effects as intended within media/video/video.js, which does the job eventually. Hopefully I'll figure out how to set the in- and outputs properly to build the chain.

Sometimes I feel like my studies were totally useless...

fixed commented 11 years ago

Looking at the VideoMixer right now. There is one pitfall here in the define statement: the fader effect is loaded but not added as reference in the code because Seriously creates effects by their name, not their class. I assume you just added your Example class to the paths as well as to the anonymous function, like this:

define([
    'jquery',
    'seriously',
    'lib/seriouslyjs/effects/seriously.fader',
    'Example'
],function($, Seriously, Example){

Since the seriously-fade is omitted in the argument list, Example would now reference the effect code (which does not work because effects do not follow the AMD rules) because RequireJS maps the paths to the arguments in order. To mitigate against this, put the path to Example before the fader path.

I am sorry that I didn't documented it. Hopefully that sheds some more light on the use of RequireJS in combination with Seriously.js

fde31 commented 11 years ago

I guess we can close that one.