Git Product home page Git Product logo

obs-browser's Introduction

obs-browser

obs-browser introduces a cross-platform Browser Source, powered by CEF (Chromium Embedded Framework), to OBS Studio. A Browser Source allows the user to integrate web-based overlays into their scenes, with complete access to modern web APIs.

On Windows, this also adds support for Service Integration (linking third party services) and Browser Docks (webpages loaded into the interface itself). macOS support for service integration & browser docks is in the works, and Linux support is planned.

This plugin is included by default on official packages on Windows and macOS. While Linux is supported, the official ppa does not currently include the browser source due to a conflict with GTK.

JS Bindings

obs-browser provides a global object that allows access to some OBS-specific functionality from JavaScript. This can be used to create an overlay that adapts dynamically to changes in OBS.

Get Browser Plugin Version

/**
 * @returns {number} OBS Browser plugin version
 */
window.obsstudio.pluginVersion
// => 1.24.0

Register for event callbacks

/**
 * @typedef {Object} OBSEvent
 * @property {object} detail - data from event
 */

window.addEventListener('obsSceneChanged', function(event) {
	var t = document.createTextNode(event.detail.name)
	document.body.appendChild(t)
})

Available events

Descriptions for these events can be found here.

  • obsSceneChanged
  • obsSourceVisibleChanged
  • obsSourceActiveChanged
  • obsStreamingStarting
  • obsStreamingStarted
  • obsStreamingStopping
  • obsStreamingStopped
  • obsRecordingStarting
  • obsRecordingStarted
  • obsRecordingPaused
  • obsRecordingUnpaused
  • obsRecordingStopping
  • obsRecordingStopped
  • obsReplaybufferStarting
  • obsReplaybufferStarted
  • obsReplaybufferStopping
  • obsReplaybufferStopped

Get the current scene

/**
 * @typedef {Object} Scene
 * @property {string} name - name of the scene
 * @property {number} width - width of the scene
 * @property {number} height - height of the scene
 */

/**
 * @param {function} callback
 * @returns {Scene}
 */
window.obsstudio.getCurrentScene(function(scene) {
	console.log(scene)
})

Get OBS output status

/**
 * @typedef {Object} Status
 * @property {boolean} recording - not affected by pause state
 * @property {boolean} recordingPaused
 * @property {boolean} streaming
 * @property {boolean} replaybuffer
 */

/**
 * @param {function} callback
 * @returns {Status}
 */
window.obsstudio.getStatus(function (status) {
	console.log(status)
})

Save OBS Replay Buffer

/**
 * Does not accept any parameters and does not return anything
 */
window.obsstudio.saveReplayBuffer()

Register for visibility callbacks

This method is legacy. Register an event listener instead.

/**
 * onVisibilityChange gets callbacks when the visibility of the browser source changes in OBS
 *
 * @deprecated
 * @see obsSourceVisibleChanged
 * @param {boolean} visibility - True -> visible, False -> hidden
 */
window.obsstudio.onVisibilityChange = function(visibility) {
	
};

Register for active/inactive callbacks

This method is legacy. Register an event listener instead.

/**
 * onActiveChange gets callbacks when the active/inactive state of the browser source changes in OBS
 *
 * @deprecated
 * @see obsSourceActiveChanged
 * @param {bool} True -> active, False -> inactive
 */
window.obsstudio.onActiveChange = function(active) {
	
};

Building on OSX

Building CEF

Getting

Setting Up Project

mkdir build
cmake -D CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY=libc++ -G Xcode ..
open cef.xcodeproj/

Building

Build in Xcode (โŒ˜+B)

TODO: tell user to move stuff, or update FindCEF.cmake

Building OBS and obs-browser

Installing Dependencies

brew install ffmpeg x264 qt5 cmake

Setting Up Project

git clone --recursive https://github.com/jp9000/obs-studio.git
cd ./obs-studio
git clone [email protected]:kc5nra/obs-browser.git ./plugins/obs-browser
echo "add_subdirectory(obs-browser)" >> ./plugins/CMakeLists.txt
mkdir build
cd ./build
cmake -D CMAKE_PREFIX_PATH=/usr/local/opt/qt5/lib/cmake -D CEF_ROOT_DIR=/Users/username/Development/cef_binary_3.2883.1540.gedbfb20_macosx64 -D BUILD_BROWSER=yes -G Xcode ..
open obs-studio.xcodeproj/

Building

Build in Xcode (โŒ˜+B)

Building on Windows

Building CEF

Getting

Setting Up the Project

  • Run cmake-gui
    • In "where is the source code", enter in the repo directory (example: C:/Users/User/Desktop/cef_binary_3.2743.1445.gdad7c0a_windows64).
    • In "where to build the binaries", enter the repo directory path with the 'build' subdirectory (example: C:/Users/User/Desktop/cef_binary_3.2743.1445.gdad7c0a_windows64/build).
  • Press 'Configure' and select the generator that fits to your installed VS Version: Visual Studio 12 2013 Win64, Visual Studio 14 2015 Win64 or Visual Studio 15 2017 Win64
  • Press 'Generate' to generate Visual Studio project files in the 'build' subdirectory.
  • Open cef.sln from the 'build' subdirectory

Building

  • Build at least libcef_dll_wrapper (as Release), the rest is optional and are just clients to test with

Building OBS and obs-browser

Follow the OBS build instructions

https://github.com/jp9000/obs-studio/wiki/Install-Instructions#windows

Setting Up Project

  • Enable BUILD_BROWSER and set the CEF_ROOT_DIR path in cmake-gui for obs-studio (example: C:/Users/User/Desktop/cef_binary_3.2743.1445.gdad7c0a_windows64)
    • Press 'Generate' to generate Visual Studio project files in the 'build' subdirectory.
  • Open obs-studio.sln from the 'build' subdirectory

Building

Build in Visual Studio

obs-browser's People

Contributors

jp9000 avatar osirisnl avatar kc5nra avatar ddrboxman avatar wizardcm avatar mzmiric5 avatar xaymar avatar zavitax avatar gol-d-ace avatar vodbox avatar pkviet avatar tbodt avatar rytoex avatar cpyarger avatar cg2121 avatar dtcooper avatar kojoley avatar ninja101 avatar notr1ch avatar scg82 avatar palakis avatar suslikv avatar jpark37 avatar luzpaz avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.