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

CG ADD play-on-load problem? #38

Open
SaintFlipper opened this issue Feb 28, 2020 · 3 comments
Open

CG ADD play-on-load problem? #38

SaintFlipper opened this issue Feb 28, 2020 · 3 comments

Comments

@SaintFlipper
Copy link

We're using HTML templates with CasparCG and trying to pre-load and set parameters (CG UPDATE) on a template before showing it.

The AMCP page says of CG ADD "Prepares a template for displaying. It won't show until you call CG PLAY (unless you supply the play-on-load flag, 1 for true)". However we're finding that

  1. the play-on-load parameter is mandatory, and
  2. although supplying play-on-load=0 means that the Javascript play() function isn't called, the template is shown immediately.

This is on version 2.0.7.e9fc25a Stable

VERSION
201 VERSION OK
2.0.7.e9fc25a Stable

Calling CG ADD without play-on-load:

CG 1-9999 ADD 0 html/slates/LIVE
402 CG ERROR

but with play-on-load=0:

CG 1-9999 ADD 0 html/slates/LIVE 0
202 CG OK

At this point the template has already been shown.

Has the meaning of play-on-load changed in v2.0.7 or is this a bug? Is there another way to pre-load and configure an HTML template before showing it?

@mint-dewit
Copy link
Member

CG ADD without the play-on-load flag is like a LOAD command for media. It will show the first frame of the video but not start playing it yet. For templates it will load and display the HTML page but not call the play function.

Some users hide the HTML body until play is called, achieving a similar effect to a LOADBG command except that nothing else can be displayed on that layer.

@hreinnbeck
Copy link

Just to clarify:

CG 1-1 ADD 1 TEMPLATE [data]
will execute update() and play()

CG 1-1 ADD 1 TEMPLATE 0 [data]
will only execute update()

You either have something displaying before the play() call or you are doing something in update() that's displaying.

You can test it by setting body{opacity:0} in CSS and then in play() you can call document.getElementsByTagName("BODY")[0].style.opacity=1;

@SaintFlipper
Copy link
Author

Thank you @baltedewit and @hreinnbeck. As you say we can hide the page in some way such as setting opacity=0 until play() is called, and I will do that. I guess the Wiki statement that "it won't show until you call CG PLAY" is really only true if the template contains no static content whereas in our case we have a static background image and logo, and play() was being used to dynamically update the page and start an animation. Nevertheless as you point out we can make play() change the page visibility too.

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

No branches or pull requests

3 participants