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
spencerm24  
#1 Posted : Saturday, April 27, 2019 6:43:00 AM(UTC)
spencerm24

Rank: Advanced Member

Groups: Registered
Joined: 9/23/2017(UTC)
Posts: 249
Location: Toronto

Thanks: 13 times
Was thanked: 19 time(s) in 17 post(s)
Is it possible to embed API Calls to other applications with vMix? I have another application that has API through URL, and we would like to trigger it with vMix. Is this even possible through something like a script? If so, how?
kgoodyer  
#2 Posted : Saturday, April 27, 2019 1:40:52 PM(UTC)
kgoodyer

Rank: Advanced Member

Groups: Registered
Joined: 6/16/2015(UTC)
Posts: 193
Man
United Kingdom
Location: Milton Keynes, UK

Thanks: 10 times
Was thanked: 53 time(s) in 27 post(s)
Yes you can do it with a simple script, and a single vMix input. I have a bunch of external stuff controlled by vMix using this method.

There is no intelligence, the communication is pretty much one way, and you won't readily be able to collect or process any return activity. So here's how to do it.

Add a new vMix input as a web page and call it APIcntrl, set the url to something generic, I tend to use www.google.com

You can set the resolution to whatever you like, I tend to always set it to my native project resolution.

Then create a script with this in it...

Code:

Function=BrowserNavigate http://api.somedevice.net/dosomthing/?key=1726354&,APIcntrl


You can make a bunch of scripts for each API function of the remote device you want to access. Give each of them a different name.

Then you can assign input triggers to execute the scripts, synchronously with your transitions etc. or assign them to shortcuts and get access to them from your keyboard or 3rd part surface.

If you want to do multiple API calls to one or many devices in one script, I have found you need to allow a liitle bit of 'slack' between commands, 100ms is just about enough to keep thing reliable.

Code:

Function=BrowserNavigate http://api.somedevice.net/dosomthing/?apikey=1726354&command=switchon,APIcntrl
Sleep 100
Function=BrowserNavigate http://api.somedevice.net/dosomthing/?apikey=1726354&command=flyforward,APIcntrl
Sleep 100
Function=BrowserNavigate http://api.someother.com/playvt/,APIcntrl


If you need to keep multiple devices synchronous, create a vMix webpage input for each separate device (APIcntrlDrone and APIcntrlVTR) in the below example. and then you can fire commands off simultaneously from a single script without pausing between each api command.

Code:

Function=BrowserNavigate http://api.somedevice.net/dosomthing/?apikey=1726354&command=switchon,APIcntrlDrone
Function=BrowserNavigate http://api.someother.com/playvt/,APIcntrlVTR


Hope this helps.

Keith
(Professional vMix API and Script Junkie)
thanks 1 user thanked kgoodyer for this useful post.
JCN on 6/5/2021(UTC)
MartLeib  
#3 Posted : Saturday, April 27, 2019 6:21:46 PM(UTC)
MartLeib

Rank: Advanced Member

Groups: Registered
Joined: 2/23/2017(UTC)
Posts: 189
Estonia

Thanks: 1 times
Was thanked: 52 time(s) in 42 post(s)
If you already have gone the route of scripting, why use web browser input? You can make HTTP requests natively in VB.NET. This way you would not have the slack problem.
Only upside of the browser version is that it is available in all versions and if your API displays response, it could be seen.

Originally Posted by: kgoodyer Go to Quoted Post
...simple script... vMix input as a web page
Users browsing this topic
Guest (2)
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.