screentinker/tizen/index.html
ScreenTinker d018cb24a3 Tizen player: wire up Samsung B2B fleet control (#125)
Brings device:command (reboot / screen_off / screen_on / shutdown / update /
launch) to the Tizen player, at parity with the Android player. Previously app.js
only handled device:reload and device:command did nothing on SSSP panels.

- NEW tizen/js/device-control.js: self-contained IIFE (window.STDeviceControl =
  { run, capabilities, backend }). Feature-detects two Samsung surfaces newest-first
  — webapis.systemcontrol.* (Tizen 6.5/7, synchronous/throws) then
  b2bapis.b2bcontrol.* (SSSP/Tizen 4, async onSuccess/onError) — and normalises both
  to Promises, re-probing each call since the APIs can be injected late. run() never
  rejects; it resolves a uniform { ok, supported, action, note, reload }. Panel power
  tries setPanelMute (mute ON = backlight OFF) then falls back to setDisplayPanel /
  setPanelStatus before declaring unsupported. shutdown is honest: SSSP web API has
  no true power-off, so it mutes the panel and says so. update/reload resolve
  reload:true.
- tizen/js/app.js: keep device:reload; add a device:command handler that calls
  STDeviceControl.run and reports the outcome via reportCmd (device:log tag=command,
  which surfaces as dashboard:device-log, plus a structured device:command-result),
  reloading ~1.2s later when result.reload so the log reaches the server first.
  reportCapabilities() runs on device:registered so the dashboard sees the backend
  ("none" on web/consumer TV).
- tizen/config.xml: add partner-level b2bcontrol + systemcontrol privileges, with a
  note that they need a Samsung Partner distributor cert and are ignored (not fatal)
  on unsigned/URL-Launcher/web/consumer builds.
- tizen/index.html: load $WEBAPIS/webapis.js + $B2BAPIS/b2bapis.js before the app
  scripts (404 harmlessly off-hardware) and device-control.js just before app.js.
- tizen/README.md: document the mapping table + partner-signing caveat; update the
  "Not yet ported" note now that remote control exists.

Verified: node --check on both JS files; config.xml well-formed (xmllint). Not yet
validated on a real SSSP panel — the control surface only takes effect on a
partner-signed .wgt (backend reports "none" on the dev/URL-Launcher build).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 13:17:50 -05:00

53 lines
2.1 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>ScreenTinker</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<!-- Setup: enter server URL -->
<div id="setup" class="screen">
<div class="card">
<h1>ScreenTinker</h1>
<p class="sub">Digital Signage Player</p>
<label for="serverUrl">Server URL</label>
<input id="serverUrl" type="url" value="https://screentinker.com" autocomplete="off"
autocorrect="off" autocapitalize="off" spellcheck="false">
<button id="connectBtn">Connect</button>
<p id="setupStatus" class="status"></p>
</div>
</div>
<!-- Pairing: show the code -->
<div id="pairing" class="screen hidden">
<div class="card">
<h1>ScreenTinker</h1>
<p class="sub">Pair this display</p>
<div id="pairCode" class="code">------</div>
<p class="hint">Enter this code in your ScreenTinker dashboard<br>(Devices &rarr; Pair a display)</p>
<p id="pairStatus" class="status">Waiting to be paired&hellip;</p>
<button id="resetBtn" class="ghost">Change server</button>
</div>
</div>
<!-- Playback stage -->
<div id="stage" class="screen stage hidden"></div>
<!-- Tiny on-screen status (offline / errors), auto-hides -->
<div id="toast" class="toast hidden"></div>
<!-- #125: Samsung device-API bridges. $WEBAPIS / $B2BAPIS are resolved by the
Tizen platform at runtime; off-hardware (browser / URL Launcher) these 404
harmlessly and the surfaces are simply absent. -->
<script src="$WEBAPIS/webapis/webapis.js"></script>
<script src="$B2BAPIS/b2bapis/b2bapis.js"></script>
<script src="js/socket.io.min.js"></script>
<script src="js/schedule-eval.js"></script>
<script src="js/player.js"></script>
<script src="js/device-control.js"></script>
<script src="js/app.js"></script>
</body>
</html>