events

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: Apache-2.0 Imports: 2 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	EventBasic
	Err error
}

Error is used to wrap any errors we might encounter in our eventing loop.

func WrapError

func WrapError(err error) *Error

WrapError takes an error and wraps it in our custom Error event.

type Event

type Event interface {
	GetUpdateType() string
	GetStreamTimecode() string
	GetRecordingTimecode() string
}

Event describes the behavior of any event. Used to abstract the functionality of any event that embeds EventBasic within their fields.

func GetEventForType

func GetEventForType(name string) Event

func Parse

func Parse(raw json.RawMessage) (Event, error)

Parse takes a raw JSON message, figures out its type, and returns an event.

type EventBasic

type EventBasic struct {
	// The name of the event.
	UpdateType string `json:"update-type"`

	// Time elapsed between now and stream start (only present if OBS Studio
	// is streaming). Timecodes in format `HH:MM:SS.mmm`.
	StreamTimecode string `json:"stream-timecode,omitempty"`

	// Time elapsed between now and recording start (only present if OBS
	// Studio is recording). Timecodes in format `HH:MM:SS.mmm`.
	RecordingTimecode string `json:"rec-timecode,omitempty"`
}

EventBasic represents the common fields of any event.

func (*EventBasic) GetRecordingTimecode

func (e *EventBasic) GetRecordingTimecode() string

GetRecordingTimecode does what says.

func (*EventBasic) GetStreamTimecode

func (e *EventBasic) GetStreamTimecode() string

GetStreamTimecode does what it says.

func (*EventBasic) GetUpdateType

func (e *EventBasic) GetUpdateType() string

GetUpdateType does what it says.

type Exiting

type Exiting struct {
	EventBasic
}

Exiting represents the event body for the "Exiting" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#Exiting.

type Heartbeat

type Heartbeat struct {
	EventBasic

	// Current active profile.
	CurrentProfile string `json:"current-profile"`

	// Current active scene.
	CurrentScene string `json:"current-scene"`

	// Toggles between every JSON message as an "I am alive" indicator.
	Pulse bool `json:"pulse"`

	// Current recording state.
	Recording bool `json:"recording"`

	// Current streaming state.
	Streaming bool `json:"streaming"`

	// Total bytes recorded since the recording started.
	TotalRecordBytes int `json:"total-record-bytes"`

	// Total frames recorded since the recording started.
	TotalRecordFrames int `json:"total-record-frames"`

	// Total time (in seconds) since recording started.
	TotalRecordTime int `json:"total-record-time"`

	// Total bytes sent since the stream started.
	TotalStreamBytes int `json:"total-stream-bytes"`

	// Total frames streamed since the stream started.
	TotalStreamFrames int `json:"total-stream-frames"`

	// Total time (in seconds) since the stream started.
	TotalStreamTime int `json:"total-stream-time"`
}

Heartbeat represents the event body for the "Heartbeat" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#Heartbeat.

type PreviewSceneChanged

type PreviewSceneChanged struct {
	EventBasic

	// Name of the scene being previewed.
	SceneName string `json:"scene-name"`

	// List of sources composing the scene. Same specification as
	// [`GetCurrentScene`](#getcurrentscene).
	Sources []map[string]interface{} `json:"sources"`
}

PreviewSceneChanged represents the event body for the "PreviewSceneChanged" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#PreviewSceneChanged.

type ProfileChanged

type ProfileChanged struct {
	EventBasic
}

ProfileChanged represents the event body for the "ProfileChanged" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#ProfileChanged.

type ProfileListChanged

type ProfileListChanged struct {
	EventBasic
}

ProfileListChanged represents the event body for the "ProfileListChanged" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#ProfileListChanged.

type RecordingStarted

type RecordingStarted struct {
	EventBasic
}

RecordingStarted represents the event body for the "RecordingStarted" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#RecordingStarted.

type RecordingStarting

type RecordingStarting struct {
	EventBasic
}

RecordingStarting represents the event body for the "RecordingStarting" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#RecordingStarting.

type RecordingStopped

type RecordingStopped struct {
	EventBasic
}

RecordingStopped represents the event body for the "RecordingStopped" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#RecordingStopped.

type RecordingStopping

type RecordingStopping struct {
	EventBasic
}

RecordingStopping represents the event body for the "RecordingStopping" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#RecordingStopping.

type ReplayStarted

type ReplayStarted struct {
	EventBasic
}

ReplayStarted represents the event body for the "ReplayStarted" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#ReplayStarted.

type ReplayStarting

type ReplayStarting struct {
	EventBasic
}

ReplayStarting represents the event body for the "ReplayStarting" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#ReplayStarting.

type ReplayStopped

type ReplayStopped struct {
	EventBasic
}

ReplayStopped represents the event body for the "ReplayStopped" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#ReplayStopped.

type ReplayStopping

type ReplayStopping struct {
	EventBasic
}

ReplayStopping represents the event body for the "ReplayStopping" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#ReplayStopping.

type SceneCollectionChanged

type SceneCollectionChanged struct {
	EventBasic
}

SceneCollectionChanged represents the event body for the "SceneCollectionChanged" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#SceneCollectionChanged.

type SceneCollectionListChanged

type SceneCollectionListChanged struct {
	EventBasic
}

SceneCollectionListChanged represents the event body for the "SceneCollectionListChanged" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#SceneCollectionListChanged.

type SceneItemAdded

type SceneItemAdded struct {
	EventBasic

	// Name of the item added to the scene.
	ItemName string `json:"item-name"`

	// Name of the scene.
	SceneName string `json:"scene-name"`
}

SceneItemAdded represents the event body for the "SceneItemAdded" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#SceneItemAdded.

type SceneItemRemoved

type SceneItemRemoved struct {
	EventBasic

	// Name of the item removed from the scene.
	ItemName string `json:"item-name"`

	// Name of the scene.
	SceneName string `json:"scene-name"`
}

SceneItemRemoved represents the event body for the "SceneItemRemoved" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#SceneItemRemoved.

type SceneItemVisibilityChanged

type SceneItemVisibilityChanged struct {
	EventBasic

	// Name of the item in the scene.
	ItemName string `json:"item-name"`

	// New visibility state of the item.
	ItemVisible bool `json:"item-visible"`

	// Name of the scene.
	SceneName string `json:"scene-name"`
}

SceneItemVisibilityChanged represents the event body for the "SceneItemVisibilityChanged" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#SceneItemVisibilityChanged.

type ScenesChanged

type ScenesChanged struct {
	EventBasic
}

ScenesChanged represents the event body for the "ScenesChanged" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#ScenesChanged.

type SourceOrderChanged

type SourceOrderChanged struct {
	EventBasic

	// Name of the scene where items have been reordered.
	SceneName string `json:"scene-name"`
}

SourceOrderChanged represents the event body for the "SourceOrderChanged" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#SourceOrderChanged.

type StreamStarted

type StreamStarted struct {
	EventBasic
}

StreamStarted represents the event body for the "StreamStarted" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#StreamStarted.

type StreamStarting

type StreamStarting struct {
	EventBasic

	// Always false (retrocompatibility).
	PreviewOnly bool `json:"preview-only"`
}

StreamStarting represents the event body for the "StreamStarting" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#StreamStarting.

type StreamStatus

type StreamStatus struct {
	EventBasic

	// Amount of data per second (in bytes) transmitted by the stream encoder.
	BytesPerSec int `json:"bytes-per-sec"`

	// Current framerate.
	Fps float64 `json:"fps"`

	// Amount of data per second (in kilobits) transmitted by the stream encoder.
	KbitsPerSec int `json:"kbits-per-sec"`

	// Number of frames dropped by the encoder since the stream started.
	NumDroppedFrames int `json:"num-dropped-frames"`

	// Total number of frames transmitted since the stream started.
	NumTotalFrames int `json:"num-total-frames"`

	// Always false (retrocompatibility).
	PreviewOnly bool `json:"preview-only"`

	// Current recording state.
	Recording bool `json:"recording"`

	// Percentage of dropped frames.
	Strain float64 `json:"strain"`

	// Current streaming state.
	Streaming bool `json:"streaming"`

	// Total time (in seconds) since the stream started.
	TotalStreamTime int `json:"total-stream-time"`
}

StreamStatus represents the event body for the "StreamStatus" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#StreamStatus.

type StreamStopped

type StreamStopped struct {
	EventBasic
}

StreamStopped represents the event body for the "StreamStopped" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#StreamStopped.

type StreamStopping

type StreamStopping struct {
	EventBasic

	// Always false (retrocompatibility).
	PreviewOnly bool `json:"preview-only"`
}

StreamStopping represents the event body for the "StreamStopping" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#StreamStopping.

type StudioModeSwitched

type StudioModeSwitched struct {
	EventBasic

	// The new enabled state of Studio Mode.
	NewState bool `json:"new-state"`
}

StudioModeSwitched represents the event body for the "StudioModeSwitched" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#StudioModeSwitched.

type SwitchScenes

type SwitchScenes struct {
	EventBasic

	// The new scene.
	SceneName string `json:"scene-name"`

	// List of sources in the new scene. Same specification as
	// [`GetCurrentScene`](#getcurrentscene).
	Sources []map[string]interface{} `json:"sources"`
}

SwitchScenes represents the event body for the "SwitchScenes" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#SwitchScenes.

type SwitchTransition

type SwitchTransition struct {
	EventBasic

	// The name of the new active transition.
	TransitionName string `json:"transition-name"`
}

SwitchTransition represents the event body for the "SwitchTransition" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#SwitchTransition.

type TransitionBegin

type TransitionBegin struct {
	EventBasic

	// Transition duration (in milliseconds).
	Duration int `json:"duration"`

	// Source scene of the transition
	FromScene string `json:"from-scene"`

	// Transition name.
	Name string `json:"name"`

	// Destination scene of the transition
	ToScene string `json:"to-scene"`
}

TransitionBegin represents the event body for the "TransitionBegin" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#TransitionBegin.

type TransitionDurationChanged

type TransitionDurationChanged struct {
	EventBasic

	// New transition duration.
	NewDuration int `json:"new-duration"`
}

TransitionDurationChanged represents the event body for the "TransitionDurationChanged" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#TransitionDurationChanged.

type TransitionListChanged

type TransitionListChanged struct {
	EventBasic
}

TransitionListChanged represents the event body for the "TransitionListChanged" event.

Generated from https://github.com/Palakis/obs-websocket/blob/4.5.1/docs/generated/protocol.md#TransitionListChanged.

Jump to

Keyboard shortcuts

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