Documentation
¶
Overview ¶
Package screencapturekit provides a Go wrapper for Apple's ScreenCaptureKit framework to capture screen recordings with HDR and microphone support on macOS.
Index ¶
- Variables
- func SupportsHDR() bool
- func SupportsHEVC() bool
- func SupportsMicrophone() bool
- type AudioDevice
- type CropArea
- type RecordingOptions
- type Screen
- type ScreenCaptureKit
- func (sck *ScreenCaptureKit) Cleanup()
- func (sck *ScreenCaptureKit) GetStreamingOptions() *StreamingOptions
- func (sck *ScreenCaptureKit) GetVideoPath() string
- func (sck *ScreenCaptureKit) IsRecording() bool
- func (sck *ScreenCaptureKit) IsStreaming() bool
- func (sck *ScreenCaptureKit) StartRecording(options RecordingOptions) error
- func (sck *ScreenCaptureKit) StartStreaming(options StreamingOptions) error
- func (sck *ScreenCaptureKit) StopRecording() (string, error)
- func (sck *ScreenCaptureKit) StopStreaming() error
- type StreamingOptions
Constants ¶
This section is empty.
Variables ¶
var ( ErrPermissionDenied = errors.New("screen capture permission denied") ErrInvalidDisplay = errors.New("invalid display ID") ErrAssetWriterFailed = errors.New("asset writer failed") ErrStreamFailed = errors.New("stream operation failed") ErrNotSupported = errors.New("feature not supported on this macOS version") ErrRecordingActive = errors.New("recording already active") ErrRecordingNotActive = errors.New("recording not active") ErrBinaryNotFound = errors.New("screencapturekit binary not found") )
Error types
Functions ¶
func SupportsHDR ¶
func SupportsHDR() bool
SupportsHDR returns true if the system supports HDR recording
func SupportsHEVC ¶
func SupportsHEVC() bool
SupportsHEVC returns true if the system supports HEVC encoding
func SupportsMicrophone ¶
func SupportsMicrophone() bool
SupportsMicrophone returns true if the system supports microphone capture
Types ¶
type AudioDevice ¶
type AudioDevice struct {
ID string `json:"id"`
Name string `json:"name"`
Manufacturer string `json:"manufacturer"`
}
AudioDevice represents an audio input/output device
func GetAudioDevices ¶
func GetAudioDevices() ([]AudioDevice, error)
GetAudioDevices returns all available audio devices
func GetMicrophoneDevices ¶
func GetMicrophoneDevices() ([]AudioDevice, error)
GetMicrophoneDevices returns all available microphone devices
type CropArea ¶
type CropArea struct {
X float64 `json:"x"`
Y float64 `json:"y"`
Width float64 `json:"width"`
Height float64 `json:"height"`
}
CropArea defines a rectangular area for cropping the recording
type RecordingOptions ¶
type RecordingOptions struct {
FPS int `json:"fps"`
CropArea *CropArea `json:"cropArea,omitempty"`
ShowCursor bool `json:"showCursor"`
HighlightClicks bool `json:"highlightClicks"`
ScreenID uint32 `json:"screenId"`
AudioDeviceID *string `json:"audioDeviceId,omitempty"`
MicrophoneDeviceID *string `json:"microphoneDeviceId,omitempty"`
VideoCodec string `json:"videoCodec"`
EnableHDR bool `json:"enableHDR,omitempty"`
UseDirectRecordingAPI bool `json:"useDirectRecordingAPI,omitempty"`
AudioOnly bool `json:"audioOnly,omitempty"`
}
RecordingOptions contains all options for screen recording
type Screen ¶
Screen represents a display screen
func GetScreens ¶
GetScreens returns all available screens for recording
type ScreenCaptureKit ¶
type ScreenCaptureKit struct {
// contains filtered or unexported fields
}
ScreenCaptureKit is the main recorder instance
func NewScreenCaptureKit ¶
func NewScreenCaptureKit() (*ScreenCaptureKit, error)
NewScreenCaptureKit creates a new ScreenCaptureKit instance
func (*ScreenCaptureKit) Cleanup ¶
func (sck *ScreenCaptureKit) Cleanup()
Cleanup releases any resources held by the ScreenCaptureKit instance
func (*ScreenCaptureKit) GetStreamingOptions ¶
func (sck *ScreenCaptureKit) GetStreamingOptions() *StreamingOptions
GetStreamingOptions returns the current streaming options
func (*ScreenCaptureKit) GetVideoPath ¶
func (sck *ScreenCaptureKit) GetVideoPath() string
GetVideoPath returns the path to the current recording file
func (*ScreenCaptureKit) IsRecording ¶
func (sck *ScreenCaptureKit) IsRecording() bool
IsRecording returns true if a recording is currently active
func (*ScreenCaptureKit) IsStreaming ¶
func (sck *ScreenCaptureKit) IsStreaming() bool
IsStreaming returns true if streaming is currently active
func (*ScreenCaptureKit) StartRecording ¶
func (sck *ScreenCaptureKit) StartRecording(options RecordingOptions) error
StartRecording begins screen recording with the specified options
func (*ScreenCaptureKit) StartStreaming ¶
func (sck *ScreenCaptureKit) StartStreaming(options StreamingOptions) error
StartStreaming begins real-time audio streaming with the specified options
func (*ScreenCaptureKit) StopRecording ¶
func (sck *ScreenCaptureKit) StopRecording() (string, error)
StopRecording stops the ongoing recording
func (*ScreenCaptureKit) StopStreaming ¶
func (sck *ScreenCaptureKit) StopStreaming() error
StopStreaming stops the ongoing audio streaming
type StreamingOptions ¶
type StreamingOptions struct {
FPS int `json:"fps"`
CropArea *CropArea `json:"cropArea,omitempty"`
ShowCursor bool `json:"showCursor"`
HighlightClicks bool `json:"highlightClicks"`
ScreenID uint32 `json:"screenId"`
AudioDeviceID *string `json:"audioDeviceId,omitempty"`
MicrophoneDeviceID *string `json:"microphoneDeviceId,omitempty"`
VideoCodec string `json:"videoCodec"`
EnableHDR bool `json:"enableHDR,omitempty"`
// Streaming-specific options
StreamingEnabled bool `json:"streamingEnabled"`
StreamingProtocol string `json:"streamingProtocol"` // "http", "websocket", "tcp", "pipe"
StreamingURL *string `json:"streamingURL,omitempty"`
StreamingHost *string `json:"streamingHost,omitempty"`
StreamingPort *int `json:"streamingPort,omitempty"`
StreamingPipePath *string `json:"streamingPipePath,omitempty"`
AudioOnly bool `json:"audioOnly,omitempty"`
StreamSystemAudio bool `json:"streamSystemAudio"`
StreamMicrophone bool `json:"streamMicrophone"`
FFmpegCompatible bool `json:"ffmpegCompatible,omitempty"` // Stream raw audio without metadata headers
}
StreamingOptions contains all options for real-time audio streaming