Skip to content

Latest commit

 

History

History
64 lines (43 loc) · 3.35 KB

README.md

File metadata and controls

64 lines (43 loc) · 3.35 KB

TD-OBSWebSocket

A packaged TouchDesigner component that connects to an obs-websocket server and receives all available events.

Basic Usage

  1. Download the .tox file from the Releases page and place it in a location convenient for your project.
  2. Drag and drop it into your project.
  3. Set the Address and Port of the server in the Connection parameters tab. Set the Password if there is one.
  4. If Auto-Reconnect is enabled, the component will connect to the server automatically.
    If Auto-Reconnect is disabled, enable the Active switch to connect to the server.

Once connected, any event data received will be set in the corresponding parameter. This makes the data easy to consume by, for example, connecting a Parameter Execute DAT to the OBSWebSocket component.

Features

High-Volume Events

Several events are considered "high-volume" and must be individually opted into to receive them. You can do this in the Connection parameters tab. These events are:

  • Input Volume Meters
  • Input Active State Changed
  • Input Show State Changed
  • Scene Item Transform Changed

It's possible to enable or disable high-volume events while connected to the server, though doing so will force a reconnect.

Sending Requests

Two methods on the OBSWebSocket component can be used to send requests to OBS.

SendRequest(requestType, requestId, requestData)
Sends a single request

Parameter Data type Default value Description Optional
requestType RequestType The type of the request
requestId string <uuid4> A custom ID used to track the request
requestData dict None Any input the request requires

SendRequestBatch(data, executionType, haltOnFailure)
Sends one or more requests together

Parameter Data type Default value Description Optional
data list[dict[str, Any]] A list of payloads taking the form of SendRequest's parameters
executionType RequestBatchExecutionType SERIAL_REALTIME The request execution type
haltOnFailure bool False Stops the batch if one request fails

The RequestType and RequestBatchExecutionType enums are promoted by the extension and can be easily accessed on the component with op.OBSWebSocket.[EnumName]. See the source for all enums and values.

Each request type's input for requestData can be found in the obs-websocket documentation.

For batch requests, it's recommended to provide a custom requestId with each request. This will help you identify responses in the results table (found at OBSWebSocket/out1) where each one is logged until the next request is sent.

Contributing

If you are considering adding a new feature or change to the project, first create a feature request issue to document it and get feedback before proceeding. If you are considering fixing a bug, first open a bug report issue or search for an existing one.