Using The SDK
The Sandboxed iFrame
Your HTML code is an iframe srcdoc which is sandboxed preventing the code inside from navigating the top frame or breaking out of the sandbox. You must code appropriately as certain things will be prohibited for app stability and security reasons such as navigating the top (parent) frame. The sandbox has the following permissions: allow-scripts, allow-same-origin, allow-forms. All other permissions are prohibited.
SDK is Automatically Injected
The TelemetryTV SDK is automatically injected within the Webapp/Overlay iframe and available for you to use. It will take some time however to receive all the properties from its parent so you will need to react to a callback in order to access the properties and do the work that any javascript you include requires.
Get Started With The TelemetryTV SDK
In order to use the TelemetryTV SDK, you must add a callback function to the window.onloadTelemetryTV
property as follows:
window.onloadTelemetryTV = function (ttv) {
console.log('SDK Loaded. Using Playlist: ', ttv.playlist.name);
// Put your codes here
// ...
};
And put all your reactive code within this single callback.
Use Only One Onload Callback
You must have only ONE
onloadTelemetryTV
callback.
The window.onloadTelemetryTV
callback provides a quick access to the window.telemetryTV
object which all related objects like pages, playlists, and device are part of it.
window.onloadTelemetryTV = function (ttv) {
// The `ttv` is the quick access to the `window.telemetryTV` object
console.log('Current page name:', ttv.page.name);
console.log('Current playlist name:', ttv.playlist.name);
};
Updated about 2 months ago