### VB.NET: Interact with vMix API Source: https://www.vmix.com/help28/VBNetScripting This script demonstrates how to call functions within the vMix API. The example shows a 'CubeZoom' function call with a duration. This allows for controlling advanced vMix features programmatically. No specific setup is required beyond having vMix running. ```vb.net API.Function("CubeZoom",,1000) ``` -------------------------------- ### Overlay Input with Transitions (vMix Web Scripting) Source: https://www.vmix.com/help28/WebScripting This example demonstrates how to overlay an input using 'in' and 'out' transitions with a specified duration. It utilizes the 'OverlayInput1In', 'Sleep', and 'OverlayInput1Out' functions. ```vMix Web Scripting Function=OverlayInput1In&Input=Title 0- The Classic Blue.gtzip Sleep 2000 Function=OverlayInput1Out ``` -------------------------------- ### vMix API: Get State Information (XML Output Example) Source: https://www.vmix.com/help28/DeveloperAPI An example of the XML output returned by the vMix API when requesting state information. This structure details input configurations, including keys, numbers, types, titles, states, and text/overlay elements. ```xml 11.0.0.16 NewsHD.xaml Hello Hello LateNightNews 1 ``` -------------------------------- ### VB.NET: Debugging with Console Output Source: https://www.vmix.com/help28/VBNetScripting This script utilizes the vMix Console object to write messages to the vMix Script console for debugging. It includes examples of logging script progress, interacting with overlays, and using the Sleep function. No specific vMix setup is strictly required, but an overlay source is used in the example. ```vb.net Console.WriteLine("Beginning Example Script") Overlay.Find(1).In("NewsHD.xaml") Console.WriteLine("Title should now appear in Overlay 1, now we wait 5 seconds") Sleep(5000) Console.WriteLine("Now we will transition out Overlay 1") Overlay.Find(1).Out Console.WriteLine("Finished!") ``` -------------------------------- ### VB.NET: Control vMix Overlay Source: https://www.vmix.com/help28/VBNetScripting This script demonstrates how to manage vMix overlays. The first example puts a specific overlay source into overlay channel 1. The second example turns off all overlay channels from 1 to 4. Requires an overlay source named 'NewsHD.xaml' for the first example. ```vb.net Overlay.Find(1).In("NewsHD.xaml") ``` ```vb.net For i As Integer = 1 to 4 Overlay.Find(i).Off Next ``` -------------------------------- ### Set Text and Overlay Input (vMix Web Scripting) Source: https://www.vmix.com/help28/WebScripting This example combines setting text in a title field and then overlaying that title with transitions. It uses 'SetText', 'OverlayInput1In', 'Sleep', and 'OverlayInput1Out' functions. ```vMix Web Scripting Function=SetText&Input=Title 0- The Classic Blue.gtzip&SelectedName=Description.Text&Value=Hello World Function=OverlayInput1In&Input=Title 0- The Classic Blue.gtzip Sleep 4000 Function=OverlayInput1Out ``` -------------------------------- ### vMix API: Fade Preview to Active Source: https://www.vmix.com/help28/DeveloperAPI This example demonstrates how to use the vMix API to trigger a fade transition from the Preview to the Active input. It requires the 'Fade' function and a specified duration in milliseconds. ```http http://127.0.0.1:8088/api/?Function=Fade&Duration=1000 ``` -------------------------------- ### VB.NET: Call vMix Input Function Source: https://www.vmix.com/help28/VBNetScripting This script shows how to execute a function on a vMix input. The example calls the 'Cut' function on the currently selected preview input. No specific input is required, as it operates on the preview bus. ```vb.net Input.Preview.Function("Cut") ``` -------------------------------- ### vMix API: Get State Information (XML) Source: https://www.vmix.com/help28/DeveloperAPI This example shows how to retrieve the current state information of vMix in XML format by sending an API request with no parameters. The response includes details about vMix version, inputs, and overlays. ```http http://127.0.0.1:8088/API/? ``` -------------------------------- ### vMix API: Add Input from File Source: https://www.vmix.com/help28/DeveloperAPI This example illustrates how to add a new input to vMix from a local file using the 'AddInput' function. The 'Value' parameter specifies the file type and path, such as 'Video|c:\filename.wmv' or 'Image|c:\filename.jpg'. ```http http://127.0.0.1:8088/API/?Function=AddInput&Value=Video|c:\filename.wmv ``` ```http http://127.0.0.1:8088/API/?Function=AddInput&Value=Image|c:\filename.jpg ``` -------------------------------- ### vMix Web API to Web Scripting Syntax Conversion Source: https://www.vmix.com/help28/WebScripting Illustrates the conversion from vMix Web API query strings to the simplified vMix Web Scripting syntax. The URL portion ('http://localhost:8088/API/?') is omitted. ```vMix Web Scripting Function=Cut ``` ```vMix Web Scripting Function=Slide&Input=Title 0- The Classic Blue.gtzip&Duration=1000 ``` ```vMix Web Scripting Function=SetText&Input=Title 0- The Classic Blue.gtzip&SelectedName=Description.Text&Value=Hello World ``` -------------------------------- ### FUNCTION Command Source: https://www.vmix.com/help28/TCPAPI Calls a Shortcut Function with an optional Query String, which follows the syntax of the HTTP WEB API. Standard URL escape/encoding characters should be used. ```APIDOC ## FUNCTION Command ### Description Calls a Shortcut Function with optional Query String. This Query String exactly matches the syntax and layout of HTTP WEB API. Standard URL escape/encoding characters should be used. ### Method POST ### Endpoint /api/function ### Parameters #### Query Parameters - **Function** (string) - Required - The function to call. - **Input** (integer) - Optional - The input associated with the function. - **SelectedName** (string) - Optional - The name of the selected field (e.g., for text inputs). - **Value** (string) - Optional - The value to set for the selected field. ### Request Example ```json { "function": "PreviewInput", "input": 5 } ``` ```json { "function": "SetText", "input": 3, "selectedName": "Headline", "value": "Hello world" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates if the function completed successfully ('OK') or failed ('ER'). - **message** (string) - A message providing details about the success or failure. #### Response Example ``` FUNCTION OK Completed ``` ``` FUNCTION ER Error message ``` ``` -------------------------------- ### TALLY Command Source: https://www.vmix.com/help28/TCPAPI Retrieves a list of tally values for inputs. 0 = off, 1 = program, 2 = preview. The list is padded to the total number of inputs. ```APIDOC ## TALLY Command ### Description Returns a list of tally values where 0 = off, 1 = program, 2 = preview. The list is padded to the total number of inputs currently added to vMix and may have up to 1000 entries as a result. (Maximum possible length = 9 + 1000 + 2 = 1011 bytes) ### Method GET ### Endpoint /api/tally ### Parameters None ### Request Example ``` TALLY ``` ### Response #### Success Response (200) - **tally_data** (string) - A string representing the tally values for each input. #### Response Example ``` TALLY OK 0121... ``` ``` -------------------------------- ### Manage Layers in vMix Input Source: https://www.vmix.com/help28/ShortcutFunctionReference Controls the visibility of layers within a vMix input. You can turn layers on, off, or toggle their state using the layer index. Layer indexing starts from 1. ```vMix Script LayerOn "1" ``` ```vMix Script LayerOff "2" ``` ```vMix Script LayerOnOff "3" ``` -------------------------------- ### Manage Countdown Timer in vMix Source: https://www.vmix.com/help28/ShortcutFunctionReference Controls the state of a countdown timer, including setting its duration, pausing, resuming, starting from the beginning, stopping, and suspending. Durations are set in hh:mm:ss format. ```vMix Script SetCountdown "01:30:00" ``` ```vMix Script PauseCountdown ``` ```vMix Script StartCountdown ``` ```vMix Script StopCountdown ``` -------------------------------- ### SUBSCRIBE Command Source: https://www.vmix.com/help28/TCPAPI Subscribe to an event/command. Event responses matching the selected command may begin immediately, even before the SUBSCRIBE response is received. Events continue until UNSUBSCRIBE or connection close. ```APIDOC ## SUBSCRIBE Command ### Description Subscribe to an event/command. Event responses matching the selected command may begin immediately, even before the SUBSCRIBE response is received. Event responses will continue to be received until either a. UNSUBSCRIBE is called or b. the connection is closed. ### Method POST ### Endpoint /api/subscribe ### Parameters #### Query Parameters - **COMMAND** (string) - Required - The command or event to subscribe to (e.g., 'TALLY'). ### Request Example ``` SUBSCRIBE TALLY ``` ### Response #### Success Response (200) - **status** (string) - Indicates successful subscription ('OK'). - **command** (string) - The command that was subscribed to. #### Response Example ``` SUBSCRIBE OK TALLY ``` ``` -------------------------------- ### Fade Input with Duration (vMix Web Scripting) Source: https://www.vmix.com/help28/WebScripting This snippet shows how to fade to a specific input using a defined transition time in milliseconds. It employs the 'Fade' function with 'Input' and 'Duration' parameters. ```vMix Web Scripting Function=Fade&Input=Camera1&Duration=1000 ``` -------------------------------- ### Control Title Presets in vMix Source: https://www.vmix.com/help28/ShortcutFunctionReference Allows navigation between different title presets. You can select a preset by its index. ```vMix Script SelectTitlePreset "5" ``` ```vMix Script NextTitlePreset ``` ```vMix Script PreviousTitlePreset ```