Vision Module

The vision module allows you to receive and interact with in-game events, such as health changes, eliminations, victories, and more.

Required Permissions: sld.vision

startVision

This function will launch the background vision process. ### Example

javascript streamlabsObs.v1.Vision.startVision()

initiateSubscription method

initiateSubscription(): void

This function must be called before any events or state can be received.

Example

streamlabsOBS.v1.Vision.initiateSubscription();

requestAvailableProcesses method

requestAvailableProcesses(): Promise<VisionProcess[]>

This function requests the list of currently available processes and returns it as a Promise.

Returns

Promise<VisionProcess[]>

Example

streamlabsObs.v1.Vision.requestAvailableProcesses();

requestActiveProcess method

requestActiveProcess(): Promise<VisionProcess>

This function requests the currently active process and returns it as a Promise.

Returns

Promise<VisionProcess>

Example

streamlabsObs.v1.Vision.requestActiveProcess();

activateProcess method

activateProcess(pid, selectedGame)

This function allows you to change the active process the Vision module is watching for events.

Arguments

  1. pid: This is the process id of one of the available processes and is required
  2. selectedGame is an optional parameter that must only be passed when using a process of type capture_device

Example

streamlabsObs.v1.Vision.activateProcess(pid,selectedGame);

UserStateTree object

{
  "vision": {
    "fortnite": {
      "eliminations": {
        "session": 152
      }
    }
  }
}

UserState object

{
  "vision.fortnite.eliminations.session": 152
}

VisionEventsPayload object

PropertyTypeDescription
vision_event_idstringA persistent, immutable, and unique identifier for this payload
eventsVisionEvent[]
gamestring
timestampnumber

VisionEvent object

PropertyTypeDescription
namestring
data?VisionEventData[]

VisionEventData object

PropertyTypeDescription
valuenumber

userStateTree event

This event is emitted whenever the user's state changes. Your callback will be called with a UserStateTree object.

Example

streamlabsOBS.v1.Vision.userStateTree(userStateTree => {

});

userState event

This event is emitted whenever the user's state changes. Your callback will be called with a UserState object.

Example

=streamlabsOBS.v1.Vision.userState(userState => {

});

visionEvent event

This event is emitted whenever there is a new Vision event. Your callback will be called with a VisionEventsPayload object.

Example

streamlabsOBS.v1.Vision.visionEvent(visionEventsPayload => {

});