events

package
v0.5.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: 11

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. Since v4.7.0.

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. Since v0.3.

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. Since vv0.3.

type MediaEnded added in v0.5.0

type MediaEnded struct {
	EventBasic

	// The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
	SourceKind string `json:"sourceKind"`

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

MediaEnded represents the event body for the "MediaEnded" event. Since v4.9.0.

type MediaNext added in v0.5.0

type MediaNext struct {
	EventBasic

	// The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
	SourceKind string `json:"sourceKind"`

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

MediaNext represents the event body for the "MediaNext" event. Since v4.9.0.

type MediaPaused added in v0.5.0

type MediaPaused struct {
	EventBasic

	// The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
	SourceKind string `json:"sourceKind"`

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

MediaPaused represents the event body for the "MediaPaused" event. Since v4.9.0.

type MediaPlaying added in v0.5.0

type MediaPlaying struct {
	EventBasic

	// The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
	SourceKind string `json:"sourceKind"`

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

MediaPlaying represents the event body for the "MediaPlaying" event. Since v4.9.0.

type MediaPrevious added in v0.5.0

type MediaPrevious struct {
	EventBasic

	// The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
	SourceKind string `json:"sourceKind"`

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

MediaPrevious represents the event body for the "MediaPrevious" event. Since v4.9.0.

type MediaRestarted added in v0.5.0

type MediaRestarted struct {
	EventBasic

	// The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
	SourceKind string `json:"sourceKind"`

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

MediaRestarted represents the event body for the "MediaRestarted" event. Since v4.9.0.

type MediaStarted added in v0.5.0

type MediaStarted struct {
	EventBasic

	// The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
	SourceKind string `json:"sourceKind"`

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

MediaStarted represents the event body for the "MediaStarted" event. Since v4.9.0.

type MediaStopped added in v0.5.0

type MediaStopped struct {
	EventBasic

	// The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
	SourceKind string `json:"sourceKind"`

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

MediaStopped represents the event body for the "MediaStopped" event. Since v4.9.0.

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. Since v4.1.0.

type ProfileChanged

type ProfileChanged struct {
	EventBasic

	// Name of the new current profile.
	Profile string `json:"profile"`
}

ProfileChanged represents the event body for the "ProfileChanged" event. Since v4.0.0.

type ProfileListChanged

type ProfileListChanged struct {
	EventBasic

	Profiles []struct {
		// Profile name.
		Name string `json:"name"`
	} `json:"profiles"`
}

ProfileListChanged represents the event body for the "ProfileListChanged" event. Since v4.0.0.

type RecordingPaused added in v0.3.0

type RecordingPaused struct {
	EventBasic
}

RecordingPaused represents the event body for the "RecordingPaused" event. Since v4.7.0.

type RecordingResumed added in v0.3.0

type RecordingResumed struct {
	EventBasic
}

RecordingResumed represents the event body for the "RecordingResumed" event. Since v4.7.0.

type RecordingStarted

type RecordingStarted struct {
	EventBasic

	// Absolute path to the file of the current recording.
	RecordingFilename string `json:"recordingFilename"`
}

RecordingStarted represents the event body for the "RecordingStarted" event. Since v0.3.

type RecordingStarting

type RecordingStarting struct {
	EventBasic
}

RecordingStarting represents the event body for the "RecordingStarting" event. Since v0.3.

type RecordingStopped

type RecordingStopped struct {
	EventBasic

	// Absolute path to the file of the current recording.
	RecordingFilename string `json:"recordingFilename"`
}

RecordingStopped represents the event body for the "RecordingStopped" event. Since v0.3.

type RecordingStopping

type RecordingStopping struct {
	EventBasic

	// Absolute path to the file of the current recording.
	RecordingFilename string `json:"recordingFilename"`
}

RecordingStopping represents the event body for the "RecordingStopping" event. Since v0.3.

type ReplayStarted

type ReplayStarted struct {
	EventBasic
}

ReplayStarted represents the event body for the "ReplayStarted" event. Since v4.2.0.

type ReplayStarting

type ReplayStarting struct {
	EventBasic
}

ReplayStarting represents the event body for the "ReplayStarting" event. Since v4.2.0.

type ReplayStopped

type ReplayStopped struct {
	EventBasic
}

ReplayStopped represents the event body for the "ReplayStopped" event. Since v4.2.0.

type ReplayStopping

type ReplayStopping struct {
	EventBasic
}

ReplayStopping represents the event body for the "ReplayStopping" event. Since v4.2.0.

type SceneCollectionChanged

type SceneCollectionChanged struct {
	EventBasic

	// Name of the new current scene collection.
	SceneCollection string `json:"sceneCollection"`
}

SceneCollectionChanged represents the event body for the "SceneCollectionChanged" event. Since v4.0.0.

type SceneCollectionListChanged

type SceneCollectionListChanged struct {
	EventBasic

	SceneCollections []struct {
		// Scene collection name.
		Name string `json:"name"`
	} `json:"sceneCollections"`
}

SceneCollectionListChanged represents the event body for the "SceneCollectionListChanged" event. Since v4.0.0.

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. Since v4.0.0.

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. Since v4.6.0.

type SceneItemLockChanged added in v0.4.0

type SceneItemLockChanged struct {
	EventBasic

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

	// New locked state of the item.
	ItemLocked bool `json:"item-locked"`

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

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

SceneItemLockChanged represents the event body for the "SceneItemLockChanged" event. Since v4.8.0.

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. Since v4.0.0.

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. Since v4.6.0.

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. Since v4.6.0.

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. Since v4.0.0.

type ScenesChanged

type ScenesChanged struct {
	EventBasic

	// Scenes list.
	Scenes []map[string]interface{} `json:"scenes"`
}

ScenesChanged represents the event body for the "ScenesChanged" event. Since v0.3.

type SourceAudioActivated added in v0.5.0

type SourceAudioActivated struct {
	EventBasic

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

SourceAudioActivated represents the event body for the "SourceAudioActivated" event. Since v4.9.0.

type SourceAudioDeactivated added in v0.5.0

type SourceAudioDeactivated struct {
	EventBasic

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

SourceAudioDeactivated represents the event body for the "SourceAudioDeactivated" event. Since v4.9.0.

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. Since v4.6.0.

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. Since v4.6.0.

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. Since v4.6.0.

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. Since v4.6.0.

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. Since v4.6.0.

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. Since v4.6.0.

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. Since v4.7.0.

type SourceFiltersReordered added in v0.2.0

type SourceFiltersReordered struct {
	EventBasic

	Filters []struct {
		// Filter visibility status
		Enabled bool `json:"enabled"`

		// 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. Since v4.6.0.

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. Since v4.6.0.

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. Since v4.0.0.

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

	// Type of source (input, scene, filter, transition)
	SourceType string `json:"sourceType"`
}

SourceRenamed represents the event body for the "SourceRenamed" event. Since v4.6.0.

type SourceVolumeChanged added in v0.2.0

type SourceVolumeChanged struct {
	EventBasic

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

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

	// Source volume in Decibel
	VolumeDb float64 `json:"volumeDb"`
}

SourceVolumeChanged represents the event body for the "SourceVolumeChanged" event. Since v4.6.0.

type StreamStarted

type StreamStarted struct {
	EventBasic
}

StreamStarted represents the event body for the "StreamStarted" event. Since v0.3.

type StreamStarting

type StreamStarting struct {
	EventBasic

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

StreamStarting represents the event body for the "StreamStarting" event. Since v0.3.

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. Since v0.3.

type StreamStopped

type StreamStopped struct {
	EventBasic
}

StreamStopped represents the event body for the "StreamStopped" event. Since v0.3.

type StreamStopping

type StreamStopping struct {
	EventBasic

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

StreamStopping represents the event body for the "StreamStopping" event. Since v0.3.

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. Since v4.1.0.

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. Since v0.3.

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. Since v4.0.0.

type TransitionBegin

type TransitionBegin struct {
	EventBasic

	// Transition duration (in milliseconds). Will be -1 for any transition with a fixed duration, such as a Stinger,
	// due to limitations of the OBS API.
	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"`

	// Transition type.
	Type string `json:"type"`
}

TransitionBegin represents the event body for the "TransitionBegin" event. Since v4.0.0.

type TransitionDurationChanged

type TransitionDurationChanged struct {
	EventBasic

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

TransitionDurationChanged represents the event body for the "TransitionDurationChanged" event. Since v4.0.0.

type TransitionEnd added in v0.4.0

type TransitionEnd struct {
	EventBasic

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

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

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

	// Transition type.
	Type string `json:"type"`
}

TransitionEnd represents the event body for the "TransitionEnd" event. Since v4.8.0.

type TransitionListChanged

type TransitionListChanged struct {
	EventBasic

	Transitions []struct {
		// Transition name.
		Name string `json:"name"`
	} `json:"transitions"`
}

TransitionListChanged represents the event body for the "TransitionListChanged" event. Since v4.0.0.

type TransitionVideoEnd added in v0.4.0

type TransitionVideoEnd 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"`

	// Transition type.
	Type string `json:"type"`
}

TransitionVideoEnd represents the event body for the "TransitionVideoEnd" event. Since v4.8.0.

type VirtualCamStarted added in v0.5.0

type VirtualCamStarted struct {
	EventBasic
}

VirtualCamStarted represents the event body for the "VirtualCamStarted" event. Since v4.9.1.

type VirtualCamStopped added in v0.5.0

type VirtualCamStopped struct {
	EventBasic
}

VirtualCamStopped represents the event body for the "VirtualCamStopped" event. Since v4.9.1.

Source Files

Jump to

Keyboard shortcuts

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