Documentation
¶
Overview ¶
Package screencap captures the screen, for sharing it in a call or recording it: a stream of frames from a display.
srcs, _ := screencap.Sources(ctx)
c, err := screencap.Start(ctx, app, screencap.Options{Source: srcs[0].ID, FPS: 15},
func(f screencap.Frame) { encoder.Encode(f.Image) })
...
c.Stop()
Where it runs: Windows (GDI), macOS (ScreenCaptureKit, macOS 12.3 and later; the user allows screen recording in System Settings), Linux on X11 (on Wayland, through Xwayland, only X11 windows show), Android (MediaProjection: the user confirms each time) and iOS (ReplayKit: the app's own screen). Elsewhere Start returns giode.ErrNotSupported.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrPermissionDenied = errors.New("screencap: permission denied")
ErrPermissionDenied is returned when the user didn't allow screen capture.
Functions ¶
This section is empty.
Types ¶
type Capture ¶
type Capture struct {
// contains filtered or unexported fields
}
Capture is a running capture.
type Frame ¶
type Frame struct {
// Image is the frame. It's onFrame's to keep.
Image *image.RGBA
Time time.Time
}
Frame is a captured frame.
type Options ¶
type Options struct {
// Source is the ID of the display to capture; the primary one when
// empty.
Source string
// FPS is how many frames a second to capture: 10 by default.
FPS int
// MaxSize caps the frames' long side, scaling them down: 1920 by
// default; -1 for full size.
MaxSize int
}
Options configure Start.