logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
tsioukas  
#1 Posted : Monday, April 29, 2024 5:36:19 AM(UTC)
tsioukas

Rank: Advanced Member

Groups: Registered
Joined: 7/10/2020(UTC)
Posts: 35
Man
Greece

Thanks: 13 times
Was thanked: 4 time(s) in 3 post(s)
I am wondering if vMix works at its designed on TCP/API

Based on example in documentation this command
Code:
FUNCTION PreviewInput Input=5\r\n

sould give the response
Code:
FUNCTION OK PreviewInput\r\n

Instead of that it gives this
Code:
FUNCTION OK Completed

The problem is that if we give a lot of commands we don't know when they executed and if executed normally, because it's imposible to monitor the responses.

For example I send the command
Code:
FUNCTION SnapshotInput Value=snapshot.png Input=1

it takes about 1-2sec to executed. If I get only the "OK Completed" response I don't know if the snapshot completed (to proceed to further actions on my code) or if the response was from another function that runs simultaneous.

Is this working as it designed?

By the way, is it possible to make it to return the image as Buffer instead saving the snapshot into a file.

Thank you
admin  
#2 Posted : Monday, April 29, 2024 6:48:07 PM(UTC)
admin

Rank: Administration

Groups: Administrators
Joined: 1/13/2010(UTC)
Posts: 5,227
Man
Location: Gold Coast, Australia

Was thanked: 4332 time(s) in 1528 post(s)
Hi,

Only one command should be run at a time.
The only exceptions to this are TALLY and ACTS responses which may be received at any time, but these have different responses to FUNCTION so shouldn't cause any conflicts.

The part of the response to look for is FUNCTION OK, the text after it is informational only, such as more information on the error in the case of FUNCTION ER

Regards,

Martin
vMix
thanks 1 user thanked admin for this useful post.
tsioukas on 4/29/2024(UTC)
tsioukas  
#3 Posted : Monday, April 29, 2024 7:45:46 PM(UTC)
tsioukas

Rank: Advanced Member

Groups: Registered
Joined: 7/10/2020(UTC)
Posts: 35
Man
Greece

Thanks: 13 times
Was thanked: 4 time(s) in 3 post(s)
Thank's, the response "FUNCTION OK PreviewInput\r\n" as it written on your documentation confused me when I notice that. Acts return preview function in a different format "ACTS OK InputPreview 1 1".

In my code I detect last command (with a queue) to emit an event if a specific function executed and needs further actions. But I thought that a solution like "FUNCTION OK PreviewInput\r\n" etc. will make my code simpler.

Thank you again.

P.S. I know that is difficult, did you think if it’s possible to add a function that return snapshot as image buffer? I use sharp on nodejs to read local file and edit/crop this snapshot, and with this I will avoid the use of tmp file. [please... ;)]
tsioukas  
#4 Posted : Thursday, May 2, 2024 7:10:49 PM(UTC)
tsioukas

Rank: Advanced Member

Groups: Registered
Joined: 7/10/2020(UTC)
Posts: 35
Man
Greece

Thanks: 13 times
Was thanked: 4 time(s) in 3 post(s)
I think, after all, to avoid any misunderstanding, Function description on documentation
Quote:
Commands

FUNCTION
Format: FUNCTION <Function> [QueryString]\r\n
Example Request: FUNCTION PreviewInput Input=5\r\n
Example Request: FUNCTION SetText Input=3&SelectedName=Headline&Value=Hello world\r\n
Example Response: FUNCTION OK PreviewInput\r\n
Example Response: FUNCTION ER Error message\r\n

need to replace "Response: FUNCTION OK PreviewInput" with "Response: FUNCTION OK Completed" as it never gives this type of response.
Dist  
#5 Posted : Friday, December 20, 2024 1:10:41 AM(UTC)
Dist

Rank: Advanced Member

Groups: Registered
Joined: 12/19/2019(UTC)
Posts: 50
United Kingdom

Was thanked: 24 time(s) in 17 post(s)
+1 to this

I was looking to implement better logging in an app, but unfortunately as previously stated the TCP response to successful functions is "FUNCTION OK Completed" which is not particularly helpful to differentiate what succeeded and what failed when there's no sort of incremental number ID, nonce, or the return of the function being requested which was completed.

While "Only one command should be run at a time." might be an excuse for why the current functionality may be sufficient for some use cases, it's not how all users use vMix and productions are performing increasingly complex setups and macros utilizing multiple functions being run concurrently or on quick succession. And even if it's not something that is planned to be implemented at the very least the documentation should be updated as even the most recent docs (and beta v28 docs) include "Example Response: FUNCTION OK PreviewInput\r\n" which indicates that the function requested is returned in the response which is incorrect.
thanks 1 user thanked Dist for this useful post.
tsioukas on 12/20/2024(UTC)
admin  
#6 Posted : Friday, December 20, 2024 2:59:16 AM(UTC)
admin

Rank: Administration

Groups: Administrators
Joined: 1/13/2010(UTC)
Posts: 5,227
Man
Location: Gold Coast, Australia

Was thanked: 4332 time(s) in 1528 post(s)
As mentioned, do not send multiple requests without waiting for a response each time.

We can look at updating the documentation, however please note that any text after OK or ER is informational text only, and is subject to change as a result.

(For what it is worth, there is no benefit to trying to batch commands, as vMix processes all commands in a serialized manner, and will not proceed to the next command until
the response is sent anyway.)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.