Streaming / Recording Module

Required Permissions: slobs.streaming

This module provides (currently read-only) access to information about the streaming and recording output state.

Minimum Version

This was module was added in Build 2 of the Streamlabs Desktop App Developer build.

OutputState object

The output state object represents the current state of the streaming and recording outputs. There is a current state, as well as a timestamp recording when the state changed.

PropertyTypeDescription
streamingStatusoffline | starting | live | ending | reconnectingThe current state of the streaming output.
streamingStatusTimestringAn ISO-8601 timestamp string representing the time of the last streaming output state change. Note that entering and exiting the reconnecting state does not update this timestamp. This makes this timestamp useful for calculating an overall stream length, but may not match exact stream uptime on Twitch if the stream fully disconnected.
recordingStatusoffline | starting | recording | stoppingThe current state of the recording output.
recordingStatusTimestringAn ISO-8601 timestamp string representing the time of the last recording output state change.

StreamInfo object

The stream info object represents some data about the current stream.

PropertyTypeDescription
titlestringThe title of the current stream. If the stream is offline, this will represent the title of the channel the last time it was fetched.
gamestringThe name of the game set on the channel (if any).
viewerCountnumberThe current number of viewers for the channel. This number will always be 0 if the channel is offline.

outputStateChanged event

This event will be emitted whenever the output state object changes. You callback will be called with an OutputState object.

Example

streamlabsOBS.v1.StreamingRecording.outputStateChanged(state => {
  console.log('Got new output state', state);
});

streamInfoChanged event

This event will be emitted whenever the stream info changes. You callback will be called with an StreamInfo object.

Example

streamlabsOBS.v1.StreamingRecording.streamInfoChange(info => {
  console.log('Got new stream info', info);
});

getOutputState method

getOutputState(): OutputState

This method can be used to fetch the current output state.

Arguments

None

Returns

OutputState

Example

streamlabsOBS.v1.StreamingRecording.getOutputState().then(state => {
  consolelog('Current state:', state);
});

getStreamInfo method

getStreamInfo(): StreamInfo

This method can be used to fetch the current stream info.

Arguments

None

Returns

StreamInfo

Example

streamlabsOBS.v1.StreamingRecording.getStreamInfo().then(info => {
  consolelog('Current info:', info);
});