Giter Site home page Giter Site logo

Comments (10)

Statfine avatar Statfine commented on May 22, 2024

@MatthewShotton crossFade is ok but crossFade2 is not work, and after end do replay node2 is show "nocontent"

from videocontext.

MatthewShotton avatar MatthewShotton commented on May 22, 2024

@Statfine Hi!,

Your crossFade2 doesn't work because it only has one input connected to it.

The simplest way to fix this is to connect crossFade to the first input of crossFade2 instead of connecting it to the destination:

node.connect(crossFade);
node2.connect(crossFade);
crossFade.transition(5, 10, 0.0, 1.0);

crossFade.connect(crossFade2); //connect to input of crossfade2 rather than destination.
node3.connect(crossFade2);

crossFade2.connect(this.ctx.destination);
crossFade2.transition(15, 20, 0.0, 1.0);

I will have a look into the bug affecting the replay shortly.

Kind regards,
Matt

from videocontext.

MatthewShotton avatar MatthewShotton commented on May 22, 2024

Also, this file:
https://github.com/bbc/VideoContext/blob/master/docs/js/utils.js
Has some useful code for creating a visualisation of the videocontext's timeline and graph which can be useful for debugging.
It will create diagrams like on the bottom of this page: http://bbc.github.io/VideoContext/examples/transitions.html

from videocontext.

MatthewShotton avatar MatthewShotton commented on May 22, 2024

@Statfine
I've pushed a fix for the "nocontent" being fired when replaying the composition as 0.38.3 to npm and github.

This was due to the underlying video element being set to undefined when a node had finished playing, which caused an error callback to be called on the underlying video element and the video node to be incorrectly tagged as being in an error state.

from videocontext.

Statfine avatar Statfine commented on May 22, 2024

thanks; it's good for me

from videocontext.

Statfine avatar Statfine commented on May 22, 2024

@MatthewShotton
I have another question,at the end of the video to achieve special effects, i can do like this
const node = this.ctx.video('mp4');
node.startAt(0);
node.stopAt(10);
const crossFade = this.ctx.transition(VideoContext.DEFINITIONS.CROSSFADE); // 渐显

node.connect(crossFade);
crossFade.connect(this.ctx.destination);
crossFade.transition(7, 10, 0.0, 1.0);

but if i want at the begin of the video to achieve special effects; what can i do?? l have change crossFade.transition(0, 3, 0.0, 1.0); but it's not well

from videocontext.

MatthewShotton avatar MatthewShotton commented on May 22, 2024

@Statfine you can swap around the last two parameters like so:

crossFade.transition(0, 3, 1.0, 0.0); 

The last two parameters define what to change the mix parameter from and to. So in this new code the transition is happening from the second input to the first input.

The definition file for the crossfade should give some insight into what is going on (if you look in the "fragmentShader" section "color_a" is the first input and "color_b" as the second input):
https://github.com/bbc/VideoContext/blob/master/src/Definitions/crossfade.js

Hope that makes sense!

from videocontext.

Statfine avatar Statfine commented on May 22, 2024

so shouldn't used this function if there is only one input?

from videocontext.

MatthewShotton avatar MatthewShotton commented on May 22, 2024

If there's only one input the other input will default to being transparent, so you can use it with only one input if you like. It depends on what effect you are looking to achieve!

from videocontext.

Statfine avatar Statfine commented on May 22, 2024

@MatthewShotton Oh, I see,thank you very much

from videocontext.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.