Android TV
WebToNative's Smart TV Support
WebToNative's Support for TV add-on lets your website publish content to the Android TV home screen: a Watch Next row (the "Continue Watching" row Android TV shows near the top of the launcher, with a progress bar drawn from how far the user got into a video) and your own recommendation channel of programs the user can browse and launch straight into your app.
Your website calls these functions whenever it knows something worth surfacing — e.g. every time playback position updates, or once you've built a catalog of recommended content.
You'll need to import the javascript file in your website before starting from this link.
Platform support: Android only.
Setting Up Smart TV Support
Go to your WebToNative dashboard → Add-ons → Smart TV Support and enable it.
No further credentials are required.
JavaScript API Reference
isSupported
Checks whether Smart TV features are available right now (add-on enabled and running on an Android TV device).
window.WTN.SmartTV.isSupported({
callback: function (response) {
console.log(response.isSupported);
},
});import { isSupported } from "webtonative/SmartTV";
isSupported({
callback: (response) => {
console.log(response.isSupported);
},
});Parameters:
callback
Function
No
Callback function invoked with the response.
Callback Response:
type
String
Always "smartTvIsSupported".
success
Boolean
Always true for this call.
isSupported
Boolean
true if Watch Next / channel calls will do anything on this device.
watchNextUpsert
Adds a new item to the Android TV Watch Next row, or updates one already there (matched by contentId). This is what drives the "Continue Watching" progress bar shown on the card — Android TV computes the progress fraction itself from lastPlaybackPositionMs / durationMs, there's no separate percentage field to send.
The common pattern is to call this periodically while the user watches (e.g. on your video element's timeupdate event, throttled), not just once:
Parameters:
contentId
String
Yes
Stable identifier for this content. Calling again with the same contentId updates the existing card instead of creating a new one.
title
String
Yes
Title shown on the card.
playbackUri
String
Yes
Deep link opened when the user selects the card. Must be https:// — an http:// URL is rejected.
description
String
No
Description text shown for the card.
posterArtUri
String
No
Poster/thumbnail image URL. Must be https:// if provided.
durationMs
Number
No
Total content duration in milliseconds. Defaults to 0. Drives the progress bar together with lastPlaybackPositionMs.
lastPlaybackPositionMs
Number
No
Current playback position in milliseconds. Defaults to 0.
type
String
No
One of "MOVIE", "TV_EPISODE", "CLIP". Defaults to "MOVIE" if omitted or unrecognized.
callback
Function
No
Callback function invoked with the response.
Callback Response: see Callback Response Format.
contentId, title, and playbackUri are required — the call fails with errorCode: "INVALID_PAYLOAD" if any is missing.
watchNextRemove
Removes a single item from the Watch Next row.
Parameters:
contentId
String
Yes
The contentId of the item to remove.
callback
Function
No
Callback function invoked with the response.
Callback Response: see Callback Response Format.
watchNextClear
Removes every item from the Watch Next row.
Parameters:
callback
Function
No
Callback function invoked with the response.
Callback Response: see Callback Response Format. Use this on sign-out, for example, so a shared TV device doesn't keep showing the previous user's Watch Next items.
channelPublish
Creates or updates one of your own recommendation channels on the Android TV home screen, with the list of programs it should show. Calling it again with the same channelId replaces the channel's programs with the ones you send.
Parameters:
channelId
String
Yes
Stable identifier for this channel. Reusing it updates the channel in place.
name
String
Yes
Channel name shown on the home screen.
logoUri
String
No
Channel logo image URL. Currently not rendered — accepted but has no visible effect yet. Safe to omit.
programs
Array
No
List of programs in the channel. Each entry uses the fields below. Defaults to an empty channel if omitted.
callback
Function
No
Callback function invoked with the response.
programs[] fields:
programId
String
Yes
Stable identifier for this program.
title
String
Yes
Title shown for the program.
playbackUri
String
Yes
Deep link opened when the user selects it. Must be https://.
description
String
No
Description text.
posterArtUri
String
No
Poster/thumbnail image URL. Must be https:// if provided.
Callback Response: see Callback Response Format.
channelRemove
Removes a previously published channel from the home screen.
Parameters:
channelId
String
Yes
The channelId of the channel to remove.
callback
Function
No
Callback function invoked with the response.
Callback Response: see Callback Response Format.
Callback Response Format
Every function above (except isSupported, documented separately) reports back in the same shape:
Success:
Failure:
errorCode
Meaning
NOT_SUPPORTED
The add-on is disabled, or the device isn't detected as Android TV.
INVALID_PAYLOAD
A required field (contentId/title/playbackUri, or a channel/program's channelId/name/programId/title/playbackUri) was missing.
VALIDATION_FAILED
A field was present but invalid — most commonly a playbackUri or posterArtUri that wasn't https://, or a position below the minimum-position threshold.
UNKNOWN_ERROR
An unexpected native error occurred.
Implementation Checklist
WebToNative Dashboard
Your Website
Frequently Asked Questions
Last updated