obs-websocket-community-projects / obs-websocket-js

Consumes https://github.com/obsproject/obs-websocket
MIT License
689 stars 96 forks source link

obs.SetSceneItemProperties doesn't work without error #128

Open Zaniyar opened 5 years ago

Zaniyar commented 5 years ago

Given:

I have a scene (named 'Szene') and there a source (called 'Small Picture').

When I do this:

obs.SetSceneItemProperties({"scene-name": "Szene", "item": "Small Picture", "visible": false}); It works perfectly.

Problem:

When I do this:

obs.SetSceneItemProperties({"scene-name": "Szene", "item": "Small Picture", "x": 300});
//or
obs.SetSceneItemProperties({"scene-name": "Szene", "item": "Small Picture", "position.x": 300});
//or
obs.SetSceneItemProperties({"scene-name": "Szene", "item": "Small Picture", "cx": 300});

Nothing happens! Console log: { 'message-id': '5', status: 'ok', messageId: '5' }

Versions Used:

"obs-websocket-js": "^1.2.0",
"obs-websocket-js-types": "^4.4.0"
 "OBS on Windows": "22.02"
takahser commented 5 years ago

@Zaniyar did you find a solution for this? having the same issue..

haganbmj commented 5 years ago

You need to nest the position elements, the plugin docs try to explain this, but I agree that it's a bit tough to decipher. https://github.com/Palakis/obs-websocket/blob/c31ec077f588922951c2d5ea321188e69a948f89/docs/generated/protocol.md#setsceneitemproperties

When the docs say position.x what they mean is an object named position with key x.

{
    "position": {
        "x": 300
    }
}

So your request would need to look something like this. ex:

obs.SetSceneItemProperties({
    "scene-name": "Szene", 
    "item": "Small Picture", 
    "position": {
        "x": 300
    }
});
sqr commented 5 years ago

No matter how much I try, I still get errors trying to work with SetSceneItemProperties...

My code looks like this:

obs.send('SetSceneItemProperties', { 'scene-name' : 'Escena', 'item' : 'Imagen', 'position' : { 'x' : 300 } });

and I get this error no matter how much I try

image

I am able to change the streaming server, HLS sources for streams and start and stop a stream, but changing size and scale of a layer is not working :/ Is there something i'm doing wrong?

Thanks

dream811 commented 5 years ago

Hello, I have some unresolved problem I cant current scene's property(visibility, position, starttime, end time) only can change preview scene. please help me. thanks