Giter Club home page Giter Club logo

Comments (6)

Vinlic avatar Vinlic commented on September 3, 2024

@ivangusev

There is no such function implemented yet, but there is a video cover image output function:

const video = wvc.createSingleVideo({
    ...,
    // Enable cover image capture
    coverCapture: true,
    // Time in milliseconds to capture the image (default is 20% of the video's duration)
    coverCaptureTime: 1000,
    // Image format for capture (jpg/png/bmp), default is jpg
    coverCaptureFormat: "jpg"
});

A way to interrupt video capture is on the list of planned features, probably in the next release 🐱 .

from webvideocreator.

ivangusev avatar ivangusev commented on September 3, 2024

@Vinlic , yes i know for cover image, but it's not optimal
Why following would not work:

pagePrepareFn: async function(page) {
  const _page = page.target;
  await _page.screenshot({ path: 'image.png' });
  // here to interrupt video capture
}

from webvideocreator.

Vinlic avatar Vinlic commented on September 3, 2024

@ivangusev
Because when the pagePrepareFn function is called, rendering has not yet started, and the screenshot function needs to start rendering before it can be obtained, they are deadlocked :D

Maybe you can try the following code, or wait for startup before taking a screenshot. You can wait for startup through the startAndWait() function.

pagePrepareFn: async function(page) {
  const _page = page.target;
  setTimeout(() => {
        _page.screenshot({ path: 'image.png' })
        .catch(err => console.error(err));
  }, 0)
}

from webvideocreator.

ivangusev avatar ivangusev commented on September 3, 2024

@Vinlic ,

A way to interrupt video capture is on the list of planned features, probably in the next release 🐱 .

Still in plans?:)

from webvideocreator.

Vinlic avatar Vinlic commented on September 3, 2024

@ivangusev
Now you can interrupt the capture via video.abort() of the video instance or via captureCtx.abort() 😄
It is updated in version 0.0.34.

from webvideocreator.

ivangusev avatar ivangusev commented on September 3, 2024

@Vinlic, hm... for some reason it doesn't work for me - no error, it simply continue to render full duration video

const video = wvc.createSingleVideo({
  ...
  pagePrepareFn: async function(page) {
    video.abort();

from webvideocreator.

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.