casparcg-connection: Node.js Javascript library

#1
SuperFly.tv presents to the community its first Open Source library: casparcg-connection. The CasparCG project has been a corner stone to our company, and we want to contribute by giving back to the community, starting with this Node.js library.

We want to help developers build as good solutions as possible, spending most time inventing cool features, not solving the same basic tasks over and over again. A first step is helping Node.js developers connect and control the CasparCG Server in a stable and efficient way.

Github: https://github.com/SuperFlyTV/casparcg-connection
NPM: https://www.npmjs.com/package/casparcg-connection
API docs: https://superflytv.github.io/casparcg-connection/
Wiki (TBA): https://github.com/SuperFlyTV/casparcg-connection/wiki

Highlights
  • TypeScript source code with ES5 or ES6 targets.
  • npm distribution.
  • TypeDoc API documentation.
  • AMCP 2.1 Feature parity.
  • MIT license, can be used commercially.
TBA:
  • Parsing of response data to objects.
  • JSON/XML TemplateData.
  • Jasmine test for connection features.
  • Full Jasmine suite for live-testing all commands with various parameters against CasparCG. This helps detect breaking changes or bug in new CasparCG Server builds.
  • OSC Event parsing.
Jesper Stærkær
Independent Consultant at SuperFly.tv

Status 1

#2
Finally! We’ve spent 10 months on this project, with this Open Source launch in mind all the time.
There’s still a tonne of stuff to implement and do.

IMPORTANT: We do NOT recommend using this library in real productions until Version 1.0. Things might change and break.

But please, try it! Clone it, fork it, test it, break it, criticise it, improve it, spread it. We need feedback, ideas and help.

My priority for development at the moment is:
  • Implement the last few AMCP commands.
  • Better handling of TemplateData and smarter paramters for some commands.
  • Proper handling of responses and parsing return data from Server.
  • More API documentation of critical objects.
  • Instructions, Descriptions and tutorials for the Wiki.
  • Tests for the connection features.
  • Tests for all commands.
  • OSC event parsing.
This library is inspired by the first Node.js library from respectthecode and the original AS3.0 library by Andras from SVT.


The entire SuperFly.tv team will be at IBC 2016 Saturday-Monday. See some of you guys there.
Jesper Stærkær
Independent Consultant at SuperFly.tv

Status 2

#8
A week has gone by, and it is time for some updates.
  • We see quite a lot of traffic, but not much of comments at the time. Please provide feedback to steer our development in the right direction.
  • I guess docs/how-tos is a pressing issue. It's a bit on hold as long as fundamental things still are changing.
  • The great Balte from the forum is developing OSC-implementation at full speed! It is super cool to have a contributor, and Balte does a killer implementation. Thanks.
  • At the moment I'm working on parsing response data and handling chained commands (using promises). It will be really powerful for querying state etc.
Jesper Stærkær
Independent Consultant at SuperFly.tv

Re: License changed

#9
casparcg-connection has changed license from GPL-3.0 in version 0.12.1 to MIT in version 0.13.0

What
The project is still fully open-sourced, but we have changed from a Copyleft license to a Permissive license. In short: you can now use the project without any restrictions, even commercially and bundled together with closed-sourced projects.

Why
We strongly believe that a Permissive license is the best fit for this kind of library. It should be allowed to freely use this library in any kind of projects and environments. That freedom will help kickstart new CasparCG-based projects, and that's the ultimate end-goal. It makes sense to license CasparCG Server under GPL, as it is distributed and used as a standalone product by the end users. However, a library such as this project, needs to be able to tie into and co-exist in various environments, even closed-sourced ones. Therefore it needs to be licensed freely, and we think all will benefit from this.

How
- All code up until 0.12.1 is still GPL-3.0.
- All existing history, releases and distributions remain as they are.
- From 0.13.0 the Master branch and all following releases and distributions will be MIT.
Jesper Stærkær
Independent Consultant at SuperFly.tv

Status 3

#10
Config parsing!

- Parse config from INFO CONFIG.
- Export the CasparCGConfig-object to XML
- Cross-convert between 2.0.7 and 2.1.0 configurations, with 100% compability and fallbacks.
- Create new CasparCG configurations with CasparCGConfig

State promises
- casparcg-connection can automatically (configurable) query the server on its version upon (re)connection, available on the public serverVersion property.
- A highlevel INFO PATHS-object will be lazy-cached and is exposed as a public promise.
- A highlevel INFO CONFIG-object will be lazy-cached and is exposed as a public promise.
Jesper Stærkær
Independent Consultant at SuperFly.tv

Channel format parsing

#11
Channel format parsing

Sending an INFO command now returns channel format information like this

Code: Select all

[
    {
        "channel": 1,
        "channelRate": 50,
        "format": "1080i5000",
        "frameRate": 25,
        "interlaced": true
    },
    {
        "channel": 2,
        "channelRate": 50,
        "format": "pal",
        "frameRate": 25,
        "interlaced": true
    },
    {
        "channel": 3,
        "channelRate": 59.94005994005994,
        "format": "ntsc",
        "frameRate": 29.97002997002997,
        "interlaced": true
    },
    {
        "channel": 4,
        "channelRate": 59.94005994005994,
        "format": "1080i5994",
        "frameRate": 29.97002997002997,
        "interlaced": true
    },
    {
        "channel": 5,
        "channelRate": 29.97,
        "format": "1080p2997",
        "frameRate": 29.97,
        "interlaced": false
    },
    {
        "channel": 6,
        "channelRate": 50,
        "format": "1080p5000",
        "frameRate": 50,
        "interlaced": false
    },
    {
        "channel": 7,
        "channelRate": 25,
        "format": "1080p2500",
        "frameRate": 25,
        "interlaced": false
    },
    {
        "channel": 8,
        "channelRate": 23.98,
        "format": "1080p2398",
        "frameRate": 23.98,
        "interlaced": false
    }
]
Jesper Stærkær
Independent Consultant at SuperFly.tv

Re: CasparCG-Connection: Node.js Javascript library

#12
Hi !
First thank you for sharing this library, it's really well made and very cool. But I have a little question, when using cgUpdate, it seems that i could pass an object as templateData, but when I pass an object as key values pairs, it just send plain JSON to CasparCG. I thought that the library would parse it to XML for CasparCG, but it doesn't. I'm probably missing something, like the fact that maybe it is the flash scene role to interpret the JSON, I don't know...

Re: CasparCG-Connection: Node.js Javascript library

#19
Jesper Stærkær wrote:Electron is a good starting point!
Jesper, what do you think about giving us one minimal working example of such universal Electron client? I've put such thing (in C#) on GitHub six months ago:
https://github.com/itodorovic/CasparCG-Client-Example
Something like that, nothing fancy, just a minimal working example with Electron using casparcg-connection, so we can be sure best practices are used, and we can all latter build on that.

It would be great if you find time to write that code.

Re: CasparCG-Connection: Node.js Javascript library

#21
Yup, development is continuing, but it has be quiet for a few months. I have a lot of new features in the issue list to be implemented. Perhaps the most exciting the one regarding asynchronous queueing.

I also want to refactor and split the library in two. This will introduce breaking changes, and I am considering developing this new version as the "next" branch, releasing as 1.0, and aiming to include proper documentation this time...
Jesper Stærkær
Independent Consultant at SuperFly.tv

Re: casparcg-connection: Node.js Javascript library

#25
@silid, sorry, I hav been away from the forum for some months, and somehow not receiving email notifications after the upgrade.

CasparCG Server 2.1 has a log-socket (standard 3250). It will show the same info that rolls in the console window, depending on log level. Important: this is not equal to what goes into the log itself. I haven't seen what's being logged for thumbnail creation.

This library could very well have a functionality to listen for log socket and report given events. I would appreciate if you raised an issue for this at Github!
Jesper Stærkær
Independent Consultant at SuperFly.tv

Re: casparcg-connection: Node.js Javascript library

#26
Jesper Stærkær wrote:
11 Jan 2018, 11:44
@silid, sorry, I hav been away from the forum for some months, and somehow not receiving email notifications after the upgrade.

Sometimes it worked and sometimes it didn't. However, I have fixed this once for all and should work for everyone from now on! Please let me know if you experience those issues again.

Best regards,
Armin
Armin Hafizovic
CasparCG Client Lead developer at SVT