bbc / VideoContext

An experimental HTML5 & WebGL video composition and rendering API.
http://bbc.github.io/VideoContext/
Apache License 2.0
1.33k stars 157 forks source link

Improved the 1st DEMO sample at README #34

Closed barata0 closed 7 years ago

barata0 commented 7 years ago

The nodes were only visible during the crossFade. Connecting them to the videoCtx.destination make them visible before and after that making the effect more impressive. The transition value was wrong also going from 0 to 1 means 1st clip started on fade.

emshotton commented 7 years ago

Hi @barata0, thanks for submitting this. I think the bug in the example is in a slightly different place. If the ordering of the inputs is changed in the original example the code will work as expected (same as your solution works). But be a bit simpler and have no need to connect each video node to the destination as well as the transition:

             var videoNode1 = videoCtx.video("./video1.mp4");
              videoNode1.start(0);
              videoNode1.stop(4);

              var videoNode2 = videoCtx.video("./video2.mp4");
              videoNode2.start(2);
              videoNode2.stop(6);

              var crossFade = videoCtx.transition(VideoContext.DEFINITIONS.CROSSFADE);
              crossFade.transition(2,4,0.0,1.0, "mix");

              videoNode1.connect(crossFade);  //Swap so videoNode1 is connected first.
              videoNode2.connect(crossFade);

If you update this pull request with this change i'll happily merge it so you have commits contributing to the project. Or I can do this myself.

Kind regards, Matt

barata0 commented 7 years ago

No problem. You can do it. Thanks for the explanation and the great project