SDKs
Smart TV SDK
One SDK for Tizen (Samsung), WebOS (LG), Fire TV, Android TV, and tvOS.
Which SDK for which TV platform?
| Platform | Install |
|---|---|
| Samsung Tizen | Web SDK (CDN) |
| LG WebOS | Web SDK (CDN) |
| HbbTV / Vestel | Web SDK (CDN) |
| Android TV / Fire TV | Android SDK |
| Apple tvOS | iOS SDK |
Tizen & WebOS (web-based)
Tizen and WebOS run Chromium under the hood. Drop the Web SDK into yourindex.html:
html
<style="color:#f472b6">script src="https://cdn.tapemetric.com/v1/tapemetric.min.js"></style="color:#f472b6">script>
<style="color:#f472b6">script>
var rd = Tapemetric.init({ apiKey: 'tm_live_...' });
rd.trackPageView();
</style="color:#f472b6">script>The SDK auto-detects the device as tv from UA strings matching:
text
/smart-tv|smarttv|tizen|webos|bravia|hbbtv/iTizen-specific: handle sleep
Tizen fires visibilitychange on screen-off. The SDK flushes queued events via sendBeacon automatically.
WebOS-specific: remote keys
Wire D-pad events to engagement tracking so you know how users navigate your home screen:
javascript
document.addEventListener('keydown', (e) => {
if (e.key === 'ArrowRight') {
rd.track({ eventType: 'browse_tile_focus', properties: { direction: 'right' } });
}
});Android TV / Fire TV
Use the Android SDK. The SDK auto-detectsUI_MODE_TYPE_TELEVISION and sets device_type to tv.
Apple tvOS
Use the iOS SDK — the same package works on tvOS with AVPlayer integration.
Roku (HTTP API)
Roku’s BrightScript runtime has no official Tapemetric SDK. Use the HTTP ingest API directly:
brightscript
sub trackPlayStart(contentId as String)
req = CreateObject("roUrlTransfer")
req.SetUrl("https://ingest.tapemetric.com/v1/ingest/events")
req.AddHeader("X-API-Key", "tm_live_...")
req.AddHeader("Content-Type", "application/json")
body = "{""events"":[{""event_type"":""play_start"",""ts"":""" + FormatJson(CreateObject("roDateTime").AsSeconds()) + """,""anonymous_id"":""" + getAnonId() + """,""session_id"":""" + getSessionId() + """,""content_id"":""" + contentId + """,""content_type"":""film""}]}"
req.AsyncPostFromString(body)
end subFor Roku, always batch events and post every 10 seconds. BrightScript network calls are slow; one-event-per-post will kill your app’s smoothness.
Smart-TV QoS notes
- Bitrate detection on Tizen requires
webapis.avplay.getCurrentStreamInfo(). - WebOS exposes bitrate via the
MediaOptionAPI. - Android TV works the same as Android phones — use ExoPlayer’s
AnalyticsListener.