Configuration
The Adgent SDK is highly configurable to support various Smart TV platforms and advertising requirements. This guide covers all available configuration options with practical examples.Basic Configuration
The minimal configuration requires only two parameters:AdPlayerConfig Interface
All configuration options are defined insrc/types/player.ts:9.
Required Parameters
Container element to render the ad player into. The video element and UI overlays will be appended as children.
VAST tag URL to fetch ad data from. Supports VAST 4.x format including wrappers.
Media Selection
Target bitrate in kbps for media file selection. The SDK selects the closest match from available VAST MediaFiles.Default:
2500 (approximately 1080p quality)Use cases:- High-end TVs (4K):
5000-8000kbps - Standard 1080p TVs:
2500-3500kbps - Budget/720p TVs:
1500-2000kbps - Low bandwidth:
800-1200kbps
Network Configuration
Maximum VAST wrapper chain depth to prevent infinite redirects.Default:
5Use cases:- Standard ads:
3-5(default is safe) - Complex programmatic chains:
7-10 - Direct VAST only:
0(no wrappers allowed)
Network request timeout in milliseconds for VAST fetching.Default:
10000 (10 seconds)Use cases:- Fast networks:
5000-7000ms - Standard:
10000ms (default) - Slow TV WiFi:
15000-20000ms
Skip Configuration
Skip offset override in seconds. When set, this overrides the skip offset from the VAST XML.
undefined: Use skip offset from VAST (default behavior)0: Disable skip button entirely> 0: Force skip after specified seconds
The skip button appears at
src/core/AdPlayer.ts:506 and countdown logic is at src/core/AdPlayer.ts:542.Custom text for the skip button when skip is available.During countdown, the button displays:
"Skip in {N}s" format.UI Customization
Custom “Start Ad” overlay UI element for autoplay fallback scenarios.When autoplay fails (common on TVs), the SDK shows an interactive overlay. By default, it creates a play button, but you can provide your own custom element.
The overlay is shown when autoplay fails (
src/core/AdPlayer.ts:287) and removed when user clicks start.Event Callbacks
All event callbacks are optional and provide hooks into the ad lifecycle.Triggered when ad playback begins. Called after VAST impressions are fired.See
src/core/AdPlayer.ts:420 for implementation.Triggered when ad finishes playing completely (not skipped).
Triggered when any error occurs during VAST fetch or playback.Error structure defined at
src/types/player.ts:116:Triggered continuously during playback with progress information.Progress data structure (
src/types/player.ts:108):Triggered when user skips the ad.
Triggered when user clicks the ad video. Receives the click-through URL from VAST.Implementation:
src/core/AdPlayer.ts:343Triggered when ad is paused (either by user or click action).
Triggered when ad resumes from pause.
Triggered when user presses Back/Exit key on remote control.
If not provided, the Back key defaults to skip behavior (
src/core/AdPlayer.ts:699).Debug Configuration
Enable verbose debug logging to console.When enabled, logs:
- VAST parsing steps
- Media file selection
- Video element events (loadstart, canplay, playing, etc.)
- Key presses and actions
- Tracking pixel fires
Complete Example
Here’s a production-ready configuration with all common options:Platform-Specific Recommendations
Tizen (Samsung)
WebOS (LG)
Generic Web / Desktop
Default Values Summary
All defaults are defined atsrc/core/AdPlayer.ts:22:
Next Steps
Event Handling
Learn about the event system and listeners
Platform Detection
Detect and adapt to different Smart TV platforms
Error Handling
Handle errors gracefully with recovery strategies
Optimization
Optimize performance for Smart TV constraints
