.net Library - StarDust.CasparCG.net

Thanks for the Library,

wanted to make scheduler like Filler, News on time and rest by day playlist automatically play in playlist randomly.

I am not getting how can i send playlist to casperCG.

any guidance appreciated

Thanks.

i have a custom client written with your lib, connecting to a 2.3.0 LTS server in multiple working just fine.
It’s actually multiple clients and multiple servers and all of them are OK.

1 Like

I have set in flash.template sevral labels, and I am trying to use invoke command to jump from one to another, or to repeate same label sveral times, when i try to play same label, it get played exacly every second time. Is there any command i ned to put like to.rewind playhead od specific position or so? Command i use in C# is

channel.CG.invoke(20, 1, “label”);

For me the command send in this case is

return AmcpTcpParser.SendCommandAndGetStatus($“CG {Channel.ID}-{videoLayer} INVOKE {cgLayer} {method}”); ->
Case you are on channel 1:
CG 1-20 INVOKE 1 label

Is the command correct ? Do you try to do same things with the official client ?

The INVOKE command, used with labels, works like so: Whenever you call invoke the play head jumps to the frame of the label and plays the timeline from there, until there is an frame with a stop(); ActionScript command. So as long as everything is setup that way you can jump in random order.

@didikunz so it’s not a problem of the lib right ?

I don’t think so, but he should confirm.

Hi all,

sorry on late reply, i have done some tests, and it get same result every time. I have sample scene, one square moving from point a to point b, as intro anim. Than on label called “step” i have start of another animation, square moving form point b to point c. Then i have outro animation. When i invoke “step” label first time it gets played. then on second click of same label, playhead only get rewind on beginning of “step” portion of timeline and stop on first frame. I need to send invoke command again and then it gets played, and it remains in pattern. I made a workaround to give next command after invoke, to get anim played properly, every time.

Make the label keyframe only one frame long, make an empty keyframe in the next frame.
It could be that it thinks it’s already in that label.

1 Like

that actually worked :slight_smile: :slight_smile: :slight_smile: and I was already thinking that animate 2019 is now kind of incompatible with this flash “die” event. I still get some weird UIloader issues lately

@Zoxg ok. Can you change of conversation or create a topic if the lib is not in cause :wink:

sorry if I spammed thread a little, I just added remark to don’t know was it lib or something else :wink:

Hello,

Is there a code snippet how to get Thumbnail from remote server with StarDust, so that it can be displayed in Windows Forms app? I’m trying also with Svt.Caspar but did not have many luck with this.

Regards.

Thumbnail are sent as 64bit string. You can easily convert this string to image.

From Stackoverflow

public Image LoadImage()
{
    //data:image/gif;base64,
    //this image is a single pixel (black)
    byte[] bytes = Convert.FromBase64String("R0lGODlhAQABAIAAAAAAAAAAACH5BAAAAAAALAAAAAABAAEAAAICTAEAOw==");

    Image image;
    using (MemoryStream ms = new MemoryStream(bytes))
    {
        image = Image.FromStream(ms);
    }

    return image;
}
1 Like

For this I am using a code like below-


    Private Sub MakeThumbnailForServer23ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MakeThumbnailForServer23ToolStripMenuItem.Click
        On Error Resume Next
       Dim aa() As String
        Dim alreadyRunning As Integer
        Dim dd As New Process
        If ServerVersion > 2.1 Then
            If IfRunning("scanner") = False Then
                alreadyRunning = 5
                dd.StartInfo.FileName = initialpath & "\scanner.exe" '"C:\Users\vimlesh\Downloads\casparcg-server-050620\scanner.exe"
                dd.StartInfo.WorkingDirectory = initialpath ' "C:\Users\vimlesh\Downloads\casparcg-server-050620\"
                dd.Start()
                Threading.Thread.Sleep(5000)
            Else
                alreadyRunning = 2
            End If


            Dim webClient As New System.Net.WebClient
            Dim result As String = webClient.DownloadString("http://" & cmbhost.Text & ":8000/thumbnail")
            Dim bb() = Split(result, vbNewLine)
            ReDim aa(bb.Count)

            For iclips = 0 To bb.Count - 3
                Dim foldername As String = ""
                Dim clipname As String = Replace(Split(bb(iclips), "  ")(0), "\", "/")
                clipname = Split(clipname, """" & " ")(0)
                clipname = Replace(clipname, """", "")
                aa(iclips) = clipname
            Next
            aa = aa.Skip(1).ToArray

            For Each item As String In aa
                'Dim webClient As New System.Net.WebClient
                result = webClient.DownloadString("http://" & cmbhost.Text & ":8000/thumbnail/" & Replace(item, "/", "%2F"))
                bb = Split(result, vbNewLine)
                Dim filename As String = thumbnailsfullpath & "/" & item & ".png"
                Dim fi As New FileInfo(filename)

                Dim path As String = fi.DirectoryName
                If (Not System.IO.Directory.Exists(path)) Then
                    System.IO.Directory.CreateDirectory(path)
                End If
                ss(bb(1)).Save(filename)
            Next
            If alreadyRunning = 5 Then dd.Kill()
        End If
    End Sub
    Function ss(ff As String) As Image
        On Error Resume Next
        Dim gg As Image = Image.FromStream(New MemoryStream(Convert.FromBase64String(ff)))
        Return gg
    End Function

  Function IfRunning(processName As String) As Boolean
        Dim p = Process.GetProcessesByName(processName)
        If p.Count > 0 Then
            Return True
        Else
            Return False
        End If
    End Function

1 Like

Thanks Romain and Vimlesh for detailed replies!

Regards.

This is a lot off effort to get thumbnails, It would be nice to let the scanner automatic created thumnails in a certain directory, like CaparCG did in 2.1 and earlier…

Thanks for this links rom1!

1 Like

Hi everyone. I need some help. I’m a newbie in C#…
Im building application with stardust liberty…my problem is that i cant get OSC to work. I try on demo project too, but i dont get any messages. I have OSC enabled on Caspar server. Can someone please point me in the right direction…
I put this in my code:

using StarDust.CasparCG.net.Connection;
using StarDust.CasparCG.net.AmcpProtocol;
using StarDust.CasparCG.net.OSC;
using Unity;

    static IUnityContainer _container;
    private static readonly bool quit;

    static void ConfigureIOC()
    {
        _container = new UnityContainer();

        _container.RegisterInstance<IServerConnection>(new StarDust.CasparCG.net.Connection.ServerConnection(new CasparCGConnectionSettings("192.168.1.38")));
        _container.RegisterType<IAMCPTcpParser, AmcpTCPParser>();
        _container.RegisterType<IOscListener, OscListener>();

    }

    private static async void OscStart()
    {
        var oscListener = _container.Resolve<IOscListener>();
        //oscListener.RegisterMethod("/channel/1/stage/layer/1/file/time");
        oscListener.AddToAddressBlackList("/channel/[0-9]/output/consume_time");
        oscListener.AddToAddressBlackList("/channel/1/stage/layer/1/profiler/time");

        oscListener.OscMessageReceived += OscListener_OscMessageReceived;
        oscListener.StartListening("192.168.1.38", 6250);
        //Console.WriteLine("Osc listener strarted");
        System.Diagnostics.Debug.WriteLine("Osc listener strarted");
    }

    private static void OscListener_OscMessageReceived(object sender, OscMessageEventArgs e)
    {
        //Console.WriteLine($"Osc message received: {e.OscPacket.ToString()}");
        System.Diagnostics.Debug.WriteLine($"Osc message received: {e.OscPacket.ToString()}");
    }

Thank you

I’ve been looking through tutorias on how to code something in c# to send messages to casparCG because i want to use Unity to make the client. I code in unity in c# but dont know how to get something like your project imported into my unity c# solution. Do you know how to do something like that?

Never mind. not sure is the using Unity is for unity the game engine or something else. Figured out how to use it for my needs