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
methodinitiateSubscription(): void
This function must be called before any events or state can be received.
Example
streamlabsOBS.v1.Vision.initiateSubscription();requestAvailableProcesses method
methodrequestAvailableProcesses(): 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
methodrequestActiveProcess(): 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
methodactivateProcess(pid, selectedGame)
This function allows you to change the active process the Vision module is watching for events.
Arguments
pid: This is the process id of one of the available processes and is requiredselectedGame 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
object{
"vision": {
"fortnite": {
"eliminations": {
"session": 152
}
}
}
}
UserState object
object{
"vision.fortnite.eliminations.session": 152
}
VisionEventsPayload object
object| Property | Type | Description |
|---|---|---|
| vision_event_id | string | A persistent, immutable, and unique identifier for this payload |
| events | VisionEvent[] | |
| game | string | |
| timestamp | number |
VisionEvent object
object| Property | Type | Description |
|---|---|---|
| name | string | |
| data? | VisionEventData[] |
VisionEventData object
object| Property | Type | Description |
|---|---|---|
| value | number |
userStateTree event
eventThis 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
eventThis 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
eventThis 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 => {
});Updated about 1 month ago
