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
smudge1977  
#1 Posted : Sunday, September 2, 2018 4:48:24 PM(UTC)
smudge1977

Rank: Advanced Member

Groups: Registered
Joined: 4/3/2014(UTC)
Posts: 58
Location: UK

Thanks: 19 times
Was thanked: 4 time(s) in 1 post(s)
I have written a blend dll and i would like to call a couple of vMix function when things happen.

Essentially i want to open TCP port 8099 and make a function call in blend i guess...

Could smebody share the code i migtht need with the includes

Thanks
desmar  
#2 Posted : Monday, September 3, 2018 3:28:44 AM(UTC)
desmar

Rank: Advanced Member

Groups: Registered
Joined: 8/21/2015(UTC)
Posts: 324
Man
Canada
Location: Cornwall, Ontario, Canada

Thanks: 18 times
Was thanked: 80 time(s) in 60 post(s)
Need to add web browser in code and make it not visible then send api command.

Visual Basic code example:

Add Web browser

<WebView x:Name="WebBrowser" HorizontalAlignment="Stretch" Height="100" Margin="286,868,0,0" VerticalAlignment="Stretch" Width="100" Visibility="Collapsed" d:IsHidden="True" />

Send API command via HTTP (vMix API command is in RED)

Uri is the HTTP command you want to send.

WebBrowser.Navigate(New Uri("http://127.0.0.1:8099/API/?Function=SetText&SelectedIndex=1&Value=Camera%20Preset&Input=1"))

smudge1977 wrote:
I have written a blend dll and i would like to call a couple of vMix function when things happen.

Essentially i want to open TCP port 8099 and make a function call in blend i guess...

Could smebody share the code i migtht need with the includes

Thanks

doggy  
#3 Posted : Monday, September 3, 2018 4:58:44 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 3,358
Belgium
Location: Belgium

Thanks: 191 times
Was thanked: 608 time(s) in 501 post(s)
or directly send httprequest from within your code, no need to open a webbrowser
smudge1977  
#4 Posted : Wednesday, September 5, 2018 1:43:45 PM(UTC)
smudge1977

Rank: Advanced Member

Groups: Registered
Joined: 4/3/2014(UTC)
Posts: 58
Location: UK

Thanks: 19 times
Was thanked: 4 time(s) in 1 post(s)
Here is what is used (not using http as plain text on port 8099 will be faster)

As i say this is running in the compiled DLL from the xaml for a title input. This makes the code a nightmare to debug!
Would even be nice to know where Console.WriteLine outputs stuff....???

This as you can tell was a kind of quick copy paste from a stackexchange page! Need to do the read before the write to get the data that is 'waiting' after you connect to vMix!

Function vMixCall(command As String)
Dim client = New TcpClient()
Try
client.Connect("127.0.0.1", 8099)
Dim networkStream As NetworkStream = client.GetStream()

' Read the NetworkStream into a byte buffer.
'This reads the welcome header fro vMix
Dim bytes(client.ReceiveBufferSize) As Byte
networkStream.Read(bytes, 0, CInt(client.ReceiveBufferSize))


' Output the data received from the host to the console.
Dim returndata As String = Encoding.ASCII.GetString(bytes)
Console.WriteLine(("Host returned: " + returndata))


Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(command + vbCrLf)
networkStream.Write(sendBytes, 0, sendBytes.Length)
Catch ex As Exception

Finally
client.Close()
End Try
'FUNCTION OverlayInput1 Input=2
'PowerRed.Text = "2"
End Function
File Attachment(s):
UserControl1.xaml (6kb) downloaded 52 time(s).
UserControl1.xaml - Copy.vb.txt (6kb) downloaded 47 time(s).

You cannot view/download attachments. Try to login or register.
claudeir  
#5 Posted : Friday, September 7, 2018 2:06:38 PM(UTC)
claudeir

Rank: Member

Groups: Registered
Joined: 2/2/2018(UTC)
Posts: 14
Location: Foz do Iguaçu

Thanks: 4 times
how can I user that?
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.