display

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransportWebRTC  = "webrtc"
	EncoderGStreamer = "gstreamer"
	CodecH264        = webrtc.MimeTypeH264
	CodecVP8         = webrtc.MimeTypeVP8
)

Variables

View Source
var (
	ErrManagerUnavailable = errors.New("manager not configured")
	ErrDisplayDisabled    = errors.New("display disabled")
	ErrDisplayUnavailable = errors.New("display server not reachable")
	ErrEncoderUnavailable = errors.New("gstreamer unavailable")
	ErrCodecUnsupported   = errors.New("no compatible video codec offered")
)

Functions

This section is empty.

Types

type ControlInput

type ControlInput struct {
	Type       string
	X          int
	Y          int
	ButtonMask uint8
	Keysym     uint32
	Down       bool
}

type OfferRequest

type OfferRequest struct {
	Type      string   `json:"type"`
	SDP       string   `json:"sdp"`
	SessionID string   `json:"session_id,omitempty"`
	NATIPs    []string `json:"-"`
}

type OfferResponse

type OfferResponse struct {
	Type      string `json:"type"`
	SDP       string `json:"sdp"`
	SessionID string `json:"session_id"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(logger *slog.Logger, workspace Workspace) *Service

func (*Service) Answer

func (s *Service) Answer(ctx context.Context, botID string, req OfferRequest) (OfferResponse, error)

func (*Service) Close added in v0.20.0

func (s *Service) Close() error

Close releases the shared ICE UDP listener owned by this display service. It is called after the HTTP server stops accepting display requests.

func (*Service) CloseSession

func (s *Service) CloseSession(botID, sessionID string) bool

func (*Service) ControlInput

func (s *Service) ControlInput(ctx context.Context, botID string, event ControlInput) error

func (*Service) ControlInputs

func (s *Service) ControlInputs(ctx context.Context, botID string, events []ControlInput) error

func (*Service) ListSessions

func (s *Service) ListSessions(botID string) []SessionInfo

func (*Service) Screenshot

func (s *Service) Screenshot(ctx context.Context, botID string) ([]byte, string, error)

func (*Service) Start added in v0.20.0

func (s *Service) Start() error

Start reserves the configured shared ICE UDP port before the server begins accepting display requests, so an invalid or unavailable port fails startup.

func (*Service) Status

func (s *Service) Status(ctx context.Context, botID string) Status

type SessionInfo

type SessionInfo struct {
	ID        string    `json:"id"`
	Codec     string    `json:"codec"`
	State     string    `json:"state"`
	CreatedAt time.Time `json:"created_at"`
}

type Status

type Status struct {
	Enabled           bool
	Available         bool
	Running           bool
	Transport         string
	Encoder           string
	EncoderAvailable  bool
	UnavailableReason string
}

type Workspace

type Workspace interface {
	BotDisplayEnabled(ctx context.Context, botID string) bool
	DisplaySocketPath(botID string) string
}

Jump to

Keyboard shortcuts

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