node-obs is deprecated in favor of obs-studio-node. The streamlabs-obs client still uses node-obs but work is being done to remove the reliance on it.
'node-obs' is a Node.JS module integrating Open Broadcaster Software Studio. The project uses cmake-js for easy integration with CMake based projects and partially supports node-gyp.
- Node.JS with NPM
- CMake
- Open Broadcaster Studio (Build for 32-bit in /build32 and 64-bit in /build64)
- Install Node.JS and add it to PATH
- Install CMake and add it to PATH
- Install Visual Studio 2015
cmake-js is pretty much a drop-in replacement for node-gyp and works about as you would expect a CMake based solution to work. We can choose where to build, have some control over what project generator is being used and can also easily choose what runtime we are building against.
This is pretty simple, we just attach --out PATHHERE
to all commands, changing where it will generate the necessary files for building. This is directory will contain all project files and binaries, so make sure it doesn't exist already.
For multi-runtime builds, the following is recommended:
- /build/nodejs
- /build/electron
- /build/... (any other runtimes...)
Mac users might prefer building with Xcode instead of makefiles like it is common on Linux systems. To do that you appen --prefer-xcode
to the cmake-js commands.
When building for Node.JS the commands are simple. But what about electron? cmake-js has an easy way to change the runtime used: --runtime
. To build for electron we just need to specify the electron runtime and the version: --runtime electron --runtime-version 1.6.3
(replace 1.6.3 with the version you build your actual project against).
Make sure that you ran cmake-js clean
first, otherwise it will use the cached project builder configuration.
Building is pretty simple and does not differ too much from other build systems. It's recommended to have separate directories for each runtime build.
Open a shell in the root directory and run the following:
npm install
npm install sleep
This is the most important step, as it sets up the basics. Run the following command while replacing {myPathToObsStudio} with the actual path to obs-studio:
npm config set cmake_OBSSTUDIOPATH {myPathToObsStudio}
npm run configure
Building is simple:
npm run build
This will create the necessary project files which can then be built in the OS's build system (Visual Studio, Xcode, make, ...).
Open up the generated project (if it's an IDE one) and build it or just build it using make. Once it's done you should have a /distribute directory under your chosen build directory (it's /build/ by default), which contains a node-obs module that uses your chosen settings. Copy or symlink this into the project's node_modules directory and then simply require() it.
Unit tests can be run by calling npm test
after building with the Node.JS runtime (see Building).
Streamlabs Inc, all rights reserved.