Cinema8 creative studio allows you to develop video interactions without writing code with drag-and-drop tools, You can still create variables in the video, fill these variables from integrations or widgets you have developed, and build algorithms over these variables..
Variables are the main data representers within the Cinema8 environment. You can share data with variables between widgets , interactive elements, and projects.
Use variables to decide what action to trigger with conditional actions, visualize variable values, and set and get variables inside javascript API and widgets.
Creating Variables
There are many points where you can create a new variable or edit an existing one ;
Triggering Action within the Studio
-Using onClick, onStart, and OnEnd Action Lists of any widgets "Add Variable" Method
-Using questions add a variable with the question name by default
-Programatically Using js API or widget API
-Using custom server-side webhooks, every return parameter will be accessible as variables within the video.
Variables are not sticky between projects (Interactive Videos) by Default, Selecting the "Copy between projects" checkbox makes the variable sticky between projects.
Every question widget in the creative studio adds a variable to the video context with its defined name. The answers of the users are stored within this variable.
Also if a user is authenticated while watching the video, the video runtime has a pre-defined variable with the name "authenticatedUser".
You can access this data within any text property or HTML element.
Access authenticatedUser within HTML elements.
${authenticatedUser.username!DEFAULT_VALUE}
${authenticatedUser.name!DEFAULT_VALUE}
${authenticatedUser.surname!DEFAULT_VALUE}
Access authenticatedUser within js code.
1- Within Creative Studio every element triggers onStart, onEnd, and OnClick functions, these functions have a standard action list,
The "Set Variable" action in this action list can create a new variable or edit an existing variable.
Figure-1 triggers two actions on the onClick function, first action sets the variable value ;
- score = 10
Second action adds "5" points to score
This syntax works in all text properties of interactive elements (HTML widget , and widget library)
Figure-1
Adding variables within cinema8 creative studio