obs-websocket-community-projects / obs-websocket-js Goto Github PK
View Code? Open in Web Editor NEWConsumes https://github.com/obsproject/obs-websocket
License: MIT License
Consumes https://github.com/obsproject/obs-websocket
License: MIT License
Is this a request for a new feature or a bug report?
Feature, Potential Bug
General Description:
Strengthen address parsing.
Relevant Ghetto Code Location -- Socket.js#connect()
It's also probably correct to check if the user submit something prefixed with ws://
already and relocate this.
Something like a disconnect function from the websocket would be helpful to correctly close a connection.
Maybe this will prevent OBS from crashing when trying to connect multiple times (just an idea).
General Description:
There's a whole bunch of unneeded bloat being loaded in with sha.js
and url
especially.
Is this a request for a new feature or a bug report?
Enhancement
General Description:
#connect()
to accept password as an argument.#authenticate()
if a password was provided.Is this a request for a new feature or a bug report?
Bug
General Description:
If there's no socket connection sending any request produces an error, which apparently isn't used as a reject.
obs.getCurrentScene().then(data => { console.log('success'); }).catch(err => { console.log(err); });
> WebSocket is already in CLOSING or CLOSED state.
Promise {[[PromiseStatus]]: "pending", [[PromiseValue]]: undefined}
To fix this, really all that's needed is a quick check to see whether the socket is connected, and issuing a reject if not.
https://github.com/haganbmj/obs-websocket-js/blob/master/lib/OBSWebSocket.js
SetTextGDIPlusProperties does not work, and fails with 'invalid request type'
on attemping to use it.
The error occurs with or without passed params.
obs.setTextGDIPlusProperties({})
.then((x) => {
console.log('Success', x)
})
.catch((x) => {
console.log('Error', x)
})
Error { error: 'invalid request type',
'message-id': '2',
status: 'error',
messageId: '2' }
Update .send
to async/await assuming there's webpack support for it.
General Description:
ESlint is more common these days and has more active development. In addition, there are several widely used eslint configs, and you can easily add your own per-project preferences on top of these configs.
xo/esnext
variant for ES6), also available in a variant that uses 2 spaces instead of tabsLet me know if any of these seem good to you, and I'll open a PR to implement it.
feature
The obs-websocket has implemented GetCurrentRTMPSettings.
Would be great if it was added here as well.
https://github.com/Palakis/obs-websocket/blob/rtmp-settings/PROTOCOL.md#getcurrentrtmpsettings
This is a Bug report I am trying to run obs-websocket-js in my node.js app.
when the script tries to connect I get following errormessage. Any help would be appreciated.
C:\project\scheduler-windows\node_modules\obs-websocket-js\lib\Socket.js:36
async connect(args = {}, callback) {
^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (C:\project\scheduler-windows\node_modules\obs-websocket-js\lib\OBSWebSocket.js:1:78)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)<!--
...
`const OBSWebSocket = require('obs-websocket-js');
const obs = new OBSWebSocket();
// Declare some events to listen for.
obs.onConnectionOpened(() => {
console.log('Connection Opened');
// Send some requests.
obs.getSceneList({}, (err, data) => {
console.log("Using callbacks:", err, data);
});
obs.getSceneList().then(data => {
console.log("Using promises:", data);
});
});
obs.onSwitchScenes(data => {
console.log(data);
});
obs.connect();`
My Code:
const OBSWebSocket = require('obs-websocket-js'); const obs = new OBSWebSocket(); obs.connect({ address: 'localhost:4444'});
Error:
C:\Users\compt\Desktop\OBS\node_modules\obs-websocket-js\lib\Socket.js:36
async connect(args = {}, callback) {
^^^^^^^
SyntaxError: Unexpected identifier
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:511:25)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)
at Module.require (module.js:466:17)
at require (internal/module.js:20:19)
at Object. (C:\Users\compt\Desktop\OBS\node_modules\obs-websocket-js\lib\OBSWebSocket.js:1:78)
at Module._compile (module.js:541:32)
Is this a request for a new feature or a bug report?
Enhancement
General Description:
Just a thought. Rather than manually executing callbacks, should be able to just assign them a .once
and let EventEmitter handle it.
In .send
there's already a binding for the internal message id, which both executes the callback and resolves the promise.
By binding two .once
s, one for the callback and one for the Promise should be able to clean up a number of places where some unnecessary callback wrapping is done.
The only reason this api accepts callbacks as a parameter is to support some older implementations that used that syntax - not entirely opposed to just eliminating that and forcing the use of promises as the only means of interaction with the api. There's a reason this still doesn't have a 1.0.0 release.
Hi, my issue is, for some reason source bounds are 0
, I can't work out if this is a obs-websocket-js
or a obs-websocket
issue
my request is for more events/functions, for example, I want to be able to change a sources position and dimensions when, for example, I use jQueryUI draggable()
and resize()
to change them on my webUI
The WebUI so far, this is for a friend to be able to control his OBS when he's at conventions, etc...
I also posted this over at obs-websocket
Source audio controls, source positioning/transform, profiles, scene collections, etc.
Scene names in OBS with characters like "Ä", "Ü", "Ö", "ß" (pretty important for germans) don't work.
There's an error when trying to send the scene name to OBS (needed for 'setCurrentScene').
Enhancement
Expose unique addEvent
/registerRequest
(or whatever name works) methods so that user's can bind their own custom plugin handlers should they need. In case they prefer the .onEventName
and .requestName
syntax.
Currently this is done internally in lib/methodBinding
, it'll need to be split out a bit and exposed.
Is this a request for a new feature or a bug report?
Enhancement
General Description:
._connected
variable to either a combined state
object or just add an ._authenticated
variable.General Description:
Had this sort of working and I still have the scripts offline, basically my ideal functionality would be...
gh-pages
.got lazy getting initial commit up
General Description:
Need to figure out JSDocs in Node's class structure.
I'm not sure there's much point now that this is just straight consuming exactly what the obs-websocket plugin puts out. Using the docs there should be sufficient past a couple guidelines here.
Bug
Not possible to emit onAuthenticationFailed
. Gets swallowed up as a general connection failure.
Sample unit test demonstrating this failure is in test/auth.spec.js
bug
importing obswebsocket throws the error:
C:\Users\werel\node_modules\obs-websocket-js\lib\OBSWebSocket.js:6
let requestCounter = 0;
^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet sup
ported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\Users\werel\node_modules\obs-websocket-js\index.js
:1:80)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
all newest as of 14th august 2017
None
General Description:
Basic Unit testing at least?
Consider https://github.com/thoov/mock-socket
Current obs-websocket API only exposes a Toggle endpoint, due to limitations with the current OBS API.
Either wait for OBS implementation, obs-websocket implementation, or make a request to get the current status and base commands off that.
Is this a request for a new feature or a bug report?
Enhancement
General Description:
Right now there are a bunch of individual calls emits using obs:internal:event
or obs:internal:request
or whatever.
Had issues (locally and in travis) with npm5 and package-locks.
The install commands seems to function differently and getting both dev and non-dev dependencies installed is a pain in the ass.
Going to wait until some of the bugs get worked out.
Using 'setSourceVisbility' always gives me the error [OBSWebSocket] Error: invalid request type
.
Example code:
ws.setSourceVisbility("Gamerecording", false);
Am I doing it wrong or is it a bug?
When trying to send a command to obs websocket. I get following error. I think my syntax is somehow not ok. But I am not too much into Promises right now. Can u help me? Also it would be nice if u could bring some light on the args that are supported. How does a typical args look like?
`C:\project\startstop\modules\obs.js:36
obs.send('StartRecording', {args}, callback(err, data)) returns Promise
^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:74:10)
at Object.runInThisContext (vm.js:116:10)
at Module._compile (module.js:537:28)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object. (C:\project\startstop\modules\socketio.js:3:11)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17)`
Is this a request for a new feature or a bug report?
Enhancement
General Description:
What's the point of instantiating an AuthHashing object when it's only used for one function and currently the only entry point to Authenticate retrieves the salt/challenge each time meaning that it doesn't need to be stored anywhere.
.on("eventName", callback)
style event emissions.Currently, I'm just using this intermediate class:
const EventEmitter = require('events');
const mixin = require('mixin');
const OBSWebSocket = require('obs-websocket-js').OBSWebSocket;
const allEvents = [
'onConnectionOpened',
'onConnectionClosed',
'onConnectionFailed',
'onAuthenticationSuccess',
'onAuthenticationFailure',
'onSceneSwitch',
'onSceneListChanged',
'onStreamStarting',
'onStreamStarted',
'onStreamStopping',
'onStreamStopped',
'onRecordingStarting',
'onRecordingStarted',
'onRecordingStopping',
'onRecordingStopped',
'onStreamStatus',
'onExit'
];
class OBSWebSocketEE extends mixin(OBSWebSocket, EventEmitter) {
constructor() {
super();
allEvents.forEach(n => {
// Alias of the event name without the "on" and lowerCamelCased.
let eventName = n.slice(2);
eventName = eventName[0].toLowerCase() + eventName.slice(1);
this[n] = (...args) => {
this.emit(n, ...args);
this.emit(eventName, ...args);
};
});
}
}
module.exports = OBSWebSocketEE;
typo in index.js
Assuming my PR for generated docs goes through in obs-websocket then it would be easiest to generate the list of available requests/events based on those docs.
Unsure if I'd want this to be some scheduled CI build that pushes back to master or something else instead.
Is this a request for a new feature or a bug report?
Bug
General Description:
.on
emitter.Proposed:
.send
.Extra Information / Code Samples / etc:
https://github.com/haganbmj/obs-websocket-js/blob/master/lib/methodBinding.js#L43
I don't know if I'm doing it wrong but using the callback onSceneListChanged doesn't work for me.
The response I get from this function is always null.
For example this gives me null:
ws.onSceneListChanged = function(response) { console.log(response); };
I got no problem with other functions like 'onSceneSwitch' for example.
Currently, obs-websocket-js is quite noisy in the console with its log messages. It's generally standard for libraries to be "silent" -- that is: to only print output to the console if the consumer of that library has explicitly requested this behavior via some type of debug flag, configuration parameter, or environment variable.
@haganbmj If it's okay with you, I'll open a PR that silences all log statements by default unless some debug flag has been set to true.
Hi haganbmj,
at first: Thank you for this project! My first steps on controlling the obs websocket were quite positive. There is one thing, that doesn't work for me as expected:
I get an error on sending a 'StartStreaming', 'StopStreaming', 'StartRecording' or 'StopRecording' request:
[OBSWebSocket] Error: invalid request type
I wrote the function myself based on the already existing and working 'StartStopStreaming' - request in obs-websocket.js:
OBSWebSocket.prototype.startStreaming = function() { this._sendRequest('StartStreaming'); };
Here is my system:
I worked with the official websocket plugin protocol and couldn't see any complications concerning the RequestHandler.
Do you know what causes this error and how to solve it?
Many thanks!
Grunt isn't doing anything aside from appending a banner, which webpack could just handle by itself.
Also should be able to load in one of webpack's minify plugins.
General Description:
Update Readme and Code Samples to reflect the current API.
Hi @haganbmj!
I noticed you said that you don't have as much time as you'd like to dedicate to the obs-websocket-js project. I'd be happy to help with some of the code work if you could clearly lay out a list of tasks on the project board. This would help me know where to start and let me work the fastest. Let me know if this organizational work is something you have time for.
Thanks,
Alex
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.