How find html template finish?

I have a html template with variable length depend on it’s text
I play it in casparcg server and after it finish, I set dispaly of html body none to stop template. But I need to find when the template finish to turn off tally light
Is there any way to I find when the html template finish?

I think this is where OSC comes in. You need a client which gets OSC messages from caspar. There you get information about which template plays and if it does.

You could do this with a Node-Red server . It’s a free automation server to build up quick prototypes with many Interfaces. I could see to post you some example flow to get OSC messages with it.

Ok, got the flow:

in your casparcg config file do this:

  <default-port>6250</default-port> <--  -->
  <predefined-clients> <--  -->
    <predefined-client> <--  -->
      <address></address> <--  -->
      <port>5253</port> <--  -->

got to

install node red on the localhost

in the node red editor import this flow (from the windows clipboard):

[{"id":"614c2e04.7985a","type":"tab","label":"OSC Monitor","disabled":false,"info":""},{"id":"53a87214.55936c","type":"udp in","z":"614c2e04.7985a","name":"","iface":"","port":"5253","ipv":"udp4","multicast":"false","group":"","datatype":"buffer","x":160,"y":480,"wires":[["4dab2e3.3453ad"]]},{"id":"4dab2e3.3453ad","type":"osc","z":"614c2e04.7985a","name":"","path":"/channel/1/","metadata":false,"x":350,"y":480,"wires":[["e7e629c4.9d78d8"]]},{"id":"17e3678.f5e0d99","type":"comment","z":"614c2e04.7985a","name":"Receiving messages on UDP port 5253","info":"","x":210,"y":440,"wires":[]},{"id":"e7e629c4.9d78d8","type":"change","z":"614c2e04.7985a","name":"","rules":[{"t":"delete","p":"raw","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":480,"wires":[["97b57d71.6000f","c828985d.99c098"]]},{"id":"c828985d.99c098","type":"debug","z":"614c2e04.7985a","name":"OSC Auswertung","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":910,"y":580,"wires":[]},{"id":"97b57d71.6000f","type":"function","z":"614c2e04.7985a","name":"","func":"//erst ab 5 Items wird die Message behandelt\n//sonst kommen zuviel Messages durch, die keine wichtige Info besitzen\n\n//per default keine Message weiterleiten\nlet obj = null;\n\n//bei mehr als 5 Items ein false weiterleiten \nif(msg.payload.length>5){\n    obj = {topic:'Layer 1-20', payload: false};\n}\n\n//wenn ausserdem ein File anuf Layer 20 ausspielt, statt false dessen Pfad weiterleiten\nfor (i=0; i<msg.payload.length; i++){\n    if(msg.payload[i].address==\"/channel/1/stage/layer/20/foreground/file/path\"){\n        obj = {topic:'Layer 1-20', payload: msg.payload[i].args};\n    }\n}\nreturn [obj];","outputs":1,"noerr":0,"x":750,"y":480,"wires":[["938bea5f.e270f8"]]},{"id":"ebdafb68.a28858","type":"tcp request","z":"614c2e04.7985a","server":"","port":"5250","out":"sit","splitc":" ","name":"","x":550,"y":320,"wires":[["230fc8bf.9dd188"]]},{"id":"230fc8bf.9dd188","type":"template","z":"614c2e04.7985a","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}}","output":"str","x":760,"y":320,"wires":[["9f3e82b0.386bb"]]},{"id":"9f3e82b0.386bb","type":"debug","z":"614c2e04.7985a","name":"AMCP Antwort","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":940,"y":320,"wires":[]},{"id":"938bea5f.e270f8","type":"rbe","z":"614c2e04.7985a","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":910,"y":480,"wires":[["c828985d.99c098"]]},{"id":"85af9b12.b03b98","type":"inject","z":"614c2e04.7985a","name":"Clear Test Template","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":320,"wires":[["a3ca8ba1.5f12c8"]]},{"id":"ac271d74.5aa6f","type":"inject","z":"614c2e04.7985a","name":"ADD Test Template","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":260,"wires":[["df6cc1ed.e93a"]]},{"id":"df6cc1ed.e93a","type":"function","z":"614c2e04.7985a","name":"","func":"msg.payload = 'CG 1-20 ADD 1 \"TEST/INDEX\" 1 \"<templateData></templateData>\"\\r\\n'\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":260,"wires":[["ebdafb68.a28858"]]},{"id":"a3ca8ba1.5f12c8","type":"function","z":"614c2e04.7985a","name":"","func":"msg.payload = 'CLEAR 1-20\\r\\n';\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":320,"wires":[["ebdafb68.a28858"]]}]

you get the node-red-flow like this:

there you can debug the osc messages.
The flow throws a message everytime a template is played on channel 1 with its path
otherwise it sends false

in Node Red you have the possibility to react on which interface you want (serial, tcp, udp,osc, etc.). There will be a way to control your tally lights by Node Red for shure.

But caspar server don’t know the template finished and if I get info of channel(for example info 1) it says the template is also plaing

If you stop it is still in the channel. If you remove it it isn’t anymore is it?

Then how about open a websocket in your template and send your play and stop reactions to a websocket-Node in Node-Red?

Yes, because when template finished I just set display of template body as none

Yeah, this can be useful but I should find a way to represent to the template JS that in what channel and layer of server is playing

You call window.close() to remove/destroy a template.

I try this but dont work for me on server 2.2
How do you use it?

Sorry I try it again and it didn’t work, Can you explain how you use window.close() please?

After the out animation is finished, you call window.close() in the HTML template. That will destroy the HTML producer and you can find that via OSC.

I’m not sure which versions of CasparCG support this, it would be good to try with the 2.3 Release Candidate (Download from GitHub)

You can add that to the template data, I guess.

Window.close() is JavaScript code?

Yes sir, that‘s right.

Thanks a lot Mr

Sorry, I use it in server 2.3 too and it don’t destroy the template :disappointed:

Your solutions always is helpful
Help me in this too please

I would, if I could. I still do my templates in Flash and there things work a little different.

Looks like window.close() is broken in the most recent RC

Window.close() dont work for me but window.remove() work ok