events

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BroadcastCustomMessage added in v0.3.0

type BroadcastCustomMessage struct {
	EventBasic

	// User-defined data
	Data map[string]interface{} `json:"data"`

	// Identifier provided by the sender
	Realm string `json:"realm"`
}

BroadcastCustomMessage represents the event body for the "BroadcastCustomMessage" event.

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

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.7.0/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"`

	// OBS Stats
	Stats []typedefs.OBSStats `json:"stats"`

	// 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.7.0/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 []typedefs.SceneItem `json:"sources"`
}

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

Generated from https://github.com/Palakis/obs-websocket/blob/4.7.0/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.7.0/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.7.0/docs/generated/protocol.md#ProfileListChanged.

type RecordingPaused added in v0.3.0

type RecordingPaused struct {
	EventBasic
}

RecordingPaused represents the event body for the "RecordingPaused" event.

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

type RecordingResumed added in v0.3.0

type RecordingResumed struct {
	EventBasic
}

RecordingResumed represents the event body for the "RecordingResumed" event.

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

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.7.0/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.7.0/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.7.0/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.7.0/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.7.0/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.7.0/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.7.0/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.7.0/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.7.0/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.7.0/docs/generated/protocol.md#SceneCollectionListChanged.

type SceneItemAdded

type SceneItemAdded struct {
	EventBasic

	// Scene item ID
	ItemId int `json:"item-id"`

	// 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.7.0/docs/generated/protocol.md#SceneItemAdded.

type SceneItemDeselected added in v0.2.0

type SceneItemDeselected struct {
	EventBasic

	// Name of the item in the scene.
	ItemId int `json:"item-id"`

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

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

SceneItemDeselected represents the event body for the "SceneItemDeselected" event.

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

type SceneItemRemoved

type SceneItemRemoved struct {
	EventBasic

	// Scene item ID
	ItemId int `json:"item-id"`

	// 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.7.0/docs/generated/protocol.md#SceneItemRemoved.

type SceneItemSelected added in v0.2.0

type SceneItemSelected struct {
	EventBasic

	// Name of the item in the scene.
	ItemId int `json:"item-id"`

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

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

SceneItemSelected represents the event body for the "SceneItemSelected" event.

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

type SceneItemTransformChanged added in v0.2.0

type SceneItemTransformChanged struct {
	EventBasic

	// Scene item ID
	ItemId int `json:"item-id"`

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

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

	// Scene item transform properties
	Transform []typedefs.SceneItemTransform `json:"transform"`
}

SceneItemTransformChanged represents the event body for the "SceneItemTransformChanged" event.

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

type SceneItemVisibilityChanged

type SceneItemVisibilityChanged struct {
	EventBasic

	// Scene item ID
	ItemId int `json:"item-id"`

	// 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.7.0/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.7.0/docs/generated/protocol.md#ScenesChanged.

type SourceAudioMixersChanged added in v0.2.0

type SourceAudioMixersChanged struct {
	EventBasic

	// Raw mixer flags (little-endian, one bit per mixer) as an hexadecimal value
	HexMixersValue string `json:"hexMixersValue"`

	Mixers []struct {
		// Routing status
		Enabled bool `json:"enabled"`

		// Mixer number
		Id int `json:"id"`
	} `json:"mixers"`

	// Source name
	SourceName string `json:"sourceName"`
}

SourceAudioMixersChanged represents the event body for the "SourceAudioMixersChanged" event.

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

type SourceAudioSyncOffsetChanged added in v0.2.0

type SourceAudioSyncOffsetChanged struct {
	EventBasic

	// Source name
	SourceName string `json:"sourceName"`

	// Audio sync offset of the source (in nanoseconds)
	SyncOffset int `json:"syncOffset"`
}

SourceAudioSyncOffsetChanged represents the event body for the "SourceAudioSyncOffsetChanged" event.

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

type SourceCreated added in v0.2.0

type SourceCreated struct {
	EventBasic

	// Source kind.
	SourceKind string `json:"sourceKind"`

	// Source name
	SourceName string `json:"sourceName"`

	// Source settings
	SourceSettings map[string]interface{} `json:"sourceSettings"`

	// Source type. Can be "input", "scene", "transition" or "filter".
	SourceType string `json:"sourceType"`
}

SourceCreated represents the event body for the "SourceCreated" event.

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

type SourceDestroyed added in v0.2.0

type SourceDestroyed struct {
	EventBasic

	// Source kind.
	SourceKind string `json:"sourceKind"`

	// Source name
	SourceName string `json:"sourceName"`

	// Source type. Can be "input", "scene", "transition" or "filter".
	SourceType string `json:"sourceType"`
}

SourceDestroyed represents the event body for the "SourceDestroyed" event.

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

type SourceFilterAdded added in v0.2.0

type SourceFilterAdded struct {
	EventBasic

	// Filter name
	FilterName string `json:"filterName"`

	// Filter settings
	FilterSettings map[string]interface{} `json:"filterSettings"`

	// Filter type
	FilterType string `json:"filterType"`

	// Source name
	SourceName string `json:"sourceName"`
}

SourceFilterAdded represents the event body for the "SourceFilterAdded" event.

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

type SourceFilterRemoved added in v0.2.0

type SourceFilterRemoved struct {
	EventBasic

	// Filter name
	FilterName string `json:"filterName"`

	// Filter type
	FilterType string `json:"filterType"`

	// Source name
	SourceName string `json:"sourceName"`
}

SourceFilterRemoved represents the event body for the "SourceFilterRemoved" event.

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

type SourceFilterVisibilityChanged added in v0.3.0

type SourceFilterVisibilityChanged struct {
	EventBasic

	// New filter state
	FilterEnabled bool `json:"filterEnabled"`

	// Filter name
	FilterName string `json:"filterName"`

	// Source name
	SourceName string `json:"sourceName"`
}

SourceFilterVisibilityChanged represents the event body for the "SourceFilterVisibilityChanged" event.

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

type SourceFiltersReordered added in v0.2.0

type SourceFiltersReordered struct {
	EventBasic

	Filters []struct {
		// Filter name
		Name string `json:"name"`

		// Filter type
		Type string `json:"type"`
	} `json:"filters"`

	// Source name
	SourceName string `json:"sourceName"`
}

SourceFiltersReordered represents the event body for the "SourceFiltersReordered" event.

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

type SourceMuteStateChanged added in v0.2.0

type SourceMuteStateChanged struct {
	EventBasic

	// Mute status of the source
	Muted bool `json:"muted"`

	// Source name
	SourceName string `json:"sourceName"`
}

SourceMuteStateChanged represents the event body for the "SourceMuteStateChanged" event.

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

type SourceOrderChanged

type SourceOrderChanged struct {
	EventBasic

	SceneItems []struct {
		// Scene item unique ID
		ItemId int `json:"item-id"`

		// Item source name
		SourceName string `json:"source-name"`
	} `json:"scene-items"`

	// 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.7.0/docs/generated/protocol.md#SourceOrderChanged.

type SourceRenamed added in v0.2.0

type SourceRenamed struct {
	EventBasic

	// New source name
	NewName string `json:"newName"`

	// Previous source name
	PreviousName string `json:"previousName"`
}

SourceRenamed represents the event body for the "SourceRenamed" event.

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

type SourceVolumeChanged added in v0.2.0

type SourceVolumeChanged struct {
	EventBasic

	// Source name
	SourceName string `json:"sourceName"`

	// Source volume
	Volume float64 `json:"volume"`
}

SourceVolumeChanged represents the event body for the "SourceVolumeChanged" event.

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

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.7.0/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.7.0/docs/generated/protocol.md#StreamStarting.

type StreamStatus

type StreamStatus struct {
	EventBasic

	// Average frame time (in milliseconds)
	AverageFrameTime float64 `json:"average-frame-time"`

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

	// Current CPU usage (percentage)
	CpuUsage float64 `json:"cpu-usage"`

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

	// Free recording disk space (in megabytes)
	FreeDiskSpace float64 `json:"free-disk-space"`

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

	// Current RAM usage (in megabytes)
	MemoryUsage float64 `json:"memory-usage"`

	// 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"`

	// Number of frames skipped due to encoding lag
	OutputSkippedFrames int `json:"output-skipped-frames"`

	// Number of frames outputted
	OutputTotalFrames int `json:"output-total-frames"`

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

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

	// Number of frames missed due to rendering lag
	RenderMissedFrames int `json:"render-missed-frames"`

	// Number of frames rendered
	RenderTotalFrames int `json:"render-total-frames"`

	// Replay Buffer status
	ReplayBufferActive bool `json:"replay-buffer-active"`

	// 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.7.0/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.7.0/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.7.0/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.7.0/docs/generated/protocol.md#StudioModeSwitched.

type SwitchScenes

type SwitchScenes struct {
	EventBasic

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

	// List of scene items in the new scene. Same specification as
	// [`GetCurrentScene`](#getcurrentscene).
	Sources []typedefs.SceneItem `json:"sources"`
}

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

Generated from https://github.com/Palakis/obs-websocket/blob/4.7.0/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.7.0/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.7.0/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.7.0/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.7.0/docs/generated/protocol.md#TransitionListChanged.

Source Files

Jump to

Keyboard shortcuts

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