AdPlayerConfig
Configuration options for initializing the AdPlayer SDK.Container element to render the ad player into. The player will create a video element and UI overlay within this container.
VAST tag URL to fetch. Supports VAST 4.x specification.
Target bitrate in kbps for media file selection. Default:
2500 (approximately 1080p quality)Maximum VAST wrapper depth to follow. Prevents infinite wrapper chains. Default:
5Request timeout in milliseconds for VAST fetching and media loading. Default:
10000Enable debug logging to console. Default:
falseCustom text for the skip button. Default behavior shows countdown and “Skip Ad” text.
Skip offset override in seconds. Set to
0 to disable skipping entirely. If not set, uses the skip offset from VAST.Callback invoked when ad playback completes successfully.
Callback invoked when an error occurs during ad loading or playback.
Callback invoked when ad starts playing for the first time.
Callback invoked periodically during playback with current progress information.
Callback invoked when user skips the ad.
Callback invoked when user clicks the ad. Receives the click-through URL from VAST.
Callback invoked when ad is paused.
Callback invoked when ad resumes from pause.
Custom “Start Ad” overlay UI element for autoplay fallback scenarios. Displayed when browser blocks autoplay.
Callback invoked when user triggers Back or Exit key action on Smart TV platforms.
Example
AdPlayerState
Current state of the ad player.Current playback status. See PlaybackStatus enum.
Current playback time in seconds.
Total duration of the ad in seconds.
Whether the ad is currently muted.
Current volume level from 0 (muted) to 1 (full volume).
Whether the skip button is currently available to the user.
Seconds remaining until skip becomes available.
0 when skip is available.PlaybackStatus
Enum representing the current playback state.Player is initialized but no ad has been loaded.
Player is fetching VAST or loading media.
Media is loaded and ready to play.
Ad is currently playing.
Ad playback is paused.
Ad playback has completed successfully.
An error occurred during loading or playback.
Autoplay was blocked; waiting for user interaction to start playback.
AdProgress
Progress event data emitted during playback.Current playback time in seconds.
Total duration in seconds.
Playback progress as a percentage (0-100).
Current quartile milestone:
0- Start1- First quartile (25%)2- Midpoint (50%)3- Third quartile (75%)4- Complete (100%)
AdError
Error structure with VAST error code and details.Error code. Uses standard VASTErrorCode values when applicable, or custom numeric codes.
Human-readable error message.
Additional error details or stack trace information.
Whether the error is recoverable and playback can be retried.
Example
AdPlayerEvent
Union type representing all events emitted by the player.VAST has been loaded and media is ready.
Ad playback has started.
Playback progress update. Emitted periodically with current progress data.
Quartile milestone reached (firstQuartile, midpoint, thirdQuartile).
Ad playback completed successfully.
User skipped the ad.
User clicked the ad. Contains the click-through URL.
Ad playback was paused.
Ad playback resumed from pause.
Ad was muted.
Ad was unmuted.
An error occurred. Contains error details.
Player instance was destroyed.
