Expand description
Screen capture stream functionality
This module provides the core streaming API for capturing screen content.
§Main Components
SCStream- The main capture stream that manages the capture sessionconfiguration::SCStreamConfiguration- Stream configuration (resolution, FPS, pixel format, audio)content_filter::SCContentFilter- Filter for selecting what to capture (display, window, app)output_trait::SCStreamOutputTrait- Trait for receiving captured framesoutput_type::SCStreamOutputType- Type of output (screen, audio, microphone)delegate_trait::SCStreamDelegateTrait- Trait for stream lifecycle events
§Workflow
- Query available content with
SCShareableContent - Create a content filter with
SCContentFilter::create() - Configure the stream with
SCStreamConfiguration::new() - Create and start the stream with
SCStream::new()
§Example
use screencapturekit::prelude::*;
let filter = SCContentFilter::create()
.with_display(display)
.with_excluding_windows(&[])
.build();
let config = SCStreamConfiguration::new()
.with_width(1920)
.with_height(1080);
let mut stream = SCStream::new(&filter, &config);
stream.add_output_handler(
|sample, output_type| println!("Got frame!"),
SCStreamOutputType::Screen
);
stream.start_capture()?;Re-exports§
pub use delegate_trait::ErrorHandler;pub use delegate_trait::SCStreamDelegateTrait as SCStreamDelegate;pub use delegate_trait::StreamCallbacks;pub use output_trait::SCStreamOutputTrait as SCStreamOutput;pub use sc_stream::SCStream;pub use content_filter::SCStreamType;
Modules§
- configuration
- content_
filter - Content filter for
ScreenCaptureKitstreams - delegate_
trait - Delegate trait for stream lifecycle events
- output_
trait - Output handler trait for stream callbacks
- output_
type - Output type enumeration for stream handlers
- sc_
stream - Swift FFI based
SCStreamimplementation