pub trait ScreenCaptureSource {
// Required methods
fn metadata(&self) -> Result<SourceMetadata>;
fn stream(
&self,
foreground_executor: &ForegroundExecutor,
frame_callback: Box<dyn Fn(ScreenCaptureFrame) + Send>,
) -> Receiver<Result<Box<dyn ScreenCaptureStream>>> ⓘ;
}Expand description
A screen or window that can be captured.
Get sources from Platform::screen_capture_sources. Call
ScreenCaptureSource::stream to start receiving frames.
Required Methods§
Sourcefn metadata(&self) -> Result<SourceMetadata>
fn metadata(&self) -> Result<SourceMetadata>
Returns a description of this source.
Sourcefn stream(
&self,
foreground_executor: &ForegroundExecutor,
frame_callback: Box<dyn Fn(ScreenCaptureFrame) + Send>,
) -> Receiver<Result<Box<dyn ScreenCaptureStream>>> ⓘ
fn stream( &self, foreground_executor: &ForegroundExecutor, frame_callback: Box<dyn Fn(ScreenCaptureFrame) + Send>, ) -> Receiver<Result<Box<dyn ScreenCaptureStream>>> ⓘ
Starts capturing this source and calls frame_callback with each frame.
The returned receiver resolves to the running ScreenCaptureStream, or to an
error if capture can’t start. The platform chooses the thread that runs
frame_callback, so the callback must be Send. Drop the stream to stop capture.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".