Identify CasparCG from HTML page

Hi Forum!

I want to use JavaScript in my webpage to find out if it is rendered in CasparCG. This is for analytics purposes.

In OBS I can simply check if window.obsstudio exists. Does anybody know if there is something similar in CasparCG?

In this thread here this topic came up and the suggestion was to check for

if (screen.colorDepth == 0) {
}

but I don’t think that this will be unique to CasparCG. Does anybody know a more reliable way to detect CasparCG from JavaScript?

best regards,
Hubert

CasparCG will always call for update(). You can set a variable in there that CasparCG is involved.
Well, only if it’s added as a template :thinking:

1 Like
if(window.caspar || window.casparcg || window.tickAnimations) {
// Checking for tickAnimations is for older CCG versions since it injected JS for rAF. caspar exists in most and window.casparcg exists in NRK
	console.log('Running in CCG');
}
2 Likes

This is exactly what I need!

Thanks a lot!

Hubert

I Again checked and found this works.

Hi Vimlesh!

I will also give that a try and test it.

best regards,
Hubert

1 Like