Closed fixed closed 11 years ago
yep, I'm already diving into it :)
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)
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?
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();
});
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).
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.
@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.
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...
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
I guess we can close that one.
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