Giter VIP home page Giter VIP logo

web3nelly / change-obs-scene Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 25 KB

Node.js npm module. Using obs-websocket-js to automate our live stream. See Automations in action on:

Home Page: https://twitch.tv/breaking3Dreality

License: MIT License

JavaScript 100.00%
automation streaming websocket obs obs-scene-switcher obs-scene obs-websocket-js npm-package nodejs websocket-application

change-obs-scene's Introduction

@b3nelly/change-obs-scene Node.js npm Package

With just a few lines of code, automate changing your OBS scenes using the @b3nelly/change-obs-scene npm package. ๐Ÿ’œ

Dependancies

Installation

npm install @b3nelly/change-obs-scene

Usage

First, launch OBS and enable the WebSocket Server

Tools > WebSocket Server Settings:

  • obs websocket server settings image
  • Don't forget to set your Server Password
  • If you do not set a password, you do not need to pass the obsWebSocketServerPassword param to changeScene()

Simple Usage Example

const changeScene = require("@b3nelly/change-obs-scene").default;
const intervalInSeconds = 30; // 30 seconds per scene
changeScene(intervalInSeconds); // it's that simple.

CommonJS (cjs) Usage Example

const changeScene = require("@b3nelly/change-obs-scene").default;

const obsSkipScenes = [];
const intervalInSeconds = 30;
const obsWebSocketServerPassword = "your-password-here";
const obsWebSocketServerURL = "ws://localhost:4455";

changeScene(
  intervalInSeconds,
  obsSkipScenes,
  obsWebSocketServerPassword,
  obsWebSocketServerURL
);

ECMAScript Module (esm) Usage Example

import changeScene from "@b3nelly/change-obs-scene";

const obsSkipScenes = [];
const intervalInSeconds = 30;
const obsWebSocketServerPassword = "your-password-here";

changeScene(intervalInSeconds, obsSkipScenes, obsWebSocketServerPassword);

Asynchronous Module Definition (amd) Usage Example

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>AMD Example</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script>
    <script>
      require.config({
        paths: {
          changeScene: "@b3nelly/change-obs-scene/dist/change-obs-scene.amd",
        },
      });

      require(["changeScene"], function (changeScene) {
        const obsSkipScenes = [];
        const intervalInSeconds = 90;
        const obsWebSocketServerPassword = "your-password-here";

        changeScene(
          intervalInSeconds,
          obsSkipScenes,
          obsWebSocketServerPassword
        );
      });
    </script>
  </head>
  <body></body>
</html>

API

changeScene(
  intervalInSeconds,
  obsSkipScenes,
  obsWebSocketServerPassword,
  obsWebSocketServerURL
);
Parameter Type Default Description
intervalInSeconds (optional) number 60 Number of seconds between each scene
obsSkipScenes (optional) Array<string> [] An array of scene names to skip when switching scenes
obsWebSocketServerPassword (optional) string undefined OBS WebSocket Server Password
obsWebSocketServerURL (optional) string "ws_://localhost:4455" OBS WebSocket Server URL / IP

change-obs-scene In Action

Working change obs scene example image

CLI

npm run cli

You will be prompted to enter in the changeSence() params. Leave param blank to use default value.

Build

npm run build

Running the build command will automatically create the dist/ dir and create/update the cjs, esm, and amd files inside.

Configuration file rollup.config.js

Development Dependancies

License

MIT

This README.md file provides installation and usage instructions, as well as a brief description of the API for the @b3nelly/change-obs-scene package. Feel free to modify it as needed.

change-obs-scene's People

Contributors

web3nelly avatar

Stargazers

 avatar

Watchers

 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.