Giter Club home page Giter Club logo

Comments (5)

NiiightmareXD avatar NiiightmareXD commented on May 19, 2024

Ok... I have no idea what's happening 😂.

Maybe something is wrong with the DispatcherQueue I think I have to get help from robmikh/Win32CaptureSample .

from windows-capture.

NiiightmareXD avatar NiiightmareXD commented on May 19, 2024

robmikh/Win32CaptureSample#17

from windows-capture.

NiiightmareXD avatar NiiightmareXD commented on May 19, 2024

So this works:

use std::thread::sleep;
use std::time::Duration;

use windows_capture::window::Window;
use windows_capture::{
    capture::GraphicsCaptureApiHandler,
    frame::Frame,
    graphics_capture_api::InternalCaptureControl,
    settings::{ColorFormat, CursorCaptureSettings, DrawBorderSettings, Settings},
};

struct Capture {}

impl GraphicsCaptureApiHandler for Capture {
    type Flags = String;

    type Error = Box<dyn std::error::Error + Send + Sync>;

    fn new(message: Self::Flags) -> Result<Self, Self::Error> {
        Ok(Self {})
    }

    fn on_frame_arrived(
        &mut self,
        frame: &mut Frame,
        capture_control: InternalCaptureControl,
    ) -> Result<(), Self::Error> {
        println!("Frame Arrived");
        Ok(())
    }

    fn on_closed(&mut self) -> Result<(), Self::Error> {
        println!("Capture Session Closed");
        Ok(())
    }
}

fn main() {
    let window = Window::from_contains_name("Notepad").unwrap();

    std::thread::spawn(move || {
        let settings = Settings::new(
            window,
            CursorCaptureSettings::Default,
            DrawBorderSettings::Default,
            ColorFormat::Rgba8,
            "Yea This Works".to_string(),
        )
        .unwrap();

        Capture::start(settings).unwrap();
        println!("capture closed");
    });

    loop {
        sleep(Duration::from_secs(1));
    }
}

from windows-capture.

NiiightmareXD avatar NiiightmareXD commented on May 19, 2024

Fixed in 1.1.8, thanks for reporting the bug 😁.

from windows-capture.

enximi avatar enximi commented on May 19, 2024

thanks

from windows-capture.

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.