SmartTV Framework
raw JSON → 0.6.30 verified Fri May 01 auth: no javascript
JavaScript framework for building smart TV applications. Version 0.6.30 is under active development and currently usable as a standalone library. Provides device abstraction, configuration for video players, VAST ad options, DRM (PlayReady), and app ID management. Differentiates by focusing on smart TV environments with built-in support for VAST ads and multiple DRM systems. Still early-stage with limited documentation and no stable release schedule.
Common errors
error SyntaxError: Cannot use import statement outside a module ↓
cause Using import syntax in a non-module script (e.g., .js without type: module).
fix
Add "type": "module" to package.json or rename file to .mjs.
error TypeError: SmartTVFramework.Device is not a constructor ↓
cause Trying to use require() instead of import, or destructuring the default export incorrectly.
fix
Use import SmartTVFramework from 'smarttv-framework' and then new SmartTVFramework.Device(config).
error Cannot read properties of undefined (reading 'init') ↓
cause SmartTVDevice.init() called before device properly constructed, or config missing mandatory fields.
fix
Ensure config object includes required properties like 'videoPlayerId' and 'width'/'height'.
Warnings
breaking SmartTVFramework.Device constructor expects a config object; missing required fields may cause silent failures. ↓
fix Always provide config with all mandatory fields (width, height, videoPlayerId).
deprecated The config property 'DRM.playReady.DRMSystemID' is deprecated; use 'systemId' or similar. ↓
fix Use 'systemId' instead of 'DRMSystemID' if available, or check documentation.
gotcha The package is ESM-only; using require() will throw an error. ↓
fix Use import syntax and set type: 'module' in package.json or use .mjs extension.
gotcha No TypeScript definitions provided; using with TypeScript requires manual declaration or ignore. ↓
fix Add declare module 'smarttv-framework' in .d.ts file.
Install
npm install smarttv-framework yarn add smarttv-framework pnpm add smarttv-framework Imports
- SmartTVFramework wrong
const SmartTVFramework = require('smarttv-framework')correctimport SmartTVFramework from 'smarttv-framework' - SmartTVFramework.Device wrong
import { Device } from 'smarttv-framework'correctimport SmartTVFramework from 'smarttv-framework'; const device = new SmartTVFramework.Device(config) - SmartTVFramework (TypeScript)
import SmartTVFramework from 'smarttv-framework';
Quickstart
import SmartTVFramework from 'smarttv-framework';
const config = {
width: '100%',
height: '100%',
debug: true,
videoPlayerId: 'test-video',
vastOptions: {
media_type: 'video/mp4',
media_bitrate_min: 200,
media_bitrate_max: 1200,
ad_caption: 'Advertisement'
},
DRM: {
playReady: {
mimeType: 'application/vnd.ms-playready.initiator+xml',
DRMSystemID: '',
licenserUrl: ''
}
},
appId: ''
};
const SmartTVDevice = new SmartTVFramework.Device(config);
SmartTVDevice.init();