obs-websocket-js
OBSWebSocket.JS allows Javascript-based connections to obs-websocket.
Based heavily on obs-remote, which is built for the older, obs-classic compatible plugin.
Usage
Plain Javascript
Include the distributable file in the header of your HTML.
<script type='text/javascript' src='dist/obs-websocket.js'></script>
Then make use of it.
<script>
var ws = new OBSWebSocket();
ws.onConnectionOpened = function() {
console.log('Connection Opened');
ws.getCurrentScene(function(err, data) {
console.log(err, data);
});
};
ws.connect();
</script>
NodeJS
npm install obs-websocket-js --save
Add the library to your application.
var OBSWebSocket = require('obs-websocket-js');
var obsWS = new OBSWebSocket();
obsWS.connect('url', 'password');
Contributing
- Install node.js.
- Clone the repo.
- Go nuts.
- Generate the concatenated Javascript file and API documentation by running the following...
npm install
npm install --only=dev
npm run build
- Run grunt watch using the following. This will only update the distribution js file, not the markdown.
npm run grunt watch
Formatting Guidelines
- 2 spaces rather than tabs.