Skip to content
developers
Developer home

VISWOO DOCUMENTATION

Screen view

The view that runs on TVs, tablets and kiosks; ES5, single file, sandbox, touch, placement and offline.

The screen view (player.entry) runs inside the player in a sandboxed frame. The oldest player in the field is LG webOS 3.x (Chromium 38); the view must open there too.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="viswoo-screen.css" />
</head>
<body>
<div class="vz-screen vz-center">
<h1 class="vz-title" id="title"></h1>
</div>
<script src="viswoo-player.js"></script>
<script src="player.js"></script>
</body>
</html>
// player.js: ES5 only
(function () {
'use strict';
var player = window.Viswoo.player;
player.context().then(function (context) {
document.getElementById('title').textContent = context.settings.title || '';
});
})();

The player downloads the view in one piece and stores it so it can open offline. pack inlines the bridge (viswoo-player.js), the TV kit and local scripts and styles in the package (<script src="x.js">, <link rel="stylesheet" href="x.css" />). The screen and the phone page can therefore share files (e.g. shared/texts.js). Images become data URIs. The view is at most 512 KB.

Not allowed: let, const, arrow functions, template strings, classes, async/await, spread (...), default parameters and trailing commas in calls and definitions. Promise is available. CSS has no variables (var(--x)); set colours directly from JavaScript.

validate and pack parse the view’s scripts as ES5 and report errors with their line. Run Prettier with "trailingComma": "es5" (the templates already do).

The frame opens with allow-scripts only; the view cannot reach the player’s storage or token. No network requests (connect-src 'none'): server work goes through the bridge’s call and the result comes back through the bridge.

The frame may have no size before the context arrives. Draw once window.innerWidth/innerHeight are greater than zero and again on resize. The layout holds in landscape and portrait (context.screen.orientation). Use vmin; the kit leaves a 5% safe area.

context.touch is true when the screen can be touched (as reported by the shell; it may be unverified). Otherwise move interaction to the phone: context.publicUrl is the public page address, which the view draws as a QR code (bundle the QR generator in the package; it cannot be loaded from the network).

Call hold(seconds) so the item does not end while someone is interacting (at most 120 s; calling again renews it). done() moves the player on to the next item.

The view plays in three modes (Manifest): as a playlist item, at intervals (every N minutes for M seconds) or continuously (taking over playback). context.duration is the planned duration. In continuous mode the view stays open for a long time: do not pile up timers or listeners, and do not leak memory.

Offline, the view opens with its last downloaded version and the last settings. call fails with plugin.offline; show a calm message or hide the interaction. The player keeps report counts and sends them when back online.

The panel opens the view in a TV frame in Settings (with unsaved values) and Preview. In preview call is in trial mode: draws do not reduce stock, the code is a sample (ORNEK1) and your server is not called (plugin.preview_unavailable).

Full bridge: Screen bridge.