obs-websocket-community-projects / obs-websocket-js

Consumes https://github.com/obsproject/obs-websocket
MIT License
657 stars 95 forks source link

InputVolumeMeters event not getting hit #297

Closed Mr-Mmhhmm closed 1 year ago

Mr-Mmhhmm commented 1 year ago

I am unable to get the InputVolumeMeters event to trigger. Is there another way to subscribe to the high-volume event? It logs the connection info, but never trigger any other log/error statement. Any help would be appreciated.

const obs = new OBSWebSocket();

obs.connect(undefined, "password").then((res) => {
    console.log(res);
}, (error) => {
    console.error(error);
});

obs.on("InputVolumeMeters", (data) => {
    console.log(data);
});
Mr-Mmhhmm commented 1 year ago

I resolved my issue. I figured out how to explicitly subscribe to the event on connection.

const obs = new OBSWebSocket();

obs.connect(undefined, "password", { eventSubscriptions: OBSWebSocket.EventSubscription.All | OBSWebSocket.EventSubscription.InputVolumeMeters }).then((res) => {
    console.log(res);
}, (error) => {
    console.error(error);
});

obs.on("InputVolumeMeters", (data) => {
    console.log(data);
});