SCStreamDelegateTrait

Trait SCStreamDelegateTrait 

Source
pub trait SCStreamDelegateTrait: Send {
    // Provided methods
    fn output_video_effect_did_start_for_stream(&self) { ... }
    fn output_video_effect_did_stop_for_stream(&self) { ... }
    fn did_stop_with_error(&self, _error: SCError) { ... }
    fn stream_did_stop(&self, _error: Option<String>) { ... }
}
Expand description

Trait for handling stream lifecycle events

Implement this trait to receive notifications about stream state changes, errors, and video effects.

§Examples

use screencapturekit::stream::delegate_trait::SCStreamDelegateTrait;
use screencapturekit::error::SCError;

struct MyDelegate;

impl SCStreamDelegateTrait for MyDelegate {
    fn stream_did_stop(&self, error: Option<String>) {
        if let Some(err) = error {
            eprintln!("Stream stopped with error: {}", err);
        } else {
            println!("Stream stopped normally");
        }
    }

    fn did_stop_with_error(&self, error: SCError) {
        eprintln!("Stream error: {}", error);
    }
}

Provided Methods§

Source

fn output_video_effect_did_start_for_stream(&self)

Called when video effects start

Source

fn output_video_effect_did_stop_for_stream(&self)

Called when video effects stop

Source

fn did_stop_with_error(&self, _error: SCError)

Called when stream stops with an error

Source

fn stream_did_stop(&self, _error: Option<String>)

Called when stream stops

§Parameters
  • error: Optional error message if the stream stopped due to an error

Implementors§

Source§

impl<F> SCStreamDelegateTrait for ErrorHandler<F>
where F: Fn(SCError) + Send + 'static,