Newbie Question: ClipPlayout with .net

Hi to all in this forum,

I am Ingo and I’ relatively new to CasparCG.
So my first idea was to program a small app that communicates with the server (2.2.2) that’s running on another workstation and to play out a clip.
I’m using Visual Studio 2019 / Visual Basic and the libdotnet from github.

I achieved getting a connection the server so far.
Now I’d like to ask the server for the mediafiles it has (MediaScanner is running).
While .RefreshDatalist is working and raises the updated-event whenever called the .RefreshMedifiles command does not.
I can see that CLS command is sent to the server but do not get either the .updatedMediafiles event or any medialist back.
VS Debugger shows “Ausnahme ausgelöst: “System.FormatException” in mscorlib.dll” when .RefreshMediafiles is called.
Has anybody encountered similar problems? Could anybody help?

Thanks a lot.

Cheers
Ingo

Strangely the server writes “Sent more than 512 bytes to…”
Could that be the reason?

Ingo

Hi Ingo, do you have source code of the libdotnet library, so that you can debug into it? If not, I would try that. The format exception locks like some incompatibilities with the German language settings while parsing some server responses. But without trapping the error in the library you will not find out.

Hi didikunz,

nice to hear from you (again).
I think we once met in the RTX Inscriber forum years ago…

I have the library downloaded from github and compiled it myself using VS2010.
I will have a look into it. Thanks for the advice.

Ingo

Libdotnet don’t play nice with CCG 2.2+ AFAIK

Hi rrebuffo,

Thanks for your answer.
Do you suggest to use an older version such as 2.0.7 or is there a better / newer .net library for 2.2. version?

Ingo

2.0.7 for playing out media is just fine and is very stable. Flash templates work fine too.
For HTML templates I would suggest server 2.3. (latest build is very stable and way faster than 2.2)

There’s some libraries that were updated to work with 2.2+ versions:
@rom1 has a very good .net library compatible with .net core.
I also made some modifications to the libdotnet but I find it somewhat limiting.

Thanks rrebuffo.
I meanwhile testet 2.1.0. This version workes fine with my library but I’m not sure about the issue that the media scanner runs within the server.
So I’ll try to use another library.
Thanks so far and have a nice weekend.
Ingo

Although 2.1.0 is very feature rich, it’s very buggy for video playback. Transitions and loadbg messes with audio.

Okay. I’ll leave the 2.1 and switch to 2.3.

Thanks.

Ingo

1 Like

for server version >2.1, in my vb.net client i use following code to get a tree-view of folder structure of media folder.

 If ServerVersion > 2.1 Then
                Dim webClient As New System.Net.WebClient
                Dim result As String = webClient.DownloadString("http://" & frmmediaplayer.cmbhost.Text & ":8000/cls")
                Dim bb() = Split(result, vbNewLine)
                ReDim aa(bb.Count)
                For iclips = 0 To bb.Count - 1
                    Dim foldername As String = ""
                    Dim clipname As String = Replace(Replace(Split(bb(iclips), "  ")(0), "\", "/"), """", "")
                    foldername = Mid(clipname, 1, Len(clipname) - Len(Split(clipname, "/").Last) - 1)
                    aa(iclips) = "Clips\" & Replace(foldername, "/", "\")
                Next
            End If

Already discussed here.https://casparcgforum.org/t/template-from-svt-caspar-dll/249/5?u=vimlesh1975

1 Like

Try 2.1 NRK that is the best of both worlds.

1 Like

Hi all,

thanks for the suggestions.
I didn’t manage to get it going either with the StarDust lib or the original libdotnet so far.
But using rrebuffos lib with his modifications works. Thanks rrebuffo.
I will have a closer look on the StarDust lib because of its possibilities but for the moment rrebuffos lib works fine.

Ingo

Hi rrebuffo,

I’m currently working with your library. Thanks for that.

But I was wondering when the “ServerResponded” event is thrown. Whatever I try to do it seems the event ist never triggered.
What is the pupose of that event?

Thanks.

Ingo

That’s a fallback event mainly.
When the server sends back data you requested, many events handle the response, e.g. OnVersion, OnUpdatedMediaFiles, etc.
Some commands are not included so the OnServerResponded call will fire with the command, subcommand and data so you can handle them yourself.
INFO CONFIG, INFO SYSTEM and INFO PATHS are good examples.

These are the Events I normally use:

CasparDevice.UpdatedVersion
CasparDevice.ConnectionStatusChanged
CasparDevice.ServerResponded
CasparDevice.UpdatedMediafiles
CasparDevice.UpdatedChannels
CasparDevice.ThumbnailRetrieved

Thanks rrebuffo,

I understand.

Ingo

Privacy Policy   Terms of Service