
Research
/Security News
DuckDB npm Account Compromised in Continuing Supply Chain Attack
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
@telemetrytv/sdk
Advanced tools
The official TelemetryTV application API package. Use it to build applications that run on the TelemetryTV platform
The official TelemetryTV application API package. Use it to build applications that run on the TelemetryTV platform.
First, install the package using your preferred package manager:
# With NPM
npm install @telemetrytv/sdk
# With Yarn
yarn add @telemetrytv/sdk
# With PNPM
pnpm add @telemetrytv/sdk
Then, import the methods you need from the package in your codes:
import { nextPage, getDeviceProperties } from '@telemetrytv/sdk'
// Go to next page
nextPage()
// Get device properties
getDeviceProperties().then((device) => {
console.log(device)
// -> Do something with the device properties data
}).catch((error) => {
// -> Add your error handler here
})
With the help of unpkg, you can use the SDK directly from the CDN.
<!-- ESM format -->
<script type="module">
import { nextPage, getDeviceProperties } from 'unpkg.com/@telemetrytv/sdk/index.js'
// Go to next page
nextPage()
// Get device properties
getDeviceProperties().then((device) => {
console.log(device)
// -> Do something with the device properties data
}).catch((error) => {
// -> Add your error handler here
})
</script>
<!-- UMD format -->
<script src="unpkg.com/@telemetrytv/sdk/index.umd.cjs"></script>
In UMD format, the SDK methods are exposed under the TelemetryTvSdk
global variable:
// Go to next page
TelemetryTvSdk.nextPage()
// Get device properties
TelemetryTvSdk.getDeviceProperties().then((device) => {
console.log(device)
// -> Do something with the device properties data
}).catch((error) => {
// -> Add your error handler here
})
Please check MIGRATION.md for the guideline for migration from the previous auto-injected SDK.
You can skip the migration part if you are new to the TelemetryTV SDK.
getDeviceProperties
(Promise)import { getDeviceProperties } from '@telemetrytv/sdk'
getDeviceProperties().then((device) => {
console.log(device)
// -> Do something with the device properties data
}).catch((error) => {
console.error(error)
// -> Add your error handler here
})
Device properties included:
Property | Type | Description |
---|---|---|
id | String | The unique device id in TelemetryTV system |
name | String | Name of the device defined in TelemetryTV |
serialNumber | String | Serial Number of the device |
model | String | Model Type of the device |
location | String | Device's "Location" field defined in TelemetryTV |
geo | Object | Device's Geographic Coordinates pair 1 |
os | String | Name of the Operating System on the device |
osVersion | String | Version of the Operating System on the device |
browserName | String | Name of the browser rendering engine |
browserVersion | String | Version of the browser rendering engine |
tags | Array | Device's "Tags" value defined in TelemetryTV |
deviceLanguage | String | Device-level language defined in TelemetryTV (Device → Detail) |
accountLanguage | String | Account-level language defined in TelemetryTV (Settings → Localization) |
language | String | The final language locale settings on this device (deviceLanguage > accountLanguage) |
contentPlayback | String | Content playback mode of the device (playlists or webapp ) |
uptime | Number | Uptime of the device in seconds |
environmentVars | Array | Device's "Environment Variables" defined in TelemetryTV |
rotation | Number | Rotation of the device's screen in degrees |
orientation | String | Orientation of the device's screen (landscape or portrait ) |
serialPorts | Array | The serial ports of the device (if any) |
getPlayerProperties
(Promise)import { getPlayerProperties } from '@telemetrytv/sdk'
getPlayerProperties().then((player) => {
console.log(player)
// -> Do something with the player properties data
}).catch((error) => {
// -> Add your error handler here
})
Player properties included:
Property | Type | Description |
---|---|---|
apiStatus | String | The status of the TelemetryTV API WebSocket Connection |
stage | String | The current stage of the player (production , qa , etc) |
isPreviewing | Boolean | Whether is running in preview mode (viewing within the administration app) |
isElectron | Boolean | Whether the player is running in the Electron app 2 |
isDesktop | Boolean | Whether the player is running in the TelemetryTV Desktop app |
isAndroid | Boolean | Whether the player is running on Android |
isIos | Boolean | Whether the player is running on iOS |
isChromeOS | Boolean | Whether the player is running on ChromeOS |
isWindows | Boolean | Whether the player is running on Windows |
isMacOS | Boolean | Whether the player is running on macOS |
isBrowser | Boolean | Whether the player is running in the browser PWA mode |
NOTE: Not available when device is under the Webapp-only content playback mode.
Playlist data included:
Property | Type | Description |
---|---|---|
id | String | The unique playlist id in TelemetryTV system |
name | String | Name of the playlist |
getCurrentPlaylist
(Promise)import { getCurrentPlaylist } from '@telemetrytv/sdk'
getCurrentPlaylist().then((playlist) => {
console.log(playlist)
// -> Do something with the playlist data
}).catch((error) => {
// -> Add your error handler here
})
getPlaylist
(Promise)playlistId
(String)getPlaylist(playlistId)
import { getPlaylist } from '@telemetrytv/sdk'
getPlaylist('sample-playlist-id-1234').then((playlist) => {
console.log(playlist)
// -> Do something with the playlist data
}).catch((error) => {
// -> Add your error handler here
})
getAllPlaylists
(Promise)import { getAllPlaylists } from '@telemetrytv/sdk'
getAllPlaylists().then((playlistsArray) => {
console.log(playlistsArray)
// -> Do something with the playlists array
}).catch((error) => {
// -> Add your error handler here
})
NOTE: Not available when device is under the Webapp-only content playback mode.
Page data included:
Property | Type | Description |
---|---|---|
id | String | The unique page id in TelemetryTV system |
name | String | Name of the page |
duration | Number | Duration of the page in seconds |
getCurrentPage
(Promise)import { getCurrentPage } from '@telemetrytv/sdk'
getCurrentPage().then((page) => {
console.log(page)
// -> Do something with the page data
}).catch((error) => {
// -> Add your error handler here
})
Get all pages from the all playlists assigned to the device.
getAllPages
(Promise)import { getAllPages } from '@telemetrytv/sdk'
getAllPages().then((pagesArray) => {
console.log(pagesArray)
// -> Do something with the pages array
}).catch((error) => {
// -> Add your error handler here
})
Get pages from the target playlist.
getPlaylistPages
(Promise)playlistId
(String)getPlaylistPages(playlistId)
import { getPlaylistPages } from '@telemetrytv/sdk'
getPlaylistPages('sample-playlist-id-4321').then((pagesArray) => {
console.log(pagesArray)
// -> Do something with the pages array
}).catch((error) => {
// -> Add your error handler here
})
NOTE: Not available when device is under the Webapp-only content playback mode.
getPlaybackState
(Promise)"playing"
| "paused"
.import { getPlaybackState } from '@telemetrytv/sdk'
getPlaybackState().then((state) => {
console.log(state)
// -> Do something with the playback state
}).catch((error) => {
// -> Add your error handler here
})
Get playable URLs of the image and video files you uploaded to TelemetryTV "Media" section.
getMediaById
(Promise)mediaId
(String)getMediaById(mediaId)
import { getMediaById } from '@telemetrytv/sdk'
getMediaById('sample-media-id-1234').then((mediaUrl) => {
console.log(mediaUrl)
// -> Do something with the media URL
}).catch((error) => {
// -> Add your error handler here
})
getMediaByTags
(Promise)tags
(Array of String), requiredfolderId
(String), optionalgetMediaByTags(tags, folderId)
import { getMediaByTags } from '@telemetrytv/sdk'
getMediaByTags(['tag1', 'tag2'], 'sample-folder-id-1234').then((mediaUrls) => {
console.log(mediaUrls)
// -> Do something with the media URLs array
}).catch((error) => {
// -> Add your error handler here
})
getMediaInFolder
(Promise)folderId
(String)getMediaInFolder(folderId)
import { getMediaInFolder } from '@telemetrytv/sdk'
getMediaInFolder('sample-folder-id-1234').then((mediaUrls) => {
console.log(mediaUrls)
// -> Do something with the media URLs array
}).catch((error) => {
// -> Add your error handler here
})
NOTE: Not available when device is under the Webapp-only content playback mode.
nextPage
import { nextPage } from '@telemetrytv/sdk'
nextPage()
previousPage
import { previousPage } from '@telemetrytv/sdk'
previousPage()
goToPageById
pageId
(String)goToPageById(pageId)
import { goToPageById } from '@telemetrytv/sdk'
goToPageById('sample-page-id-1234')
goToPageByName
pageName
(String)goToPageByName(pageName)
import { goToPageByName } from '@telemetrytv/sdk'
goToPageByName('Your Target Page Name')
If multiple pages have the same name, the first page found will be returned.
pause
import { pause } from '@telemetrytv/sdk'
pause()
play
import { play } from '@telemetrytv/sdk'
play()
restart
import { restart } from '@telemetrytv/sdk'
restart()
startOverride
overrideName
(String)startOverride(overrideName)
import { startOverride } from '@telemetrytv/sdk'
startOverride('Target Override Name')
endOverride
overrideName
(String)endOverride(overrideName)
import { endOverride } from '@telemetrytv/sdk'
endOverride('Target Override Name')
Sends serial connection information to the device.
serialConnection
options
(Object)serialConnection(options)
import { serialConnection } from '@telemetrytv/sdk'
serialConnection({
port: 'PORT_NAME',
bufferSize: 4096,
bitrate: 9600,
dataBits: 'eight',
stopBits: 'one',
//...
})
Please refer to the Chrome Serial Connection Options Documentation for more information about the options
object.
Sends serial commands to the device.
serialCommands
commands
(Array of String)serialCommands(commands)
import { serialCommands } from '@telemetrytv/sdk'
serialCommands([
'12 34 56 78 90',
//...
])
Helps to send the message to the device’s debug log so it can be viewed in debug mode or in the device logs if the device's log level is set to "Debug".
log
message
(String)log(message)
import { log } from '@telemetrytv/sdk'
log('SDK successfully loaded')
log('Current time is ' + new Date().toLocaleString())
Display a message banner on top of the screen for a couple seconds.
message
message
(String), requiredlevel
(String), optional. Accepted values: "debug"
(default) | "log"
| "info"
| "warn"
| "error"
message(message, level)
import { message } from '@telemetrytv/sdk'
message('This is a test debug message')
message('This is an info message', 'info')
NOTE: Currently only available in Webapp's "Simple Editor" type.
Get argument value by its unique key defined in TelemetryTV.
getValue
(Promise)argumentKey
(String)getValue(argumentKey)
import { getValue } from '@telemetrytv/sdk'
getValue('sample-argument-key-1234').then((value) => {
console.log(value)
// -> Do something with the argument value
}).catch((error) => {
// -> Add your error handler here
})
The TelemetryTV SDK has events that trigger whenever values change. By attaching event listeners to these events, you can be notified whenever there is a change in value. This helps you keep track of updates and stay informed with the latest information.
Available events:
Event Name | Description | Return Data |
---|---|---|
onReady | Called when the SDK is ready to use | null |
onApiStatusChange | Called when the API WebSocket Connection status changes | The current status String |
onPlaybackChange | Called when the playback state changes | "paused" or "playing" |
onPageChange | Called when the current page changes, or the Playlist transitions to a new page | The current page Object |
onPageDuration | Called when when page start or page duration changes. 3 | The duration in Number of seconds |
onPlaylistChange | Called when the current playlist changes, or the Player transitions to another playlist | The current playlist Object |
onDeviceChange | Called when the device properties changes | The current device Object |
onGeoChange | Called when the device's geographic coordinates changes 1 | The current coordinates Object |
onOverrideStart | Called when an override starts | The starting override Object |
onOverrideEnd | Called when an override ends | The ending override Object |
onSerialConnection | Called when a serial connection is established | The serial connection Object |
onSerialCommands | Called when a commaned message is received from the configured serial port | The serial command String |
bindEvent
eventName
(String), requiredeventHandler
(Function), requiredbindEvent(eventName, eventHandler)
import { bindEvent } from '@telemetrytv/sdk'
function pageChangeHandler (page) {
console.log('Page changed to ' + page.name)
// -> Do something with the page data
}
bindEvent('onPageChange', pageChangeHandler)
unbindEvent
eventName
(String), requiredeventHandler
(Function), requiredunbindEvent(eventName, eventHandler)
import { unbindEvent } from '@telemetrytv/sdk'
function pageChangeHandler (page) {
// ...
}
unbindEvent('onPageChange', pageChangeHandler)
We also provide a helper method to bind multiple event listeners at once.
bindEvents
eventName
(String), requiredeventHandler
(Function), requiredbindEvents({ eventName1: eventHandler1, ...})
import { bindEvents } from '@telemetrytv/sdk'
function pageChangeHandler (page) {
// ...
}
function playlistChangeHandler (playlist) {
// ...
}
bindEvents({
'onPageChange': pageChangeHandler,
'onPlaylistChange': playlistChangeHandler
})
Similarly, here's the helper method to unbind multiple event listeners simultaneously.
unbindEvents
eventName
(String), requiredeventHandler
(Function), requiredunbindEvents({ eventName1: eventHandler1, ...})
import { unbindEvents } from '@telemetrytv/sdk'
function pageChangeHandler (page) {
// ...
}
function playlistChangeHandler (playlist) {
// ...
}
unbindEvents({
'onPageChange': pageChangeHandler,
'onPlaylistChange': playlistChangeHandler
})
Only available in the Android Player with corresponding permissions toggled on. ↩ ↩2
It includes the TelemetryTV Electron Player and the TelemetryTV Desktop app for administration. Both of them are available on Mac, Windows, and Linux. ↩
Only works for:
duration
setduration
but there's a video (either uploaded video in the "Media" section, or a YouTube app, etc.,) that would cause the playlist to advance.FAQs
The official TelemetryTV application API package. Use it to build applications that run on the TelemetryTV platform
The npm package @telemetrytv/sdk receives a total of 7 weekly downloads. As such, @telemetrytv/sdk popularity was classified as not popular.
We found that @telemetrytv/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.