@flowplayer/player
Version:
video player for the future
1,569 lines (1,422 loc) • 155 kB
TypeScript
import type { BitrateInfo } from 'dashjs';
import type { Get } from 'type-fest';
import type { Level } from 'hls.js';
import type { TupleToUnion } from 'type-fest';
declare const AD_ATTRIBUTION: number;
/* Excluded from this release type: AD_BLOCKED */
declare const AD_BREAK_COMPLETED = "ad-break-completed";
declare const AD_CHOICES: number;
/**
* When a single ad has finished
*/
declare const AD_COMPLETED = "ad-completed";
/* Excluded from this release type: AD_ERROR */
/* Excluded from this release type: AD_FULLSCREEN */
/* Excluded from this release type: AD_INIT */
/* Excluded from this release type: AD_MIDROLL_FINISHED */
/**
* When the ad is muted
*/
declare const AD_MUTED = "ad-muted";
declare const AD_PAUSE_CONTENT = "ad-pause-content";
/**
* When the ad has been paused
*/
declare const AD_PAUSED = "ad-paused";
declare const AD_PLAY_REQUESTED = "ad-play-requested";
/**
* Ad request was successfull but ad fails to play
*/
declare const AD_PLAYBACK_ERROR = "ad-playback-error";
/**
* When all ads for a specific timeslot have been shown
*/
declare const AD_POSTROLL_FINISHED = "ad-postroll-finished";
/**
* Fires when both content and (possible) postroll are finished. Also fires when no postroll is configured.
*/
declare const AD_PREROLL_FINSIHED = "ad-preroll-finished";
/**
* Fires when the ad progresses
*/
declare const AD_PROGRESS = "ad-progress";
declare const AD_REQUEST_COMPLETED = "ad-request-completed";
/**
* Ad was requested but the ad request fails
*/
declare const AD_REQUEST_ERROR = "ad-request-error";
/**
* Fires when an ad request has been made
*/
declare const AD_REQUESTED = "ad-requested";
/* Excluded from this release type: AD_RESIZE */
/**
* When the ad resumes
*/
declare const AD_RESUMED = "ad-resumed";
/* Excluded from this release type: AD_SET_UI_FLAGS */
/* Excluded from this release type: AD_SHOW_FIRST_FRAME */
/**
* When the skip button has been clicked
*/
declare const AD_SKIPPED = "ad-skipped";
/**
* Ad was received and starts to show
*/
declare const AD_STARTED = "ad-started";
declare const AD_TEARDOWN = "ad-teardown";
declare const AD_TIMEOUT = "ad-timeout";
declare const AD_VIDEOTAG_ATTACHED = "ad-videotag-attached";
/**
* Volume has been changed during ad playback
*/
declare const AD_VOLUME_CHANGED = "ad-volume-changed";
/* Excluded from this release type: AD_WAITING */
declare interface Adapter {
initialize(opts: AdapterOpts): void;
getOpts(): AdapterOpts;
reset(): void;
destroy(): void;
destroyManager(): void;
stop(): void;
initAd(adTag: string, timeout?: number): Promise<void>;
playAd(): Promise<void>;
pause(): void;
resume(): void;
volume(level?: number): number | undefined;
contentComplete(): Promise<void>;
onResize(_obj: ResizeInfo): void;
isUiDisabled(): boolean;
onAdRequestEnd(): void;
isAdPod(): boolean;
canDismissNonLinear(): boolean;
setAdBreakTime: (time: number) => void;
getAdBreakTime: () => number;
init(opts: AdapterOpts): Promise<void>;
isReady(): boolean;
setVideoTag(tag: Player): void;
isPaused(): boolean;
isCustomPlaybackEnabled(): boolean;
isAttemptingPrerollOnIOS(): boolean;
setAttemptingPrerollOnIOS(preroll_on_ios: boolean): void;
isLinearAd(): boolean;
getVideoTag(): Player | undefined;
getDimensions(): Partial<{
width: number;
height: number;
linear: boolean;
}>;
getAdInfo(): AdInfo | undefined;
}
declare const ADAPTER_INIT_FAILED = "ad-adapter-init-failed";
/**
* @public
*/
export declare type AdapterInitFailedEventDetail = AdBasicInfo;
/**
* @public
*/
export declare type AdapterOpts = Partial<ControllerConfig>;
/**
* @public
* Basic info about current ad and it's config
*/
export declare type AdBasicInfo = AdapterOpts & TimeBasedAd & {
ad_type?: AdType;
};
/**
* @public
*/
export declare type AdBreakCompletedEventDetail = AdBasicInfo;
/**
* @public
*/
export declare type AdCompletedEventDetail = AdBasicInfo & AdDetail;
/**
* @public
* Detailed info about current ad
*/
export declare type AdDetail = {
ad: {
duration: number;
width: number;
height: number;
position: number | undefined;
totals: number | undefined;
};
volume: number;
vast_ad_id: string;
linear: boolean;
mime_type: string;
/* Excluded from this release type: ima_event */
};
/**
* @public
*/
export declare type AdError = {
vast_error_type: google.ima.AdError.Type;
reason: string;
vast_error: google.ima.AdError.ErrorCode;
};
/**
* @public
* Represents ad events.
*/
declare type AdEvents = typeof events_2;
declare type AdEventsDetailMap = {
/* Excluded from this release type: "ad-initialized" */
[AD_PLAYBACK_ERROR]: AdPlaybackErrorEventDetail;
[AD_TEARDOWN]: AdTearDownEventDetail;
[AD_VIDEOTAG_ATTACHED]: AdVideoTagAttachedEventDetail;
[AD_REQUEST_ERROR]: AdRequestErrorEventDetail;
[AD_REQUESTED]: AdRequestedEventDetail;
[AD_REQUEST_COMPLETED]: AdRequestCompletedEventDetail;
[AD_PAUSE_CONTENT]: AdPauseContentEventDetail;
[AD_STARTED]: AdStartedEventDetail;
[AD_COMPLETED]: AdCompletedEventDetail;
[AD_PAUSED]: AdPausedEventDetail;
[AD_RESUMED]: AdResumedEventDetail;
[AD_PROGRESS]: AdProgressEventDetail;
[AD_SKIPPED]: AdSkippedEventDetail;
[AD_MUTED]: AdMutedEventDetail;
[AD_VOLUME_CHANGED]: AdVolumeChangedEventDetail;
[AD_TIMEOUT]: AdTimeoutEventDetail;
[AD_BREAK_COMPLETED]: AdBreakCompletedEventDetail;
[AD_POSTROLL_FINISHED]: AdPostrollFinishedEventDetail;
[AD_PREROLL_FINSIHED]: AdPrerollFinishedEventDetail;
/* Excluded from this release type: "vpaid-init" */
[IMA_ADAPTER_INIT]: ImaAdapterInitEventDetail;
[IMA_BEFORE_ADS_REQUEST]: ImaBeforeAdsRequestEventDetail;
[IMA_ADS_RENDERING_SETTINGS]: ImaAdsRenderingSettingsEventDetail;
[ADAPTER_INIT_FAILED]: AdapterInitFailedEventDetail;
[AD_PLAY_REQUESTED]: AdPlayRequestedEventDetail;
[RELOAD_AD_REQUESTED]: ReloadAdRequestedEventDetail;
[REQUEST_AD_PAUSE]: RequestAdPauseEventDetail;
[REQUEST_AD_PLAY]: RequestAdPlayEventDetail;
[REQUEST_AD_MUTE_UNMUTE]: RequestAdMuteUnmuteEventDetail;
[PBJS_AVAILABLE]: PBJSAvailebleEventDetail;
};
declare type AdInfo = {
duration: number;
};
/* Excluded from this release type: AdInitEventDetail */
/**
* @public
*/
export declare type AdMutedEventDetail = AdBasicInfo;
/**
* @public
*/
export declare type AdPauseContentEventDetail = AdBasicInfo & AdDetail;
/**
* @public
*/
export declare type AdPausedEventDetail = AdBasicInfo;
/**
* @public
*/
export declare type AdPlaybackErrorEventDetail = google.ima.AdErrorEvent;
/**
* @public
*/
export declare type AdPlayRequestedEventDetail = AdBasicInfo;
/**
* @public
*/
export declare type AdPostrollFinishedEventDetail = AdBasicInfo;
/**
* @public
*/
export declare type AdPrerollFinishedEventDetail = AdBasicInfo;
/**
* @public
*/
export declare type AdProgressDetail = {
remaining: number;
duration: number;
};
/**
* @public
*/
export declare type AdProgressEventDetail = AdBasicInfo & AdProgressDetail;
/**
* @public
*/
export declare type AdRequestCompletedEventDetail = AdBasicInfo & {
request_load_time: number;
};
/**
* @public
*/
export declare type AdRequestedEventDetail = AdBasicInfo | AdTag;
/**
* @public
*/
export declare type AdRequestErrorEventDetail = AdError;
/**
* @public
*/
export declare type AdResumedEventDetail = AdBasicInfo;
/**
* @public
* The Advertising plugin allows you to seamlessly integrate various ads into your video content, including pre-roll, mid-roll, and post-roll ads. These ads can be served from different ad networks or custom ad servers.
* See {@link https://developer.wowza.com/docs/wowza-flowplayer/plugins/advertising/|Official Documentation}
*/
declare const Ads: PluginCtor<NoInfer<AdsConfig>, NoInfer<AdsPlayer>> & NoInfer<AdsAPI>;
export default Ads;
/**
* @public
*/
export declare type AdsAPI = {
/**
* UI bit flags to be used in `ads.ui` configuration option
*/
ui: AdsUI;
/**
* Event names in Ads Plugins
*/
events: AdEvents;
};
/**
* @public
* Main configuration for the Ads plugin.
*/
export declare type AdsConfig = ConfigWith<{
/**
* Ads plugin configuration
*/
ima?: PlayerIMAConfig;
/**
* Ads plugin configuration
*/
ads?: AdsDetails;
}>;
declare class AdsController extends EventBus {
readonly adapter: Adapter;
readonly opts: Partial<ControllerConfig>;
readonly analytics: Analytics;
private _macros;
private _schedule;
private _state;
private _lastAd;
private content_processing_src;
constructor(params?: Partial<ControllerConfig>);
reset(): this;
destroy(): void;
stop(): void;
onContentNewSrc(): void;
wireup(): void;
initialize(ads: TimeBasedAd[] | false, opts?: Partial<ControllerConfig>, preload?: boolean): Promise<this>;
get videoTag(): Player | undefined;
get adInfo(): AdInfo | undefined;
setVideoTag(player: Player): Promise<void>;
waitForVideoTag(): Promise<unknown>;
adapterInitialized(preload?: boolean): Promise<void>;
fetchNextAd(time: number, depth?: number): Promise<void>;
skipAdsOnSeek(time: number): void;
setCurrentTime(time: number, preload?: boolean, seek?: boolean): Promise<void>;
playAd(): Promise<void>;
checkIfBreakComplete(): void;
resetScheduleCounter(): void;
setSchedule(ads: TimeBasedAd[], contentDuration?: number): void;
toJSON(): TimeBasedAd[];
trigger<EventName extends keyof AdEventsDetailMap>(name: EventName, data?: any): void;
dispatch<EventName extends keyof AdEventsDetailMap>(name: EventName, data: any): void;
get ad_type(): "preroll" | "midroll" | "postroll" | undefined;
shouldRestartContent(): boolean;
finished(cb: () => void): Promise<void>;
hasPreroll(): boolean | undefined;
shallPlayAd(time: number): boolean;
setLastAd(ad: TimeBasedAd): this;
setIsContentProcessingNewSrc(is_processing: boolean): void;
getLastAd(): Maybe<TimeBasedAd>;
getIsContentProcessingNewSrc(): boolean;
mergeMacros(macros?: {}): this;
/**
*
* public interface for plugin users, keep the signature unchanged
*
**/
get paused(): boolean;
pause(): void;
resume(): void;
resize(opts: Todo): void;
requestAd(ad: AdTag, idx?: number, timeout?: number | undefined): Promise<void>;
resetSchedule(ads: TimeBasedAd[]): void;
get adPlaying(): boolean;
get adBreak(): boolean;
get adRequesting(): boolean;
get adLinear(): boolean;
}
/**
* @public
*/
export declare type AdsControllerPublic = {
/**
* Pauses the ad
*/
pause(): void;
/**
* Resumes the ad
*/
resume(): void;
/**
* Attempts to request & play an adTag
* @param adTag - Ad tag
*/
requestAd(adTag: string): Promise<void>;
/**
* Resets the internal ad schedule
* @param adSchedule - Ad schedule
*/
resetSchedule(adSchedule: Array<{
adTag: string;
time: number;
}>): void;
/**
* Boolean to show when ad is playing
*/
get adPlaying(): boolean;
};
/**
* @public
*/
export declare type AdsDetails = {
/**
* Adds a bitmask to configure {@link https://developer.wowza.com/docs/wowza-flowplayer/plugins/advertising/#ui-configuration|UI elements}. Default value is undefined.
*/
ui?: number;
/**
* Configuration for Prebid.js integration.
*/
prebid?: PrebidConfig;
};
/**
* @public
*/
export declare type AdSkippedEventDetail = AdBasicInfo & AdDetail;
/**
* @public
*/
export declare type AdsPlayer = PlayerWith<{
ads?: AdsControllerPublic;
on<EventName extends keyof AdEventsDetailMap>(event: EventName, handler: (e: FPEvent<AdEventsDetailMap[EventName]>) => void): Player;
}>;
/**
* @public
*/
export declare type AdStartedEventDetail = AdBasicInfo & AdDetail;
/**
* @public
* Represents the UI configuration for ads.
*/
export declare type AdsUI = typeof Flags_2;
/**
* @public
* Represents an ad tag which can be a string, array of strings, LazyAdTag, or array of LazyAdTags.
*/
export declare type AdTag = string | LazyAdTag[] | string[] | (string | LazyAdTag)[] | LazyAdTag | TimeBasedAd;
/**
* @public
*/
export declare type AdTearDownEventDetail = AdBasicInfo;
/**
* @public
*/
export declare type AdTimeoutEventDetail = Error;
/**
* @public
*/
export declare enum AdType {
Preroll = "preroll",
Midroll = "midroll",
Postroll = "postroll"
}
/**
* @public
*/
export declare type AdVideoTagAttachedEventDetail = Player;
/**
* @public
*/
export declare type AdVolumeChangedEventDetail = number;
declare class Analytics {
readonly emitter: Listenable;
/**
* pure creation interface
*/
static of(emitter: Listenable, opts: Todo): Analytics;
/**
* check it there are any keys that the Analytics service
* considers to be require on an Object
*/
static ensure_required_keys(analytics: Analytics, obj: Record<string, string | number>): string[];
/**
* takes an Object and plucks what the Analytics service
* considers to be valid keys
*/
static pluck_valid_keys(analytics: Analytics, obj: Record<string, string | number>): {};
/**
* Assigns the metadata to the analytics.metadata
* only will propagate valid keys
*
* @param analytics - The Analytics object
* @param metadata - The metadata to assign
*/
static mergeMetadata(analytics: Analytics, metadata?: {}): Analytics;
events: string[];
required_keys: string[];
optional_keys: string[];
valid_keys: string[];
metadata: Metadata_2;
/**
* Construct a new Analytics tracking object
*/
constructor(emitter: Listenable, opts?: Partial<AnalyticsOpts>);
wireup(): void;
destroy(): void;
}
declare type AnalyticsOpts = {
metadata: Metadata_2;
required_keys: string[];
events: string[];
optional_keys: string[];
};
/* Excluded from this release type: AnyLoader */
declare type ArrayToIntersection<T extends Array<unknown>> = T extends [
infer Current,
...infer Remaining
] ? Current & ArrayToIntersection<Remaining> : unknown;
/**
* Each loader must
*/
declare type _AttachedEventCheck = {
on(event: `${string}:attached`, handler: (e: FPEvent<unknown>) => void): Player;
};
/* Excluded from this release type: AUDIO_ONLY_SOURCE */
/* Excluded from this release type: AudioOnlySourceEventDetail */
declare const AUTOPLAY = "is-autoplay";
/**
* @public
*/
declare type Autoplay = BitOpts | boolean;
declare enum AutoplayOpts {
OFF = 0,
ON = 1,
AUDIO_REQUIRED = 2
}
/**
* @public
*/
export declare type BaseAdObj = {
/**
* Defines an adTag URL to load VAST from. Several tags can be configured for waterfalling.
*/
adTag: string | string[] | LazyAdTag;
/**
* Determines if the ad should attempt to restart the content. Default value is true.
*/
restart?: boolean;
/* Excluded from this release type: lazy */
/**
* Indicates if the ad is an outstream ad.
*/
outstream?: boolean;
};
/* Excluded from this release type: BEFORE_PAUSE */
/* Excluded from this release type: BEFORE_PLAY */
/**
* @public
*/
declare type BeforePauseEventDetail = {
forced: boolean;
};
/**
* @public
*/
declare type BeforePlayEventDetail = {
forced: boolean;
};
/**
* @public
*/
declare type BitOpts = number;
/**
* @public
*/
declare const /**
@public
* when a new player is inserted into the HTML
*/ /**
* @public
*/
CAN_PLAY = "canplay";
/**
* @public
*/
declare const /**
@public
* when a new player is inserted into the HTML
*/ /**
* @public
*/
CLICK = "click";
/**
* For plugins that add new properties to all source types, combine their src-mixins into one SourceObject
* @example
* ```
* type Combined = CombineGlobalSrcExtensions<DRMPlugin, PluginWithFooFieldInSrc> // Combined = SourceObject<DRMConfig & FooFieldConfig>
* ```
*/
declare type CombineGlobalSrcExtensions<PluginSrcs extends unknown[]> = HasGlobalSrcExtensios<PluginSrcs> extends false ? SourceObj : SourceObj & ArrayToIntersection<PickGlobalSrcExtension<PluginSrcs>>;
/**
* For plugins that define a new src type, make a union of all new src.type declarations
* @example
* ```
* type Combined = CombineNewSourceTypes<RTSPlugin, SSAIPlugin> // Combined = DRMConfig | FooFieldConfig
* ```
*/
declare type CombineNewSourceTypes<PluginSrcs extends unknown[]> = TupleToUnion<FilterNewSourceTypes<PluginSrcs>>;
declare type CombineSrc<PluginSrcs extends unknown[]> = UnsafeSource<CombineGlobalSrcExtensions<PluginSrcs> | (CombineNewSourceTypes<PluginSrcs> & CombineGlobalSrcExtensions<PluginSrcs>)>;
/* Excluded from this release type: Component */
/* Excluded from this release type: Components */
/* Excluded from this release type: CONFIG */
/**
* @public
*/
declare interface Config {
src?: UnsafeSource;
preload?: "none" | "metadata" | "auto";
controls?: boolean;
lang?: string;
start_time?: number;
autopause?: boolean;
rewind?: boolean;
loop?: boolean;
/**
* an access token for the media
* @public
*/
playback_token?: string;
/* Excluded from this release type: seamless */
retry?: boolean;
autoplay?: Autoplay;
start_quality?: BitOpts;
live?: boolean;
poster?: string;
disabled?: boolean;
muted?: boolean;
/* Excluded from this release type: is_native */
/**
* bitflags for UI options
*/
ui?: BitOpts;
/**
* your user access token
*/
token?: string;
/* Excluded from this release type: duration */
/**
* can the content be seeked to any position
*/
seekable?: boolean;
multiplay?: boolean;
ratio?: number | string;
logo?: string;
logo_href?: string;
logo_alt_text?: string;
title?: string;
description?: string;
/**
* the number of seconds to have in the buffer before dvr is activated
*/
seconds_to_dvr?: number;
}
/* Excluded from this release type: ConfigEventDetail */
/**
* @public
*/
declare type ConfigWith<T> = Config & T;
declare type ConfigWithSourceExtensions<PluginBareConfigs extends unknown[]> = Omit<ConfigWith<ArrayToIntersection<PluginBareConfigs>>, "src"> & {
src?: CombineSrc<PickSrcExtensions<PluginBareConfigs>>;
};
/* Excluded from this release type: CONTENT_REAL_LOAD_START */
/**
* @public
*/
declare const /**
@public
* when a new player is inserted into the HTML
*/ /**
* @public
*/
CONTEXT_MENU = "contextmenu";
/**
* @public
*/
declare type ContextMenuEventDetail = null;
/**
* @public
*/
export declare type ControllerConfig = {
parameters: MacrosMap;
muted: boolean;
autoplay: boolean;
timeout: number;
show_all_ads_on_seek: boolean;
preload_advance: number;
preload_ads: boolean;
video_source: string;
};
/**
* @public
* @deprecated
* when a cuepoint becomes inactive
*/
declare const /**
@public
* when a new player is inserted into the HTML
*/ /**
* @public
* @deprecated
* when a cuepoint becomes inactive
*/
CUEPOINT_END = "cuepointend";
/**
* @public
* @deprecated
* when a cuepoint is active
*/
declare const /**
@public
* when a new player is inserted into the HTML
*/ /**
* @public
* @deprecated
* when a cuepoint is active
*/
CUEPOINT_START = "cuepointstart";
/**
* @public
* @deprecated
* cuepoints parsing is asynchronous
* you cannot rely on them existing until
* this event is emitted
*/
declare const /**
@public
* when a new player is inserted into the HTML
*/ /**
* @public
* @deprecated
* cuepoints parsing is asynchronous
* you cannot rely on them existing until
* this event is emitted
*/
CUEPOINTS = "cuepoints";
/**
* @public
*/
declare const /**
@public
* when a new player is inserted into the HTML
*/ /**
* @public
*/
DATA = "loadeddata";
/**
* @public
*/
declare const /**
@public
* when a new player is inserted into the HTML
*/ /**
* @public
*/
DBL_CLICK = "dblclick";
declare const DESTROYED = "is-destroyed";
/* Excluded from this release type: DeviceId */
declare const DISABLED = "is-disabled";
/**
* @public
*/
declare const /**
@public
* when a new player is inserted into the HTML
*/ /**
* @public
*/
DURATION_CHANGE = "durationchange";
/**
* @public
* when the player has started playing dvr content
*/
declare const /**
@public
* when a new player is inserted into the HTML
*/ /**
* @public
* when the player has started playing dvr content
*/
DVR = "dvr";
/**
* @public
*/
declare type DvrEventDetail = number;
declare const ENDED = "is-ended";
/**
* @public
*/
declare const /**
@public
* when a new player is inserted into the HTML
*/ /**
* @public
*/
ENDED_2 = "ended";
declare type EnsureOnAttached<P extends Function, T extends Player> = ExtractPureAPI<T> extends _AttachedEventCheck ? P : "Loaders must implement on('<pluginname>:attached') event";
/**
* @public
*/
declare const /**
@public
* when a new player is inserted into the HTML
*/ /**
* @public
*/
ERROR = "error";
declare const ERRORED = "is-error";
declare class EventBus {
private _bus;
private _listeners;
constructor(_bus?: HTMLDivElement, _listeners?: Array<[string, Listener]>);
removeAllListeners(): void;
emit<T>(eventName: string, detail: T): void;
on<T>(eventName: string, handler: Listener<T>): void;
once<T>(eventName: string, handler: Listener<T>): void;
removeListener(eventName: string, handler: Listener): void;
}
declare namespace events {
export {
MOUNT,
RETRY,
ERROR,
CONTEXT_MENU,
CLICK,
DBL_CLICK,
KEYUP,
KEYDOWN,
LOAD,
MOUSE_ENTER,
MOUSE_LEAVE,
MOUSE_UP,
MOUSE_DOWN,
MOUSE_MOVE,
TOUCH_START,
TOUCH_MOVE,
TOUCH_END,
TOUCH_CANCEL,
RESIZE,
SCROLL,
FULLSCREEN_ENTER,
FULLSCREEN_EXIT,
FULLSCREEN_CHANGE,
METADATA,
DATA,
PROGRESS,
TIME_UPDATE,
LOAD_START,
VOLUME_CHANGE,
PAUSE,
PLAYING_2 as PLAYING,
PLAY,
WAITING_2 as WAITING,
CAN_PLAY,
ENDED_2 as ENDED,
SEEKED,
SEEKING_2 as SEEKING,
DURATION_CHANGE,
VIEW_ENTER,
VIEW_LEAVE,
SOURCE,
REAP,
QUALITIES,
QUALITY_CHANGE,
VIDEO_TRACKS,
SET_QUALITY,
VIDEO_TRACK_SELECT,
RECOMMENDATIONS_READY,
LANDSCAPE,
PORTRAIT,
DVR,
LIVE,
RECOVER,
CUEPOINTS,
CUEPOINT_START,
CUEPOINT_END,
STANDARD_ERROR
}
}
declare namespace events_2 {
export {
AD_PLAYBACK_ERROR,
AD_TEARDOWN,
AD_VIDEOTAG_ATTACHED,
AD_REQUEST_ERROR,
AD_REQUESTED,
AD_REQUEST_COMPLETED,
AD_PAUSE_CONTENT,
AD_STARTED,
AD_COMPLETED,
AD_PAUSED,
AD_RESUMED,
AD_PROGRESS,
AD_SKIPPED,
AD_MUTED,
AD_VOLUME_CHANGED,
AD_TIMEOUT,
AD_BREAK_COMPLETED,
AD_POSTROLL_FINISHED,
AD_PREROLL_FINSIHED,
IMA_ADAPTER_INIT,
IMA_BEFORE_ADS_REQUEST,
IMA_ADS_RENDERING_SETTINGS,
ADAPTER_INIT_FAILED,
AD_PLAY_REQUESTED,
RELOAD_AD_REQUESTED,
REQUEST_AD_PAUSE,
REQUEST_AD_PLAY,
REQUEST_AD_MUTE_UNMUTE,
PBJS_AVAILABLE
}
}
declare type ExtractBareConfig<Plugins extends PluginCtor> = Plugins extends PluginCtor<ConfigWith<infer ConfigType>> ? ConfigType : never;
declare type ExtractPluginPlayerExtension<Plugin extends PluginCtor> = Plugin extends PluginCtor<infer _uConfigType, PlayerWith<infer PluginPlayer>> ? PluginPlayer : never;
declare type ExtractPureAPI<T> = T extends PlayerWith<infer PureAPI> ? PureAPI : never;
declare type ExtractSrcExtension<PluginBareConfig> = Get<PluginBareConfig, "src"> extends UnsafeSource<infer SrcMixinType> ? SrcMixinType : never;
declare type FilterNewSourceTypes<PluginSrcs extends unknown[]> = {
[Index in keyof PluginSrcs]: PluginSrcs[Index] extends {
type: string;
} ? PluginSrcs[Index] : never;
};
declare namespace Flags_2 {
export {
STICKY_CONTROLS,
NO_FULLSCREEN,
NO_AD_INDICATOR,
AD_ATTRIBUTION,
AD_CHOICES,
REMAINING_TIME,
VOLUME_BAR
}
}
/**
* @public
*/
declare type FlowplayerCustomElementRegistry = Map<string, string>;
declare class FlowplayerError extends Error {
readonly message: string;
readonly flowplayerErrorCode: FlowplayerErrorCode;
readonly config: FlowplayerErrorConfig;
static getErrorKey(code: FlowplayerErrorCode): FlowplayerErrorCodeName;
readonly id: string;
readonly isFatal: boolean;
readonly errorKey: string;
constructor(message: string, flowplayerErrorCode: FlowplayerErrorCode, config?: FlowplayerErrorConfig);
toJSON(): {
message: string;
flowplayer_error_code: FlowplayerErrorCode;
id: string;
root_error_id: string | undefined;
resource: string | undefined;
is_fatal: boolean;
is_retry: boolean;
};
}
declare type FlowplayerErrorCode = (typeof FlowplayerErrorCodeMap)[keyof typeof FlowplayerErrorCodeMap];
declare const FlowplayerErrorCodeMap: {
/** Unknown */
readonly Unknown: "00-00";
/** Media Section */
readonly MediaUnknown: "01-00";
readonly MediaUnavailable: "01-01";
readonly MediaUnsupportedVideoFormat: "01-02";
readonly MediaUnsupportedAudioFormat: "01-03";
readonly MediaBitrateExceeded: "01-04";
readonly MediaBufferOverread: "01-05";
readonly MediaIntegerOverflow: "01-06";
readonly MediaQuotaExceeded: "01-07";
readonly MediaInvalidCompositionDuration: "01-08";
readonly MediaInvalidCompositionSourceDuration: "01-09";
readonly MediaInvalidCompositionSourceStartTime: "01-10";
readonly MediaMalformedDepth: "01-11";
/** Playback Section */
readonly PlaybackUnknown: "02-00";
readonly PlaybackVideoBufferUnderRun: "02-01";
readonly PlaybackAudioBufferUnderRun: "02-02";
readonly PlaybackVideoBufferingTimeout: "02-03";
readonly PlaybackAudioBufferingTimeout: "02-04";
readonly PlaybackManifestParseError: "02-05";
readonly PlaybackVideoDecodeError: "02-06";
readonly PlaybackAudioDecodeError: "02-07";
readonly PlaybackDroppedFramesExceeded: "02-08";
readonly PlaybackPlayheadExceedsDuration: "02-09";
readonly PlaybackUnsupportedDevice: "02-10";
readonly PlaybackManifestLoadError: "02-11";
readonly PlaybackManifestLoadTimeout: "02-12";
readonly PlaybackManifestParsingError: "02-13";
readonly PlaybackManifestIncompatibleCodecs: "02-14";
readonly PlaybackLevelEmptyError: "02-15";
readonly PlaybackLevelLoadError: "02-16";
readonly PlaybackLevelLoadTimeout: "02-17";
readonly PlaybackLevelSwitchError: "02-18";
readonly PlaybackAudioTrackLoadError: "02-19";
readonly PlaybackAudioTrackLoadTimeout: "02-20";
readonly PlaybackFragLoadError: "02-21";
readonly PlaybackFragLoadTimeout: "02-22";
readonly PlaybackFragDecryptError: "02-23";
readonly PlaybackFragParsingError: "02-24";
readonly PlaybackFragGap: "02-25";
readonly PlaybackRemuxAllocError: "02-26";
readonly PlaybackBufferAddCodecError: "02-27";
readonly PlaybackBufferIncompatibleCodecs: "02-28";
readonly PlaybackBufferAppendError: "02-29";
readonly PlaybackBufferStalledError: "02-30";
readonly PlaybackBufferFullError: "02-31";
readonly PlaybackBufferSeekOverHole: "02-32";
readonly PlaybackBufferNudgeOnStall: "02-33";
readonly PlaybackInternalException: "02-34";
readonly PlaybackInternalAborted: "02-35";
readonly PlaybackManifestLoaderFailure: "02-36";
readonly PlaybackSegmentBaseLoaderError: "02-37";
readonly PlaybackTimeSyncFailed: "02-38";
readonly PlaybackFragmentLoaderFailure: "02-39";
readonly PlaybackAppendError: "02-40";
readonly PlaybackRemoveError: "02-41";
readonly PlaybackDataUpdateFailed: "02-42";
readonly PlaybackManifestNoStreams: "02-43";
readonly PlaybackUnknownManifestType: "02-44";
readonly PlaybackDashInsufficientSegmentInfo: "02-45";
readonly PlaybackDashNoRepresentations: "02-46";
readonly PlaybackDashNoAdaptationSets: "02-47";
readonly PlaybackDashNoInitSegment: "02-48";
readonly PlaybackDashUnsupportedContainerFormat: "02-49";
readonly PlaybackDashKeySystemMismatch: "02-50";
readonly PlaybackMultipleKeyIDs: "02-51";
readonly PlaybackDashConflictingKeyIDs: "02-52";
readonly PlaybackRestrictedStreams: "02-53";
readonly PlaybackHlsMasterAndMediaTags: "02-54";
readonly PlaybackRepresentationIdConflict: "02-55";
readonly PlaybackHlsUnsupportedKeyFormats: "02-56";
readonly PlaybackManifestNoVariants: "02-57";
readonly PlaybackHlsUndeclaredVariables: "02-58";
readonly PlaybackAes128InvalidKeyLength: "02-59";
readonly PlaybackDashConflictingAes128Keys: "02-60";
readonly PlaybackDashUnsupportedAes128Encryption: "02-61";
readonly PlaybackManifestPatchMismatch: "02-62";
readonly PlaybackEmptyMediaPlaylist: "02-63";
readonly PlaybackNonContiguousCompositionTrack: "02-64";
readonly PlaybackDecoderNotFound: "02-65";
readonly PlaybackDecoderTemporarilyUnavailable: "02-66";
readonly PlaybackIncompatibleAsset: "02-67";
readonly PlaybackNoCompatibleExternalDisplay: "02-69";
readonly PlaybackOutOfMemory: "02-70";
readonly PlaybackToneMappingFailed: "02-71";
readonly PlaybackVideoCompositorFailed: "02-72";
/** Network Section */
readonly NetworkUnknown: "03-00";
readonly NetworkNoInternet: "03-01";
readonly NetworkRequestTimeout: "03-02";
readonly NetworkUnableToResolveHost: "03-03";
readonly NetworkResourceNotFound: "03-04";
readonly NetworkExpiredUrl: "03-05";
readonly NetworkUrlResolutionFailed: "03-06";
readonly NetworkDownloadErrorIdManifest: "03-07";
readonly NetworkDownloadErrorIdSidx: "03-08";
readonly NetworkDownloadErrorIdContent: "03-09";
readonly NetworkDownloadErrorIdInitialization: "03-10";
readonly NetworkDownloadErrorIdXlink: "03-11";
readonly NetworkHttpRequestFailed: "03-12";
readonly NetworkMaxRetriesExceeded: "03-13";
readonly NetworkSegmentMissing: "03-14";
/** HTTP Error Codes */
readonly NetworkHttp400BadRequest: "03-400";
readonly NetworkHttp401Unauthorized: "03-401";
readonly NetworkHttp402PaymentRequired: "03-402";
readonly NetworkHttp403Forbidden: "03-403";
readonly NetworkHttp404NotFound: "03-404";
readonly NetworkHttp405MethodNotAllowed: "03-405";
readonly NetworkHttp406NotAcceptable: "03-406";
readonly NetworkHttp407ProxyAuthenticationRequired: "03-407";
readonly NetworkHttp408RequestTimeout: "03-408";
readonly NetworkHttp409Conflict: "03-409";
readonly NetworkHttp410Gone: "03-410";
readonly NetworkHttp411LengthRequired: "03-411";
readonly NetworkHttp412PreconditionFailed: "03-412";
readonly NetworkHttp413PayloadTooLarge: "03-413";
readonly NetworkHttp414URITooLong: "03-414";
readonly NetworkHttp415UnsupportedMediaType: "03-415";
readonly NetworkHttp416RangeNotSatisfiable: "03-416";
readonly NetworkHttp417ExpectationFailed: "03-417";
readonly NetworkHttp418ImATeapot: "03-418";
readonly NetworkHttp421MisdirectedRequest: "03-421";
readonly NetworkHttp422UnprocessableEntity: "03-422";
readonly NetworkHttp423Locked: "03-423";
readonly NetworkHttp424FailedDependency: "03-424";
readonly NetworkHttp425TooEarly: "03-425";
readonly NetworkHttp426UpgradeRequired: "03-426";
readonly NetworkHttp428PreconditionRequired: "03-428";
readonly NetworkHttp429TooManyRequests: "03-429";
readonly NetworkHttp431RequestHeaderFieldsTooLarge: "03-431";
readonly NetworkHttp451UnavailableForLegalReasons: "03-451";
readonly NetworkHttp500InternalServerError: "03-500";
readonly NetworkHttp501NotImplemented: "03-501";
readonly NetworkHttp502BadGateway: "03-502";
readonly NetworkHttp503ServiceUnavailable: "03-503";
readonly NetworkHttp504GatewayTimeout: "03-504";
readonly NetworkHttp505HTTPVersionNotSupported: "03-505";
readonly NetworkHttp506VariantAlsoNegotiates: "03-506";
readonly NetworkHttp507InsufficientStorage: "03-507";
readonly NetworkHttp508LoopDetected: "03-508";
readonly NetworkHttp510NotExtended: "03-510";
readonly NetworkHttp511NetworkAuthenticationRequired: "03-511";
/** Content Protection Section */
readonly ContentProtectionUnknown: "04-00";
readonly ContentProtectionConcurrentStreamLimitExceeded: "04-01";
readonly ContentProtectionEntitlementRefused: "04-02";
readonly ContentProtectionLicenseExpired: "04-03";
readonly ContentProtectionBadLicenseRequest: "04-04";
readonly ContentProtectionLicenseServerTimeout: "04-05";
readonly ContentProtectionInsufficientHDCPSupport: "04-06";
readonly ContentProtectionGeoRestricted: "04-07";
readonly ContentProtectionParentalControlRestricted: "04-08";
readonly ContentProtectionCDNUnauthorized: "04-09";
readonly ContentProtectionInvalidAccessToken: "04-10";
readonly ContentProtectionKeySystemNoKeys: "04-11";
readonly ContentProtectionKeySystemNoAccess: "04-12";
readonly ContentProtectionKeySystemNoSession: "04-13";
readonly ContentProtectionKeySystemNoConfiguredLicense: "04-14";
readonly ContentProtectionKeySystemCertificateRequestFailed: "04-15";
readonly ContentProtectionKeySystemCertificateUpdateFailed: "04-16";
/** Key System: Session update failed */
readonly ContentProtectionKeySystemSessionUpdateFailed: "04-17";
/** Key System: Status output restricted */
readonly ContentProtectionKeySystemStatusOutputRestricted: "04-18";
/** Key System: Status internal error */
readonly ContentProtectionKeySystemStatusInternalError: "04-19";
/** Key Load Error */
readonly ContentProtectionKeyLoadError: "04-20";
/** Key Load Timeout */
readonly ContentProtectionKeyLoadTimeout: "04-21";
/** Capability MediaKeys Error */
readonly ContentProtectionCapabilityMediaKeysError: "04-22";
/** Manifest indicated protected content, but unable to determine key systems */
readonly ContentProtectionManifestKeySystemUnknown: "04-23";
/**
* None of the requested key system configurations are available.
* Possible reasons:
* - Key system not supported
* - Requested features (e.g., persistent state) not supported
* - User denied access in prompt
* - Key system unavailable in insecure contexts (requires HTTPS)
*/
readonly ContentProtectionKeySystemUnavailable: "04-24";
/** Browser found requested key system, but failed to create CDM instance */
readonly ContentProtectionCDMCreationFailed: "04-25";
/** Browser created CDM instance but failed to attach it to the video */
readonly ContentProtectionCDMAttachFailed: "04-26";
/** CDM rejected the server certificate (malformed or unsupported format) */
readonly ContentProtectionCDMServerCertificateRejected: "04-27";
/** CDM refused to create a session for unknown reasons */
readonly ContentProtectionCDMSessionCreationFailed: "04-28";
/** CDM unable to generate a license request due to malformed or unsupported init data */
readonly ContentProtectionCDMLicenseRequestFailed: "04-29";
/** License response rejected by the CDM (invalid/malformed response) */
readonly ContentProtectionCDMLicenseResponseRejected: "04-30";
/** Manifest does not specify DRM info, but content is encrypted */
readonly ContentProtectionManifestMissingDRMInfo: "04-31";
/** No license server was provided for the key system signaled by the manifest */
readonly ContentProtectionLicenseServerMissing: "04-32";
/** A required offline session was removed, affecting playback */
readonly ContentProtectionOfflineSessionRemoved: "04-33";
/** Error while executing init data transformation */
readonly ContentProtectionInitDataTransformationError: "04-34";
/** Server certificate request failed */
readonly ContentProtectionServerCertificateRequestFailed: "04-35";
/** HDCP version does not meet the requirements */
readonly ContentProtectionInsufficientHDCPVersion: "04-36";
/** Error when checking HDCP version */
readonly ContentProtectionHDCPVersionCheckFailed: "04-37";
/** Ads Section */
readonly AdsUnknown: "08-00";
readonly AdsVastParseError: "08-100";
readonly AdsInvalidVastSchema: "08-101";
readonly AdsVastVersionNotSupported: "08-102";
readonly AdsUnexpectedAdType: "08-200";
readonly AdsCreativeLinearityMismatch: "08-201";
readonly AdsCreativeDurationMismatch: "08-202";
readonly AdsCreativeSizeMismatch: "08-203";
readonly AdsWrapperVastError: "08-300";
readonly AdsVastResponseRedirectTimeout: "08-301";
readonly AdsWrapperLimitReached: "08-302";
readonly AdsVastResponseEmpty: "08-303";
readonly AdsLinearAdDisplayError: "08-400";
readonly AdsMediaFileNotFound: "08-401";
readonly AdsMediaFileUnavailable: "08-402";
readonly AdsUnsupportedMimeType: "08-403";
readonly AdsUnableToDisplayMediaFile: "08-405";
readonly AdsMezzanineFileMissing: "08-406";
readonly AdsMezzanineFileDownloaded: "08-407";
readonly AdsRejectedAd: "08-408";
readonly AdsInteractiveCreativeError: "08-409";
readonly AdsVerificationNodeExecutionError: "08-410";
readonly AdsNonLinearAdDisplayError: "08-500";
readonly AdsNonLinearAdSizeMismatch: "08-501";
readonly AdsNonLinearAdFetchError: "08-502";
readonly AdsNonLinearUnsupportedType: "08-503";
readonly AdsCompanionAdDisplayError: "08-600";
readonly AdsCompanionAdSizeMismatch: "08-601";
readonly AdsRequiredCompanionAdError: "08-602";
readonly AdsCompanionAdFetchError: "08-603";
readonly AdsUndefinedVastError: "08-900";
readonly AdsUnknownVpaidError: "08-901";
readonly AdsVastDocumentEmpty: "08-999";
};
declare type FlowplayerErrorCodeName = keyof typeof FlowplayerErrorCodeMap;
declare type FlowplayerErrorConfig = Partial<{
isFatal: boolean;
showErrorUI: boolean;
isRetry: boolean;
resource: string;
rootErrorId: string;
retryOpts: Partial<{
retry: (typeof RetryMap)[keyof typeof RetryMap];
retryTimeout: number;
}>;
}> & Record<string, any>;
declare type FlowplayerErrorEventDetail = {
error: FlowplayerError;
};
/**
* @public
*/
declare type FlowplayerStates = typeof states;
/**
* @public
*/
declare interface FlowplayerUMD extends FlowplayerUMDBase {
/**
* Configure flowplayer and display it in the UI
* @param selector - query selector of the HTML element where player will render
* @param config - configuration of flowplayer
*/
(selector: string, config?: Config): Player;
/**
* Configure flowplayer and display it in the UI
* @param element - HTML element where player will render
* @param config - configuration of flowplayer
*/
(element: HTMLElement, config?: Config): Player;
/**
* Configure flowplayer and display it in the UI
* @param selector - query selector of the HTML element where player will render
* @param config - configuration of flowplayer
*/
<T>(selector: string, config?: ConfigWith<T>): Player;
/**
* Configure flowplayer and display it in the UI
* @param element - HTML element where player will render
* @param config - configuration of flowplayer
*/
<T>(element: HTMLElement, config?: ConfigWith<T>): Player;
/**
* Register plugins in flowplayer
* @returns flowplayer instance with registered plugins
*/
<PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<MergeConfigs<PluginCtors>, PlayerWith<MergePlayerExtensions<PluginCtors>>>;
}
declare interface FlowplayerUMDBase {
/**
* All player instances on the page
*/
instances: Player[];
/**
* Flowplayer core events
*/
events: typeof events;
/**
* Flowplayer ui states map
*/
states: FlowplayerStates;
/**
* Flowplayer errors map
*/
errors: typeof FlowplayerErrorCodeMap;
quality: typeof QualityOpts;
autoplay: typeof AutoplayOpts;
commit: string;
version: string;
/**
* Flowplayer's custom element registry
*/
customElements: FlowplayerCustomElementRegistry;
/* Excluded from this release type: extensions */
/* Excluded from this release type: defaultElements */
/* Excluded from this release type: components */
/* Excluded from this release type: support */
/* Excluded from this release type: jwt */
/* Excluded from this release type: loaders */
}
/**
* @public
*/
declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config, PluginPlayer extends Player = Player> extends FlowplayerUMDBase {
/**
* Configure flowplayer, it's attached plugins and display flowplayer it in the UI
* @param selector - query selector of the HTML element where player will render
* @param config - Configuration of the flowplayer and the attached plugins
*/
(selector: string, config?: ConfigWithPlugins): PlayerWithOpts<PluginPlayer, ConfigWithPlugins>;
/**
* Configure flowplayer, it's attached plugins and display flowplayer it in the UI
* @param element - HTML element where player will render
* @param config - Configuration of the flowplayer and the attached plugins
*/
(element: HTMLElement, config?: ConfigWithPlugins): PlayerWithOpts<PluginPlayer, ConfigWithPlugins>;
}
/**
* @public
*/
declare interface FPEvent<T> extends CustomEvent<T> {
/**
* @deprecated
the data attribute has been migrated to details to match the CustomEvent spec
more info: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
*/
data?: T;
}
declare const FULLSCREEN = "is-fullscreen";
/**
* @public
*/
declare const /**
@public
* when a new player is inserted into the HTML
*/ /**
* @public
*/
FULLSCREEN_CHANGE = "fullscreenchange";
/**
* @public
*/
declare const /**
@public
* when a new player is inserted into the HTML
*/ /**
* @public
*/
FULLSCREEN_ENTER = "fullscreenenter";
/**
* @public
*/
declare const /**
@public
* when a new player is inserted into the HTML
*/ /**
* @public
*/
FULLSCREEN_EXIT = "fullscreenexit";
export declare namespace google {
/**
* The Google IMA SDK for HTML5 V3 allows developers to request and track VAST ads in a HTML5 video environment. For platform compatibility information and a detailed list of the video ad features supported by each of the IMA SDKs, see Support and Compatibility.
*
* Download the code samples to assist with implementing the IMA HTML5 SDK.
*/
export namespace ima {
/**
* An ad class that's extended by classes representing different ad types.
*/
export interface Ad {
/**
* Ad ID is used to synchronize master ad and companion ads.
* @returns The ID of the ad, or the empty string if this information is unavailable.
*/
getAdId(): string;
/**
* Returns the ad's pod information.
* @returns The ad's pod information.
*/
getAdPodInfo(): AdPodInfo;
/**
* The source ad server information included in the ad response.
* @returns The source ad server of the ad, or the empty string if this information is unavailable.
*/
getAdSystem(): string;
/**
* The advertiser name as defined by the serving party.
* @returns The advertiser name, or the empty string if this information is unavailable.
*/
getAdvertiserName(): string;
/**
* Identifies the API needed to execute the ad. This corresponds with the apiFramework specified in vast.
* @returns The API framework need to execute the ad, or null if this information is unavailable.
*/
getApiFramework(): string | null;
/**
* Gets the companion ads for this ad based on companion ad slot size. Optionally, advanced selection settings are accepted. Note that this method will only return non-empty array for ad instances acquired on or after STARTED event. Specifically, ads from the LOADED event will return an empty array.
* @param adSlotWidth Width of the companion ad slot.
* @param adSlotHeight Height of the companion ad slot.
* @param settings The selection settings for companion ads.
* @returns Array of companion ads that matches the settings and the slot size.
*/
getCompanionAds(
adSlotWidth: number,
adSlotHeight: number,
settings?: CompanionAdSelectionSettings
): CompanionAd[];
/**
* Returns the content type of the currently selected creative, or empty string if no creative is selected or the content type is unavailable. For linear ads, the content type is only going to be available after the START event, when the media file is selected.
* @returns The content type, empty string if not available.
*/
getContentType(): string;
/**
* Returns the ISCI (Industry Standard Commercial Identifier) code for an ad, or empty string if the code is unavailable. This is the Ad-ID of the creative in the VAST response.
*/
getCreativeAdId(): string;
/**
* Retrieves the ID of the selected creative for the ad.
* @returns The ID of the selected creative for the ad, or the empty string if this information is unavailable.
*/
getCreativeId(): string;
/**
* Returns the first deal ID present in the wrapper chain for the current ad, starting from the top. Returns the empty string if unavailable.
*/
getDealId(): string;
/**
* Returns the description of this ad from the VAST response.
* @returns The description, empty if not specified.
*/
getDescription(): string;
/**
* Returns the duration of the selected creative, or -1 for non-linear creatives.
* @returns The selected creative duration in seconds, -1 if non-linear.
*/
getDuration(): number;
/**
* Returns the height of the selected non-linear creative.
* @returns The height of the selected non-linear creative or 0 for a linear creative.
*/
getHeight(): number;
/**
* Returns the URL of the media file chosen from the ad based on the media selection settings currently in use. Returns null if this information is unavailable. Available on STARTED event.
*/
getMediaUrl(): string | null;
/**
* Returns the minimum suggested duration in seconds that the nonlinear creative should be displayed. Returns -2 if the minimum suggested duration is unknown. For linear creative it returns the entire duration of the ad.
* @returns The minimum suggested duration in seconds that a creative should be displayed.
*/
getMinSuggestedDuration(): number;
/**
* The number of seconds of playback before the ad becomes skippable. -1 is returned for non skippable ads or if this is unavailable.
* @returns The offset in seconds, or -1.
*