screen

package
v0.1.0-alpha.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package screen turns "something that can hand over its current pixels" into a capture.VideoSource: the whole browser window or one tab for getDisplayMedia. It knows nothing about the browser; the app supplies a Grabber.

Capturing the operating system's screen or other applications' windows is out of scope: it needs OS APIs (X11 XShm/XDamage, Wayland portals, DXGI, ScreenCaptureKit) that this package deliberately does not use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Grabber

type Grabber func(prev int) (img *image.RGBA, gen int, err error)

Grabber returns the current pixels and a generation number. When gen equals the previous call's the pixels are unchanged and may be nil; the source then repeats its last frame. The returned image may be reused by the next call: the source converts it before asking again. An error ends the source (the tab is gone).

type Source

type Source struct {

	// W, H is the native size of the surface.
	W, H int
	// contains filtered or unexported fields
}

Source is the VideoSource.

func New

func New(info capture.DeviceInfo, w, h int, grab Grabber) *Source

New makes a source for a surface of native size w x h.

func (*Source) Err

func (s *Source) Err() error

func (*Source) Info

func (s *Source) Info() capture.DeviceInfo

func (*Source) Mode

func (s *Source) Mode() (int, int, float64)

Mode implements capture.Moder.

func (*Source) Start

func (s *Source) Start(c capture.VideoConstraints) (<-chan *capture.Frame, error)

Start delivers frames of c.Width x c.Height (the surface is scaled down to fit; 0 = native size) at c.FrameRate (default 30, at most 60).

func (*Source) Stop

func (s *Source) Stop() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL