npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

use-obs-browser

v0.0.11

Published

Code layer allowing the use of obs-browser in React in a more "sexy" way.

Downloads

3

Readme

use-obs-browser


⚠️ Worked using npm link, don't work as a true module, fix in progress ⚠️ |

A thin React hooks library to use the javascript API from the obs-browser source plugin (at the commit d1fa35dcbc384136e9e883f2d6071b14fd8f9a65)

install

In your project folder:

npm install --save-dev use-obs-browser

or the shorter: npm i -SD use-obs-browser

Philosophy

I didn't want to overcomplicate everything, it's just a collection of hooks that plugs straight into the obs-browser source plugin js API when the app is opened in OBS as a browser source.

Exemple: you want to get the version of the plugin you're running with ? Just:

import { useOBSVersion } from "use-obs-browser";

return () => <p>OBS Browser source plugin version: {useOBSVersion()}</p>;

Why all those hooks and not just functions ? Because at some point in the loading of the page by the obs-browser plugin there are few things missing, first the window object, then event the obsstudio object is not directly available. Plus there is the right management, like, you can't access the output status if the right to access them is not bestowed by the plugin.

There shouldn't be any error or exception, everything is made to run smoothly and if something is not working, or you just don't have the rights to do it, it just return the default or undefined.

Outlines

  • CONTROL_LEVELS, their list, indexes are important:

    ["NONE", "OBS_STATE", "USER_INFORMATIONS", "BASIC", "ADVANCED", "TOTAL"];
  • hasAtLeastAccess: take the index of a an CONTROL_LEVELS and return a function that take an supposed CONTROL_LEVELS index (integer) as argument and check if it's equal or bigger than the former one. Mainly serve as building all the hasAtLeast[CONTROL_LEVEL]Access functions that ease the writing of access control code:

      hasAtLeastOBS_STATEAccess
      hasAtLeastUSER_INFORMATIONSAccess
      hasAtLeastBASICAccess
      hasAtLeastADVANCEDAccess
      hasAtLeastTOTALAccess
  • statesStates is a state object that contain the various states possible of the various states of OBS (yo dawg), so, in order, because the indexes are important:

    {
      "recording": ["stopped", "starting", "started", "paused", "stopping"],
      "replaybuffer": ["stopped", "starting", "started", "saved", "stopping"],
      "streaming": ["stopped", "starting", "started", "stopping"],
      "virtualcam": ["stopped", "started"]
    }
  • useOBSBrowser: return the obsstudio object.

  • useOBSControlLevel: return the current controlLevel.

  • useOBSCurrentScene: require the USER_INFORMATIONS control level, return the currentScene onject, containing: { height: [height of the scene in pixels], width: [width of the scene in pixels], name: [name of the scene] }.

  • useOBSCurrentTransition: require the USER_INFORMATIONS control level, return the currentTransition name.

  • useOBSoutputStatus: require the OBS_STATE control level, return the object containing the various status of the various outputs, see statesStates. By default:

    {
      recording: "stopped",
      replaybuffer: "stopped",
      streaming: "stopped",
      virtualcam: "stopped"
    }
  • useOBSScenes: require the USER_INFORMATIONS control level, return the array containing the various scenes name available.

  • useOBSTransitions: require the USER_INFORMATIONS control level, return the array containing the various transitions name available.

  • useOBSVersion: return the version string of the current OBS Browser source plugin.

[TO BE CONTINUED]