UNPKG

vp-outstream-player

Version:

Outstream video player with Google IMA integration

126 lines (125 loc) 3.84 kB
export interface AdBreakConfig { adTagUrl: string[]; } export interface VideoConfig { url: string; loop?: boolean; debug?: boolean; } export interface PlayerCallbacks { onAdRequested?: () => void; onAdLoaded?: () => void; onAdStarted?: () => void; onAdTimeUpdate?: (currentTime: number) => void; onAdSkipped?: () => void; onAdComplete?: () => void; onAdError?: (err: Error) => void; onAdResume?: () => void; onAdPause?: () => void; } export interface PlayerConfig extends PlayerCallbacks { /** * The object containing ad break configurations. */ ads: { /** * A list of ad breaks to play, each with one or more VAST tag URLs (used as a fallback waterfall). */ adBreaks: AdBreakConfig[]; /** * Time (in ms) to wait before playing the next ad after a successful one finishes. */ adCycleDelayMs?: number; /** * Maximum number of retry attempts when an ad fails to load or play. */ adRetryLimit?: number; /** * If set, the ad cycle restarts after this many milliseconds once all ad breaks are played. * Set to `null` to disable restarting. */ adCycleRestartMs?: number | null; }; /** * Video configuration for demo mode. * When `url` value provided, the player will use this instead of ads. */ video?: VideoConfig; /** * Player configuration options. */ config: { /** * Enables/disables specific UI controls. * Example: { play: true, mute: true, volume: false } */ controls?: { /** Show play/pause button */ play?: boolean; /** Show mute/unmute toggle */ mute?: boolean; /** Show volume slider (usually on hover) */ volume?: boolean; }; /** * Skin configuration for the player. */ skin?: { icons?: { /** Default color for icons */ default?: string; /** Color for icons on hover */ hover?: string; }; slider?: { /** Color for the slider rail */ rail?: string; /** Color for the slider progress */ progress?: string; /** Color for the slider dragger */ dragger?: string; }; }; /** * If true, the player will be hidden when no ad is playing. */ hideWhenNoAd?: boolean; /** * Percentage (0–100) of player visibility required to consider it "in view" (used for auto play/pause). */ viewableThreshold?: number; /** * Automatically start the ad when the player becomes viewable. */ autostartOnViewable?: { /** Enable/disable this behavior */ state?: boolean; }; /** * Automatically pause the ad when the player goes out of view. */ autopauseOnViewable?: { /** Enable/disable this behavior */ state?: boolean; }; /** * Whether the first ad starts muted (An attempt will be made). */ startMuted?: boolean; /** * Fixed dimensions of the player container. Ignored if `responsive` is true. */ size?: { width: number; height: number; }; /** * Makes the player auto-resize to fill its container instead of using fixed dimensions. */ responsive?: boolean; /** * Enables verbose logging to console (for development/debugging). */ debug?: boolean; }; }