Giter Site home page Giter Site logo

Comments (8)

Statfine avatar Statfine commented on May 22, 2024 1

@MatthewShotton
const urlOne = 'rightUrl';
const urlTwo = 'wrongUrl'
const node = this.ctx.video(urlOne, 0, 4, { volume: 0.8, loop: false });
node.startAt(0);
node.stopAt(15);

const nodeTwo = this.ctx.video(urlTwo, 0, 4, { volume: 0.8, loop: false });
nodeTwo.startAt(15);
nodeTwo.stopAt(30);

node.connect(this.ctx.destination);
nodeTwo.connect(this.ctx.destination);
this.ctx.play();
wechatimg53

from videocontext.

Statfine avatar Statfine commented on May 22, 2024 1

thanks, VideoContext is still playing when source nodes throws an error after i update it to v0.38.2.It's very helpful for me

from videocontext.

MatthewShotton avatar MatthewShotton commented on May 22, 2024

Hi @Statfine

Thanks for raising this. I've just pushed a new release, v0.36.0 which adds an error callback to nodes which will get thrown if content cannot be loaded for a specific node. It can be used like the following:

this.ctx = new VideoContext();
let video = ctx.video("./errorvideo.mp4");
video.start(0);

video.registerCallback("error", (n)=>{
    console.log("Error with node", n);
   // Destroy the node so it doesn't try and play and cause the videocontext to stall.
    n.destroy();
});

The error callbacks will be called as soon as the VideoContext tries to load the source node (this is usually approximately 4 seconds before it is due to be played, and will be shortly after the "load" callback gets triggered on the node).

Currently you have to call destroy() or resetTimelineState() on a node which throws an error otherwise the VideoContext will continue trying to play it which will cause the VideoContext to halt.

Does that help with your requirements?

Kind regards,
Matt

from videocontext.

Statfine avatar Statfine commented on May 22, 2024

@MatthewShotton can videoContext still play if i don't do n.destroy() when video.registerCallback("error",...); just don't show frame

from videocontext.

MatthewShotton avatar MatthewShotton commented on May 22, 2024

@Statfine I've just pushed a change to v0.38.0 which will let the VideoContext continue playing if one of the source nodes throws an error. Let me know if you have any problems with it. Cheers!

from videocontext.

Statfine avatar Statfine commented on May 22, 2024

wechatimg43

i have update it to v0.38.0; but the VideoContext is not playing when source nodes throws an error, should i use something function to continue

from videocontext.

MatthewShotton avatar MatthewShotton commented on May 22, 2024

hi @Statfine , I've pushed v0.38.1 which adds some extra checks for testing if a video node is not valid.

If that doesn't fix the problem are you able to put together a minimal example that demonstrates the problem you're seeing? I'm having trouble re-creating the exact error you have.

from videocontext.

MatthewShotton avatar MatthewShotton commented on May 22, 2024

@Statfine I've just published v0.38.2 to npm/github. Let me know if you have any luck with that!

I'm not sure why my original test code failed to catch this, but the code you've sent has replicated the issue well enough to hopefully fix it.

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.