Module stream

Module stream 

Source
Expand description

Screen capture stream functionality

This module provides the core streaming API for capturing screen content.

§Main Components

§Workflow

  1. Query available content with SCShareableContent
  2. Create a content filter with SCContentFilter::create()
  3. Configure the stream with SCStreamConfiguration::new()
  4. 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::SCShareableContentStyle;
pub use content_filter::SCStreamType;

Modules§

configuration
content_filter
Content filter for ScreenCaptureKit streams
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 SCStream implementation