Admira API HTML5 content
Admira API content HTML5 is the service available to be able to communicate from an HTML content to the Admira player via Javascript. The basic functions of said API are described below.
In order to use the functionalities of Admira API Content HTML5, it is necessary to have the script, provided by Admira.
Once added as an attachment and included in the main HTML, it can be invoked as follows:
<script>
var api_obj = null;
function on_load(){
api_obj = new admira_api_content();
api_obj.onReady = function(){
console.log(«Ready !»);
};
api_obj.onStart = function(){
console.log(«Start !»);
};
}
</script>
<body onLoad=”on_load();”>
…Events
The basic API Content events are explained here.
onReady: occurs when the player has successfully preloaded the HTML content, that is, the HTML has been loaded into the iFrame. At this point the iFrame is still DISPLAY:NONE
onStart: occurs when the player puts the content in “PLAY”. Any animation or rendering of elements should start here. At this point the iFrame is still in DISPLAY:INLINE
Features
API content also allows you to send messages to the HTML5 player to indicate different actions to perform:
API_DURATION: Change the duration of the content being played
API_FINISH: Ends the content being played
API_CONDITION: Write a condition to be read later by the player with the capabilities of Conditional Playlist and Conditional Triggers
API_WRITE_FILE: Allows writing text data to a file locally
API_READ_FILE: Allows you to read a local text file
Application version prior to z19.05.30
Application version equal to or later than z19.05.30
Examples of functions
→ It will change the duration, where 30 is the number of seconds from the time of the API call.
→ It will end the content immediately.
→ It will write the value of the condition for “Internet Connected”.
→ Will write “Hello World!” to ./content/hello.txt
→ It will read ./content/hello.txt and send the result to the callback : onFileReadComplete
Last updated
Was this helpful?