JS API Enhancements #186

Merged
WizardCM merged 7 commits from api-enhancements into master 2020-02-12 17:40:18 -06:00
WizardCM commented 2019-12-25 02:41:59 -06:00 (Migrated from github.com)

Description

Significantly enhances the OBS JS API available in browser sources to expose more events and functions, especially for newer features.

This PR replaces #150 #151 #152 #153.
Fixes #72

Added Events:

  • obsSourceVisibleChanged
  • obsSourceActiveChanged
  • obsRecordingPaused
  • obsRecordingUnpaused
  • obsReplaybufferStarting
  • obsReplaybufferStarted
  • obsReplaybufferStopping
  • obsReplaybufferStopped

Updated function callbacks:

  • getStatus: recordingPaused

Added functions:

  • saveReplayBuffer

Also updated JS documentation using the JSDoc standard, with object definitions where appropriate.

Motivation and Context

  • The JavaScript API available in OBS Browser sources can provide a lot of power to overlays
  • More events and functions have been requested often
  • Recently added capabilities, like Replay Buffer and Pause Recordings were missing JS events
  • Source visibility & active state were originally designed as override functions, which are not common in JS. Instead, I've added event callbacks to be consistent with all other events
  • The JS documentation needed an overhaul for readability

How Has This Been Tested?

  • Create a webpage with event listeners, and read their responses
  • Open the dev tools and try running a few of the functions with callbacks, like getting the pause status of a recording

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Documentation (a change to documentation pages)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
### Description Significantly enhances the OBS JS API available in browser sources to expose more events and functions, especially for newer features. This PR **replaces** #150 #151 #152 #153. Fixes #72 Added Events: * obsSourceVisibleChanged * obsSourceActiveChanged * obsRecordingPaused * obsRecordingUnpaused * obsReplaybufferStarting * obsReplaybufferStarted * obsReplaybufferStopping * obsReplaybufferStopped Updated function callbacks: * getStatus: recordingPaused Added functions: * saveReplayBuffer Also updated JS documentation using the JSDoc standard, with object definitions where appropriate. ### Motivation and Context * The JavaScript API available in OBS Browser sources can provide a lot of power to overlays * More events and functions have been requested often * Recently added capabilities, like Replay Buffer and Pause Recordings were missing JS events * Source visibility & active state were originally designed as override functions, which are not common in JS. Instead, I've added event callbacks to be consistent with all other events * The JS documentation needed an overhaul for readability ### How Has This Been Tested? * Create a webpage with event listeners, and read their responses * Open the dev tools and try running a few of the functions with callbacks, like getting the pause status of a recording ### Types of changes - New feature (non-breaking change which adds functionality) - Code cleanup (non-breaking change which makes code smaller or more readable) - Documentation (a change to documentation pages) ### Checklist: - [x] My code has been run through [clang-format](https://github.com/obsproject/obs-studio/blob/master/.clang-format). - [x] I have read the [**contributing** document](https://github.com/obsproject/obs-studio/blob/master/CONTRIBUTING.rst). - [x] My code is not on the master branch. - [x] The code has been tested. - [x] All commit messages are properly formatted and commits squashed where appropriate.
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-obsproject/obs-browser!186
No description provided.