Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for comments on JS integration #1

Open
hreinnbeck opened this issue Jan 1, 2020 · 0 comments
Open

Request for comments on JS integration #1

hreinnbeck opened this issue Jan 1, 2020 · 0 comments

Comments

@hreinnbeck
Copy link
Owner

I'm finishing up the JS integration for CEF with CasparCG and am looking for input on naming.

These are the currently available objects and methods.

Primary object: window.casparg

window.casparcg.sendOSC('address','value')
Will send out one monitor/OSC message like: /channel/1/stage/10/html/address value
Constant output is possible with requestAnimationFrame
Perhaps better named monitorOut, since OSC is just one of the outputs for monitor

window.casparcg.setState('string')
Will set a string to be output via monitor/OSC (constantly) and INFO.
OSC like: /channel/1/stage/10/html/state VALUE
Best to use an object for state in the template and then casparcg.setState(JSON.stringify(object))

window.casparcg.context
String: "CG" or "LOAD"
If the templated was loaded with CG or LOADBG/LOAD/PLAY ("LOAD")

window.casparcg.framerate
Channel framerate as int

window.casparcg.interlaced
Channel is interlaced as bool

window.casparcg.format
Returns string value for channel format, like "1080p5000"

window.casparcg.height
Channels height as int

window.casparcg.width
Channels width as int

window.casparcg.channel
Templates initial channel as int
Will not update with SWAP etc.

window.casparcg.layer
Templates initial layer as int
Will not update with SWAP etc.

window.casparcg.fullversion
CasparCG full version string

window.casparcg.version
Object with CasparCG version as "name", "general", "major", "minor", "tag", "revision" and "hash"

window.casparcg.paths
Object with configured paths as "initial" (path to folder with casparcg.exe)
and relative or absolute if configured as such paths: "media", "log", "data", "template", "thumbnail", "font"

window.casparcg.config
CasparCG's config file as JSON

window.casparcg.enableLog(true)
Toggle emitting log line events
Might be disabled if we need to use log lines for AMCP responses

window.casparcg.enableMonitor(true)
NOT IMPLEMENTED YET
Toggle emitting monitor/OSC events

window.casparg.amcp('PLAY 1-10 RED') or possibly window.casparg.amcp('PLAY 1-10 RED', callback)
NOT IMPLEMENTED YET
Performs an AMCP call, will likely not return.
Return might be provided through a callback or it could use REQ/RES ID's and parse response out of LOG lines

window.resizeTo(width,height)
Resizes the template

window.moveTo(x,y)
Only if the template is not at the channel width/height.
Moves the template rendering area within the channels dimensions.
E.g. window.resizeTo(1920,20); window.moveTo(0,1060) will just render 1920x20px at the bottom of a 1080 channel


From my tests it seems to be most performant to provide our own event emitter instead of using built-in custom events.

Listening to events would be:
window.casparcgEvent.on(eventName, callback)

E.g:
window.casparcgEvent.on('log', callback)
window.casparcgEvent.on('monitor', callback)

The custom event emitter might be enhanced to do some filtering on monitor addresses, e.g. window.casparcgEvent.on('/channel/1/stage/9',callback)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant