Add function to signal the browser source from JavaScript #439

Open
exeldro wants to merge 1 commit from exeldro/browser_signal into master
exeldro commented 2024-04-11 11:30:15 -05:00 (Migrated from github.com)

Description

adds void source_browser_signal(ptr source, string signal) to the global signal handler
adds void browser_signal(ptr source, string signal) to the signal handler of the browser source
in javascript you can signal a signal handler like this: window.obsstudio.signal("signal")

Motivation and Context

Allow JavaScript to send signals to plugins, without the need for an obs websocket connection
More generic solution replacing #423
The use case is my Markdown Source plugin. I want to me able to size the browser source to its contents provided by the markdown. I could hack a way by forcing obs-websocket enabled and getting the obs-websocket port and password from the settings and provide that to the the browser source, but I prefer a way that I don't have to force users to enable obs-websocket.

How Has This Been Tested?

On windows 11 with changes to the markdown source to allow it to resize it self

Types of changes

  • New feature (non-breaking change which adds functionality)

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.
  • I have included updates to all appropriate documentation.
### Description adds `void source_browser_signal(ptr source, string signal)` to the global signal handler adds `void browser_signal(ptr source, string signal)` to the signal handler of the browser source in javascript you can signal a signal handler like this: `window.obsstudio.signal("signal")` ### Motivation and Context Allow JavaScript to send signals to plugins, without the need for an obs websocket connection More generic solution replacing #423 The use case is my Markdown Source plugin. I want to me able to size the browser source to its contents provided by the markdown. I could hack a way by forcing obs-websocket enabled and getting the obs-websocket port and password from the settings and provide that to the the browser source, but I prefer a way that I don't have to force users to enable obs-websocket. ### How Has This Been Tested? On windows 11 with changes to the markdown source to allow it to resize it self ### Types of changes - New feature (non-breaking change which adds functionality) ### 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. - [x] I have included updates to all appropriate documentation.
Warchamp7 (Migrated from github.com) reviewed 2024-04-13 14:16:29 -05:00
@ -315,6 +315,14 @@ Permissions required: ALL
window.obsstudio.stopVirtualcam()
Warchamp7 (Migrated from github.com) commented 2024-04-13 14:15:18 -05:00

Typo on singal

Typo on `singal`
exeldro (Migrated from github.com) reviewed 2024-04-13 14:19:27 -05:00
@ -315,6 +315,14 @@ Permissions required: ALL
window.obsstudio.stopVirtualcam()
exeldro (Migrated from github.com) commented 2024-04-13 14:19:27 -05:00

Thanks, fixed

Thanks, fixed
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'exeldro/browser_signal:exeldro/browser_signal'
git switch 'exeldro/browser_signal'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'master'
git merge --no-ff 'exeldro/browser_signal'
git switch 'exeldro/browser_signal'
git rebase 'master'
git switch 'master'
git merge --ff-only 'exeldro/browser_signal'
git switch 'exeldro/browser_signal'
git rebase 'master'
git switch 'master'
git merge --no-ff 'exeldro/browser_signal'
git switch 'master'
git merge --squash 'exeldro/browser_signal'
git switch 'master'
git merge --ff-only 'exeldro/browser_signal'
git switch 'master'
git merge 'exeldro/browser_signal'
git push origin 'master'
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!439
No description provided.