Sending XML data over a Socket Connection - CasparCG
Posted: Mon May 20, 2013 3:54 pm
Hi Guys,
Just writing a CasparCG video basketball scoreboard control application with LiveCode... first off I love it..... and I am a convert, easy to use and powerfull...
So... in a nutshell the CasparCG video playout server incorporates a flash player that can update the information in a Flash Template scoreboard on the fly, updating Team 1's Score etc... creating an awesome scoreboard that I can overlay over my videos!
I have successfully connected my application to the CasparCG server and they are talking... I can send basic commands to the server and play my flash template...
My problem is that I need to send xml data to the CasparCG server over the socket... and put into the XML a value from my scoreboard (a LiveCode field... say T1Score for Team 1's Score)
The command I need to send to the Caspar Server is where $$T1Score$$ is the value from my LiveCode field T1Score:
CG 1 UPDATE 1 "<templateData><componentData id=\"t1\"><data id=\"text\" value=\"$$T1Score$$\" /></componentData></templateData>"
My first question is how can I pull the value from T1Score to use in my XML to the server.
My second question is how to send the XML to the server correctly.... I placed the following code as a test into the T1Score field to see if I can send it to the server.
on textchanged
write "CG 1 UPDATE 1 "<templateData><componentData id=\"t1\"><data id=\"text\" value=\"T1Score\" /></componentData></templateData>" & format("\r\n") to socket "localhost:5250"
end textchanged
The code turns red after
write "CG 1 UPDATE 1 "<templateData><componentData id=\
And I get the error:
field "T1Score": compilation error at line 2 (Expression: bad factor) near "><", char 30
Usefull links:
I don't have permission to post URL's but the info is on CasparCG's wiki if you google "CasparCG_2.0_AMCP_Protocol Template_Data" you will find it.
Just writing a CasparCG video basketball scoreboard control application with LiveCode... first off I love it..... and I am a convert, easy to use and powerfull...
So... in a nutshell the CasparCG video playout server incorporates a flash player that can update the information in a Flash Template scoreboard on the fly, updating Team 1's Score etc... creating an awesome scoreboard that I can overlay over my videos!
I have successfully connected my application to the CasparCG server and they are talking... I can send basic commands to the server and play my flash template...
My problem is that I need to send xml data to the CasparCG server over the socket... and put into the XML a value from my scoreboard (a LiveCode field... say T1Score for Team 1's Score)
The command I need to send to the Caspar Server is where $$T1Score$$ is the value from my LiveCode field T1Score:
CG 1 UPDATE 1 "<templateData><componentData id=\"t1\"><data id=\"text\" value=\"$$T1Score$$\" /></componentData></templateData>"
My first question is how can I pull the value from T1Score to use in my XML to the server.
My second question is how to send the XML to the server correctly.... I placed the following code as a test into the T1Score field to see if I can send it to the server.
on textchanged
write "CG 1 UPDATE 1 "<templateData><componentData id=\"t1\"><data id=\"text\" value=\"T1Score\" /></componentData></templateData>" & format("\r\n") to socket "localhost:5250"
end textchanged
The code turns red after
write "CG 1 UPDATE 1 "<templateData><componentData id=\
And I get the error:
field "T1Score": compilation error at line 2 (Expression: bad factor) near "><", char 30
Usefull links:
I don't have permission to post URL's but the info is on CasparCG's wiki if you google "CasparCG_2.0_AMCP_Protocol Template_Data" you will find it.