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
madness  
#1 Posted : Sunday, November 11, 2018 9:26:13 AM(UTC)
madness

Rank: Advanced Member

Groups: Registered
Joined: 4/16/2013(UTC)
Posts: 406
Man
Location: Iowa

Thanks: 281 times
Was thanked: 32 time(s) in 29 post(s)
So I've used the Web API, but was unaware of the TCP API until this week. I'm attempting to use it, but am confused!
What are you sending the commands with? A browser? script code? In a browser, all I get is a search response. It's obvious I am misinterpreting the information provided. I had been using Autohotkey to send commands via web commands to vMix, but if the TCP API is more efficient, its obviously the way to go. Just need a little push in the right direction to get started.

Can anyone give me a push?
Stealth77  
#2 Posted : Tuesday, November 13, 2018 1:40:02 AM(UTC)
Stealth77

Rank: Member

Groups: Registered
Joined: 8/4/2015(UTC)
Posts: 17
Man
Russian Federation

Thanks: 3 times
Was thanked: 8 time(s) in 4 post(s)
First you need to connect to vMix using TCP protocol.
Then transmit the command in UTF-8 format.
Also check the answer from the sent command success or error.
madness  
#3 Posted : Tuesday, November 13, 2018 12:02:53 PM(UTC)
madness

Rank: Advanced Member

Groups: Registered
Joined: 4/16/2013(UTC)
Posts: 406
Man
Location: Iowa

Thanks: 281 times
Was thanked: 32 time(s) in 29 post(s)
So what are you using to transmit/connect?
Stealth77  
#4 Posted : Wednesday, November 14, 2018 6:28:54 AM(UTC)
Stealth77

Rank: Member

Groups: Registered
Joined: 8/4/2015(UTC)
Posts: 17
Man
Russian Federation

Thanks: 3 times
Was thanked: 8 time(s) in 4 post(s)
TCP connection example



Example of TCP transfer vMix command

thanks 3 users thanked Stealth77 for this useful post.
madness on 11/14/2018(UTC), Pro321Video on 12/30/2020(UTC), qa_p1981 on 3/22/2023(UTC)
MDB  
#5 Posted : Monday, March 27, 2023 4:40:54 AM(UTC)
MDB

Rank: Newbie

Groups: Registered
Joined: 7/6/2021(UTC)
Posts: 7
Man
Germany
Location: Münster

Could anybody explain me how to use this example, please. I tried to put it in Visual Studio 2022 to make a consoleaplication in C++ and in C# without success.
Or could somebody translate this in Visual Basic.

From the user guide I took: Example Request: FUNCTION PreviewInput Input=5\r\n
and changed it to FUNCTION Play Input 1\r\n

In Visual Basic I try

Code:
Imports System.Net.Sockets
Imports System.IO

Module Module1
    Dim stream As NetworkStream
    Dim streamw As StreamWriter
    Dim streamr As StreamReader
    Dim client As New TcpClient
    Dim strBefehl As String

    Sub Main()

        strBefehl = "FUNCTION Play Input 1\r\n"
        Try
            client.Connect("127.0.0.1", 8099)
            If client.Connected Then
                stream = client.GetStream
                streamw = New StreamWriter(stream)
                streamr = New StreamReader(stream)
                streamw.WriteLine(encode(strBefehl))
                Console.WriteLine(encode(strBefehl))
                Console.WriteLine(strBefehl)

                streamw.Flush()
                Console.WriteLine(Receive)
                client.Close()
                stream.Close()
                streamw.Close()
                streamr.Close()
            Else
                Console.WriteLine("Not connected")
            End If
        Catch
            Console.WriteLine("gar nicht connected")
        End Try

    End Sub

    Function Receive() As String
        Try
            Return streamr.ReadLine
        Catch
            Return ""
        End Try
    End Function

    Function encode(ByVal str As String) As String
        'supply True as the construction parameter to indicate
        'that you wanted the class to emit BOM (Byte Order Mark)
        'NOTE: this BOM value is the indicator of a UTF-8 string
        Dim utf8Encoding As New System.Text.UTF8Encoding(True)
        Dim encodedString() As Byte

        encodedString = utf8Encoding.GetBytes(str)

        Return utf8Encoding.GetString(encodedString)
    End Function
 
End Module


and I got an answer from vMix:

FUNCTION Play Input 1\r\n
FUNCTION Play Input 1\r\n
VERSION OK 26.0.0.40

but the video in 1 did not start

Thank you

Martin
dmwkr  
#6 Posted : Monday, March 27, 2023 6:09:05 PM(UTC)
dmwkr

Rank: Advanced Member

Groups: Registered
Joined: 2/23/2019(UTC)
Posts: 508

Thanks: 62 times
Was thanked: 118 time(s) in 107 post(s)
Originally Posted by: MDB Go to Quoted Post

From the user guide I took: Example Request: FUNCTION PreviewInput Input=5\r\n
and changed it to FUNCTION Play Input 1\r\n


Shouldn't it be "FUNCTION Play Input=1\r\n" then?
MDB  
#7 Posted : Monday, March 27, 2023 8:19:26 PM(UTC)
MDB

Rank: Newbie

Groups: Registered
Joined: 7/6/2021(UTC)
Posts: 7
Man
Germany
Location: Münster

Oh yes, you are right (it was too late)
I will give it a try

Thank you
MDB  
#8 Posted : Tuesday, March 28, 2023 6:39:51 PM(UTC)
MDB

Rank: Newbie

Groups: Registered
Joined: 7/6/2021(UTC)
Posts: 7
Man
Germany
Location: Münster

I tried "FUNCTION Play Input=1\r\n"
and "FUNCTION=Play Input=1\r\n"
and also "FUNCTION PreviewInput Input=1\r\n"
without success
(http://http://127.0.0.1:8088/API/?Function=Play&Input=1 works)

Shows this line "VERSION OK 26.0.0.40" that a connection to VMix was established?
MDB  
#9 Posted : Tuesday, March 28, 2023 7:24:02 PM(UTC)
MDB

Rank: Newbie

Groups: Registered
Joined: 7/6/2021(UTC)
Posts: 7
Man
Germany
Location: Münster

Finally I succeded to start the video in input 1 with:
strBefehl = "FUNCTION Play Input=1" & vbCrLf
Users browsing this topic
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.