Introduction
This documentation provides an overview of the JavaScript API calls available for fetching specific
data stored on the QL Player device.
We will explain and comment on the various player function calls that are handled by the Player JavaScript API
1. The source code :
<html>
<head>
<script>
// Get Feeds from SDK
setTimeout(function(){
var feeds = window.parent.PlayerSDK.getXMLFeeds();
var result = '';
for (var i = 0; feeds && i < feeds.length; i++) {
result += feeds[i].Name + ';';
}
document.getElementById('feeds').innerHTML = '<h1>List of feeds</h1><p>' + result + '</p>';
}, 1000);
// Get Feeds and Display Feed Details
setTimeout(function(){
var feeds = window.parent.PlayerSDK.getXMLFeeds();
var firstFeed = feeds && feeds.length > 0 ? feeds[0] : {};
var result = '';
for (var i = 0; firstFeed && firstFeed.Rows && i < firstFeed.Rows.length; i++) {
for (var key in firstFeed.Rows[i]) {
result += '<p>' + firstFeed.Rows[i][key] + '</p>';
}
}
document.getElementById('feeds-details').innerHTML = '<h1>First feed details</h1><p>' + result + '</p>';
}, 1000);
// Get Tags from SDK
setTimeout(function(){
var tags = window.parent.PlayerSDK.getTagsPlayer();
var result = '';
for (var i = 0; tags && i < tags.length; i++) {
result += tags[i].Name + ';';
}
document.getElementById('tags').innerHTML = '<h1>List of tags</h1><p>' + result + '</p>';
}, 1000);
// Get Player Data from SDK
setTimeout(function(){
var playerData = window.parent.PlayerSDK.getPlayerData();
var result = '';
for (var key in playerData) {
result += key + ': ' + playerData[key] + '; ';
}
document.getElementById('player-properties').innerHTML = '<h1>List of Player properties</h1><p>' + result + '</p>';
}, 1000);
// Get Player Variables from SDK
setTimeout(function(){
var variables = window.parent.PlayerSDK.getPlayerVariables();
var result = '';
for (var i = 0; variables && i < variables.length; i++) {
result += variables[i].Index + ": " + variables[i].Key + ": " + variables[i].Value + '; ';
}
document.getElementById('player-variables').innerHTML = '<h1>List of Player Variables</h1><p>' + result + '</p>';
}, 1000);
</script>
</head>
<body>
<div id='player-properties'></div>
<div id='tags'></div>
<div id='player-variables'></div>
<div id='feeds'></div>
<div id='feeds-details'></div>
</body>
</html>
2. Retrieving feed functions:
2.1 getXMLFeeds():
Description: Retrieves the list of feeds stored locally.
Returns: An array of feed objects with each object containing the Name of the feed.
Example Usage:
var feeds = window.parent.PlayerSDK.getXMLFeeds();
2.2 Display Feed Names:
Description: Displays the names of each feed retrieved from the stored data.
Example Usage:
var result = '';
for (var i = 0; feeds && i < feeds.length; i++) {
result += feeds[i].Name + ';';
}
document.getElementById('feeds').innerHTML = '<h1>List of feeds</h1><p>' + result + '</p>';
2.3 Retrieve Feed Details:
Description: Retrieves and displays the details of the first feed retrieved from the stored data.
Example Usage:
var result = '';
for (var i = 0; firstFeed && firstFeed.Rows && i < firstFeed.Rows.length; i++) {
for(var key in firstFeed.Rows[i]){
result += '<p>' + firstFeed.Rows[i][key] + '</p>';
}
}
document.getElementById('feeds-details').innerHTML = '<h1>First feed details</h1><p>' + result + '</p>';\
3. Retrieving Tags functions:
3.1 getTagsPlayer():
Description: Retrieves the list of tags assigned to the player device.
Returns: An array of tag objects with each object containing the Name of the tag.
Example Usage:
var tags = window.parent.PlayerSDK.getTagsPlayer();
3.2 Display Tag Names:
Description: Displays the names of each tag retrieved from the stored data.
Example Usage:
var result = '';
for (var i = 0; tags && i < tags.length; i++) {
result += tags[i].Name + ';';
}
document.getElementById('tags').innerHTML = '<h1>List of tags</h1><p>' + result + '</p>';
4. Retrieving Player properties functions:
4.1 getPlayerData():
Description: Retrieves all the information about the player device, including:
serialNumber, version, mediaPlayerSerial, architecture, deviceName, firmwareVersion, model, osVersion, processor,
macAddress, ip, resolution { width: SystemUtils.getScreenWidth(), height: SystemUtils.getScreenHeight() }, address,
city, company, country, groupName, mobile, name, state, telephone, timeZone, zip.
Returns: A playerData object containing the player properties.
Example Usage:
var playerData = window.parent.PlayerSDK.getPlayerData();
4.2 Display Player Properties:
Description: Displays the names and values of each player property retrieved from the SDK.
Example Usage:
var result = '';
for (var key in playerData) {
result += key + ': ' + playerData[key] + '; ';
}
document.getElementById('player-properties').innerHTML = '<h1>List of Player properties</h1><p>' + result + '</p>';
5. Retrieving Player Variables functions:
5.1 getPlayerVariables():
Description: Retrieves a list of variables assigned to the player device.
Returns: An array of variable objects, each with:
Index (number)
Key (string)
Value (string)
Example Usage:
var variables = window.parent.PlayerSDK.getPlayerVariables();
5.2 Display Player Variable Key/Value Pairs:
Description: Displays the list of variables defined for the player.
Example Usage:
var result = '';
for (var i = 0; variables && i < variables.length; i++) {
result += variables[i].Index + ': ' + variables[i].Key + ': ' + variables[i].Value + '; ';
}
document.getElementById('player-variables').innerHTML = '<h1>List of Player Variables</h1><p>' + result + '</p>';
6. HTML ZIP example to directly upload in the CMS
You can find a complete HTML ZIP file ready to be uploaded to the CMS. This HTML file displays all the information described above in a clear and structured way. It is ideal for debugging or testing purposes.
Download link: Player SDK Overview – Ready for CMS Upload
