obs

package
v0.4.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package obs provides a basic obs-websocket 5.0 client. It supports all of the API calls needed for resetti to function.

See https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md for more detailed documentation on the websocket protocol.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch added in v0.4.0

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

Batch contains multiple requests which are to be submitted and executed at once.

func (*Batch) SetItemPosition added in v0.4.0

func (b *Batch) SetItemPosition(scene, name string, x, y, w, h float64)

func (*Batch) SetItemVisibility added in v0.4.0

func (b *Batch) SetItemVisibility(scene, name string, visible bool)

func (*Batch) SetSourceSettings added in v0.4.0

func (b *Batch) SetSourceSettings(source string, settings StringMap, keep bool)

type BatchMode added in v0.4.0

type BatchMode int

BatchMode contains the mode the requests of a batch are to be executed in.

const (
	SerialRealtime BatchMode = iota
	SerialFrame
	Parallel
)

Request batch modes.

type Client added in v0.4.0

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

Client manages an OBS websocket connection.

func (*Client) AddSceneItem added in v0.4.0

func (c *Client) AddSceneItem(scene, name string) error

AddSceneItem adds the source with the given name to the given scene.

func (*Client) Batch added in v0.4.0

func (c *Client) Batch(mode BatchMode, fn func(*Batch) error) (err error)

Batch creates and *synchronously* submits a new request batch. The provided closure can be used to add requests to the batch. If the closure returns an error or panics, the batch will not be submitted.

func (*Client) Connect added in v0.4.0

func (c *Client) Connect(ctx context.Context, addr string, pw string) (<-chan error, error)

Connect attempts to connect to an OBS instance at the given address. If authentication is required, the given password will be used.

func (*Client) CreateScene added in v0.4.0

func (c *Client) CreateScene(name string) error

CreateScene creates a new scene with the given name in the current scene collection.

func (*Client) CreateSceneCollection added in v0.4.0

func (c *Client) CreateSceneCollection(name string) error

CreateSceneCollection creates a new scene collection with the given name if one does not already exist.

func (*Client) CreateSource added in v0.4.0

func (c *Client) CreateSource(scene, name string, kind SourceKind, settings StringMap) error

CreateSource creates a new source with the given name and settings on the given scene.

func (*Client) DeleteScene added in v0.4.0

func (c *Client) DeleteScene(name string) error

DeleteScene deletes the given scene.

func (*Client) GetCanvasSize added in v0.4.0

func (c *Client) GetCanvasSize() (width, height int, err error)

GetCanvasSize returns the base resolution (canvas size) of the current OBS profile.

func (*Client) GetSceneCollectionList added in v0.4.0

func (c *Client) GetSceneCollectionList() (collections []string, active string, err error)

GetSceneCollectionList returns a list of the existing scene collections and which one is currently active.

func (*Client) GetSceneItemTransform added in v0.4.0

func (c *Client) GetSceneItemTransform(scene, name string) (x, y, w, h float64, err error)

GetSceneItemTransform returns the size and position of the given scene item.

func (*Client) GetSceneList added in v0.4.0

func (c *Client) GetSceneList() ([]string, error)

GetSceneList returns a list of the existing scenes.

func (*Client) SetScene added in v0.4.0

func (c *Client) SetScene(name string) error

SetScene sets the current scene.

func (*Client) SetSceneCollection added in v0.4.0

func (c *Client) SetSceneCollection(name string) error

SetSceneCollection sets the current scene collection.

func (*Client) SetSceneItemBounds added in v0.4.0

func (c *Client) SetSceneItemBounds(scene, name string, x, y, w, h float64) error

SetSceneItemBounds moves and resizes the given scene item.

func (*Client) SetSceneItemLocked added in v0.4.0

func (c *Client) SetSceneItemLocked(scene, name string, locked bool) error

SetSceneItemLocked locks or unlocks the given scene item.

func (*Client) SetSceneItemVisible added in v0.4.0

func (c *Client) SetSceneItemVisible(scene, name string, visible bool) error

SetSceneItemVisible hides or shows the given scene item.

func (*Client) SetSourceSettings added in v0.4.0

func (c *Client) SetSourceSettings(name string, settings StringMap, overlay bool) error

SetSourceSettings configures the given source's settings.

type SourceKind added in v0.4.0

type SourceKind string

SourceKind contains the input type for a given source.

const (
	KindWindow SourceKind = "xcomposite_input"
	KindImage  SourceKind = "image_source"
)

Source kinds.

type StringMap added in v0.4.0

type StringMap map[string]any

StringMap represents a JSON object.

Jump to

Keyboard shortcuts

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