UNPKG

@asicupv/paella-video-plugins

Version:
1,639 lines (1,638 loc) 61.1 kB
// Generated by dts-bundle-generator v9.5.1 declare class PlayerResource { #private; /** * Creates a new PlayerResource instance */ constructor(player: Paella); /** * Gets the player instance */ get player(): Paella; } export type CreateElementAttributes = { tag?: string; attributes?: Record<string, string>; children?: string | null; parent?: HTMLElement | null; innerText?: string | null; }; export type DomShowParams = { icon?: string | null; text?: string; timeout?: number; position?: string; cssClass?: string; }; declare class DomClass extends PlayerResource { #private; /** * Creates a new DomClass instance with a DOM element * @param {Paella} player - The player instance * @param {object} options - DOM element creation options * @param {string} [options.tag='div'] - HTML tag name for the element * @param {Record<string, string>} [options.attributes=[]] - Element attributes * @param {string} [options.children=""] - Inner HTML content * @param {HTMLElement|null} [options.parent=null] - Parent element to append to */ constructor(player: Paella, { tag, attributes, children, parent }: CreateElementAttributes); /** * Gets the DOM element associated with this instance * @returns {HTMLElement} The DOM element */ get element(): HTMLElement; /** * Gets the parent element of this DOM element * @returns {HTMLElement|null} The parent element, or null if no parent */ get parent(): HTMLElement | null; /** * Hides the DOM element by setting display style to "none" */ hide(): void; /** * Shows the DOM element by removing the display style restriction * @param {string} [showMode="block"] - The display mode to use when showing */ show(showMode?: string | DomShowParams): void; /** * Gets whether the element is currently visible * @returns {boolean} True if the element is visible, false otherwise */ get isVisible(): boolean; /** * Sets an attribute on the DOM element * @param {string} name - The attribute name * @param {string} value - The attribute value */ setAttribute(name: string, value: string): void; /** * Removes this element from its parent */ removeFromParent(): void; /** * Sets a new parent for this element, removing it from the current parent first * @param {HTMLElement} parent - The new parent element */ setParent(parent: HTMLElement): void; } declare class ErrorContainer extends DomClass { constructor(player: Paella, message?: string); } export interface Source { src: string; mimetype: string; res?: { w: number; h: number; }; } export interface Stream { content: string; role?: string; canvas?: string | string[]; sources: { html?: Source[]; mp4?: Source[]; hls?: Source[]; hlsLive?: Source[]; }; } export type Language = "aa" | "ab" | "ae" | "af" | "ak" | "am" | "an" | "ar" | "as" | "av" | "ay" | "az" | "ba" | "be" | "bg" | "bh" | "bi" | "bm" | "bn" | "bo" | "br" | "bs" | "ca" | "ce" | "ch" | "co" | "cr" | "cs" | "cu" | "cv" | "cy" | "da" | "de" | "dv" | "dz" | "ee" | "el" | "en" | "eo" | "es" | "et" | "eu" | "fa" | "ff" | "fi" | "fj" | "fo" | "fr" | "fy" | "ga" | "gd" | "gl" | "gn" | "gu" | "gv" | "ha" | "he" | "hi" | "ho" | "hr" | "ht" | "hu" | "hy" | "hz" | "ia" | "id" | "ie" | "ig" | "ii" | "ik" | "io" | "is" | "it" | "iu" | "ja" | "jv" | "ka" | "kg" | "ki" | "kj" | "kk" | "kl" | "km" | "kn" | "ko" | "kr" | "ks" | "ku" | "kv" | "kw" | "ky" | "la" | "lb" | "lg" | "li" | "ln" | "lo" | "lt" | "lu" | "lv" | "mg" | "mh" | "mi" | "mk" | "ml" | "mn" | "mr" | "ms" | "mt" | "my" | "na" | "nb" | "nd" | "ne" | "ng" | "nl" | "nn" | "no" | "nr" | "nv" | "ny" | "oc" | "oj" | "om" | "or" | "os" | "pa" | "pi" | "pl" | "ps" | "pt" | "qu" | "rm" | "rn" | "ro" | "ru" | "rw" | "sa" | "sc" | "sd" | "se" | "sg" | "si" | "sk" | "sl" | "sm" | "sn" | "so" | "sq" | "sr" | "ss" | "st" | "su" | "sv" | "sw" | "ta" | "te" | "tg" | "th" | "ti" | "tk" | "tl" | "tn" | "to" | "tr" | "ts" | "tt" | "tw" | "ty" | "ug" | "uk" | "ur" | "uz" | "ve" | "vi" | "vo" | "wa" | "wo" | "xh" | "yi" | "yo" | "za" | "zh" | "zu"; export type Dictionary = Record<string, string>; export type Dictionaries = Partial<Record<Language, Dictionary>>; export type CookieConsentData = { /** Type of the cookie consent, for example `analytical` */ type?: string; /** Human readable name of the cookie consent, for example 'Analytical Cookies' */ title?: string; /** Description of the cookie consent, for example 'Cookies used to analyze the user behavior' */ description?: string; /** Is this cookie group required for the website to work? */ required?: boolean; /** Is enabled by default? */ value?: boolean; }; export type GetCookieConsentCallback = (type: string) => boolean; export type GetCookieDescriptionCallback = (cookieObject: CookieConsentData) => string; declare class CookieConsent { private _player; private _cookieConsentData; private _getConsentCallback; private _getDescriptionCallback; constructor(player: Paella, { getConsent, getDescription }?: { getConsent?: GetCookieConsentCallback; getDescription?: GetCookieDescriptionCallback; }); updateConsentData(): void; getConsentForType(type: string): boolean; } export type LogLevel = "DISABLED" | "ERROR" | "WARN" | "INFO" | "DEBUG" | "VERBOSE"; export type DynamicLayoutAlignment = "align-center" | "align-top" | "align-bottom" | "align-left" | "align-right"; export type ButtonPluginSide = "left" | "right"; export type ButtonSize = "small" | "medium" | "large"; export type PopUpType = "timeline" | "modal"; export type VideoLayaoutValidContent = { id: string; content: string[]; icon?: string | null; title?: string | null; }; export type PluginConfig = { enabled?: boolean; order?: number; description?: string; }; export type CanvasPluginConfig = PluginConfig & {}; export type EventLogPluginConfig = PluginConfig & { context?: string[] | string; target?: string | string[]; events?: string[]; logLevel?: LogLevel; }; export type VideoPluginConfig = PluginConfig & {}; export type UserInterfacePluginConfig = PluginConfig & { parentContainer?: string; id?: string; name?: string; ariaLabel?: string; tabIndex?: number; size?: ButtonSize; side?: ButtonPluginSide; }; export type ButtonPluginConfig = UserInterfacePluginConfig & { minContainerSize?: number; urlTarget?: string; closeParentPopUp?: boolean; closePopUps?: boolean; }; export type PopUpButtonPluginConfig = ButtonPluginConfig & { customPopUpClass?: string; popUpType?: PopUpType; closeOnSelect?: boolean; menuTitle?: string; targetContent?: string; }; export type MenuButtonPluginConfig = PopUpButtonPluginConfig & { groupName?: string; allowMultipleSelection?: boolean; }; export type VideoLayoutPluginConfig = PluginConfig & { tabIndexStart?: number; validContent?: VideoLayaoutValidContent[]; }; export type DataPluginConfig = PluginConfig & { context?: string[]; }; export type GenericPluginConfig = MenuButtonPluginConfig & VideoLayoutPluginConfig & DataPluginConfig & CanvasPluginConfig & EventLogPluginConfig & VideoPluginConfig & Record<string, any>; export type PreferencesSources = { /** Store settings in cookies */ cookie?: { /** Consent type used to store the settings (see Cookie Consent settings) */ consentType: string; }; /** Store settings using a Data plugin */ dataPlugin?: { /** Context of the data plugin to use */ context: string; name: string; }; }; export type ButtonGroupConfig = { /** Enable or disable the button group */ enabled: boolean; /** Button group name. This name will be used in the child buttons as `parentContainer` attribute */ groupName: string; /** Button group description */ description: string; /** Button group icon */ icon?: string; /** Loading order */ order?: number; /** Button group position */ side?: ButtonPluginSide; /** Parent button group name */ parentContainer?: string; /** Title used in the menu title bar */ menuTitle?: string; }; export interface Config { /** Default video ID to be used when one is not specified explicitly */ fallbackId?: string; /** Default directory with the manifest video repository */ repositoryUrl?: string; /** Default manifest file name */ manifestFileName?: string; /** Default layout to be used when one has not yet been configured. */ defaultLayout?: string; /** Default translation language for text strings, when no translations are available for the current language. */ defaultLanguage?: string; /** Default preview image, which is used when one has not been specified in the video manifest. */ defaultVideoPreview?: string; /** Default preview image for the portrait mode, which is used when one has not been specified in the video manifest. */ defaultVideoPreviewPortrait?: string; /** Log level to use */ logLevel?: LogLevel; /** General user interface settings */ ui?: { /** Timeout to hide the interface, from when the user stops interacting with the player. */ hideUITimer?: number; /** Hide the interface when the mouse leaves the video area */ hideOnMouseLeave?: boolean; }; /** Preference storage settings */ preferences?: { /** Storage type to use for the preferences. */ currentSource: string; /** Storage types */ sources: PreferencesSources; }; /** Video container settings */ videoContainer?: { /** Place the video container above or below the playback bar. */ overPlaybackBar?: boolean; /** Restore the playback rate setting in the next player load */ restorePlaybackRate?: boolean; /** Restore the volume setting in the next player load */ restoreVolume?: boolean; /** Restore the video layout in the next load of the current video */ restoreVideoLayout?: { /** Enable or disable this setting */ enabled?: boolean; /** If global=false, then the layout is only restored the next load of the current video */ global?: boolean; }; restoreLastTime?: { /** Enable or disable this setting */ enabled?: boolean; /** Remaining video time after which the last known instant of playback will not be restored */ remainingSeconds?: number; }; /** Alignment of the video canvas in dynamic layout mode */ dynamicLayout?: { landscapeVerticalAlignment?: DynamicLayoutAlignment; portraitHorizontalAlignment?: DynamicLayoutAlignment; }; }; /** Button groups */ buttonGroups?: ButtonGroupConfig[]; /** Cookie consent options */ cookieConsent?: CookieConsentData[]; plugins?: Record<string, GenericPluginConfig>; dictionaries?: Dictionaries; } declare class PluginModule { get moduleName(): string; get moduleVersion(): string; getDictionaries(): Promise<Dictionaries | null>; } declare class Plugin$1<ConfigT extends PluginConfig = PluginConfig> extends PlayerResource { #private; _config: ConfigT; __uiPlugin: boolean; constructor(player: Paella, name: string | null); getPluginModuleInstance(): PluginModule | null; get config(): ConfigT; get type(): string; get order(): number | null; get description(): string | null; get name(): string | null; preload(): void; isEnabled(): Promise<boolean>; load(): Promise<void>; unload(): Promise<void>; } declare class VideoQualityItem { private _label; private _shortLabel; private _index; private _src; private _res; private _bitrate; private _isAuto; constructor({ label, shortLabel, isAuto, index, src, width, height, bitrate }: { label: string; shortLabel: string; isAuto?: boolean; index?: number; src?: string; width?: number; height?: number; bitrate?: number; }); get label(): string; get shortLabel(): string; get index(): number; get src(): string; get res(): { w: number; h: number; }; get bitrate(): number; get isAuto(): boolean; get quality(): number; compare(other: VideoQualityItem): number; } declare class AudioTrackData { #private; constructor({ id, name, groupId, language, selected }: { id: string; name: string; groupId?: string; language?: string; selected?: boolean; }); get id(): string; get name(): string; get groupId(): string; get language(): string; get selected(): boolean; set selected(s: boolean); } declare class VideoPlugin extends Plugin$1 { get type(): string; get streamType(): string; isCompatible(streamData: any): Promise<boolean>; getVideoInstance(playerContainer: HTMLElement, isMainAudio: boolean): Promise<Video | null>; getCompatibleFileExtensions(): string[]; getManifestData(fileUrls: string[]): void; } declare class Video extends DomClass { constructor(tag: string, player: Paella, parent?: HTMLElement | null); isVolumeApiAvailable(): Promise<boolean>; get streamData(): any; get ready(): any; load(streamData: any, streamProvider: typeof StreamProvider): Promise<boolean>; get isMainAudioPlayer(): boolean; onVideoEnded(fn: () => void): void; play(): Promise<boolean>; pause(): Promise<boolean>; duration(): Promise<number>; get currentTimeSync(): number; currentTime(): Promise<number>; setCurrentTime(t: number): Promise<boolean>; volume(): Promise<number>; setVolume(v: number): Promise<boolean>; initVolume(v: number): void; paused(): Promise<boolean>; playbackRate(): Promise<number>; setPlaybackRate(pr: number): Promise<boolean>; getQualities(): Promise<VideoQualityItem[] | null>; setQuality(q: VideoQualityItem): Promise<boolean>; get currentQuality(): VideoQualityItem | null; getDimensions(): Promise<{ w: number; h: number; } | null>; supportsMultiaudio(): Promise<boolean>; getAudioTracks(): Promise<AudioTrackData[] | null>; setCurrentAudioTrack(track: AudioTrackData): Promise<AudioTrackData | null>; get currentAudioTrack(): null; loadStreamData(streamData: any): Promise<boolean>; get isEnabled(): any; enable(): Promise<void>; disable(): Promise<void>; } declare class StreamProvider extends PlayerResource { private _videoContainer; private _streamData; private _streams; private _players; private _mainAudioPlayer; private _timeSync; private _streamSyncTimer; private _timeupdateTimer; private _trimming; constructor(player: Paella, videoContainer: HTMLElement); load(streamData: Stream[]): Promise<void>; unload(): Promise<void>; get players(): Video[]; get streamData(): any[] | null; get streams(): Record<string, any> | null; get mainAudioPlayer(): Video | null; get isTrimEnabled(): boolean; get trimStart(): number; get trimEnd(): number; setTrimming({ enabled, start, end }: { enabled: boolean; start: number; end: number; }): Promise<void>; startStreamSync(): void; stopStreamSync(): void; executeAction(fnName: string, params?: any | any[]): Promise<any[]>; get isLiveStream(): boolean; play(): Promise<any[]>; pause(): Promise<any[]>; stop(): Promise<void>; paused(): Promise<any>; setCurrentTime(t: number): Promise<{ result: any; prevTime: any; newTime: any; }>; currentTime(): Promise<number>; currentTimeIgnoringTrimming(): Promise<number>; volume(): Promise<number>; setVolume(v: number): Promise<any>; duration(): Promise<number>; durationIgnoringTrimming(): Promise<number>; playbackRate(): Promise<number>; setPlaybackRate(rate: number): Promise<any>; getQualityReferencePlayer(): Promise<any>; getCurrentQuality(): Promise<VideoQualityItem | null>; getQualities(): Promise<VideoQualityItem[]>; setQuality(quality: VideoQualityItem): Promise<void>; supportsMultiaudio(): Promise<boolean>; getAudioTracks(): Promise<AudioTrackData[] | null>; setCurrentAudioTrack(track: AudioTrackData): Promise<any>; get currentAudioTrack(): AudioTrackData | null; } declare enum VideoContainerMessagePosition { TOP_LEFT = "topLeft", TOP_MIDDLE = "topMiddle", TOP_RIGHT = "topRight", CENTER_LEFT = "centerLeft", CENTER_MIDDLE = "centerMiddle", CENTER_RIGHT = "centerRight", BOTTOM_LEFT = "bottomLeft", BOTTOM_MIDDLE = "bottomMiddle", BOTTOM_RIGHT = "bottomRight" } declare class VideoContainerMessage extends DomClass { constructor(player: Paella, parent?: HTMLElement | null); show({ icon, text, timeout, position, cssClass }: { icon?: string | null; text?: string; timeout?: number; position?: VideoContainerMessagePosition; cssClass?: string; }): void; } export interface HelpData { title: string; description: string; } declare class UserInterfacePlugin<PluginC extends PluginConfig = PluginConfig> extends Plugin$1<PluginC> { constructor(player: Paella, name: string); getDictionaries(): Promise<Dictionaries | null>; getHelp(): Promise<HelpData | null>; getTranslatedHelp(): Promise<HelpData | null>; onResize({ width, height }: { width: number; height: number; }): void; get hidden(): boolean; } declare class Canvas extends DomClass { constructor(tag: string, player: Paella, parent?: HTMLElement | null); loadCanvas(player: Video): Promise<void>; get userArea(): any; get leftButtonsArea(): any; get centerButtonsArea(): any; get rightButtonsArea(): any; clearButtonsArea(): void; showButtons(): void; hideButtons(): void; } export type CanvasButtonSide = "left" | "center" | "right"; declare class CanvasButtonPlugin<PluginC extends UserInterfacePluginConfig = UserInterfacePluginConfig> extends UserInterfacePlugin<PluginC> { get type(): string; get content(): any; get ariaLabel(): any; getAriaLabel(): string; isCompatible(stream: string): boolean; get tabIndex(): number | undefined; get description(): string; getDescription(): string; get icon(): any; set icon(icon: any); get side(): CanvasButtonSide; get buttonName(): string | null; get position(): "center" | "left" | "right"; get targetContent(): string | null; get button(): HTMLElement | null; action(content: any, player: Paella, canvas: Canvas, canvasPlugin: Plugin): Promise<void>; } export interface TrimmingParams { enabled?: boolean; start?: number; end?: number; } declare class VideoContainer extends DomClass { constructor(player: Paella, parent?: HTMLElement | null); get layoutId(): string; get mainLayoutContent(): string | null; setLayout(layoutId: string, mainContent?: string | null): Promise<boolean>; get validContentIds(): string[]; get validContentSettings(): any[]; get validLayouts(): object[]; get streamData(): Stream[]; get baseVideoRect(): HTMLElement; get streamProvider(): StreamProvider; create(): Promise<void>; load(streamData: Stream[]): Promise<void>; unload(): Promise<void>; updateLayout(mainContent?: string | null): Promise<boolean>; hideUserInterface(): void; showUserInterface(): void; get message(): VideoContainerMessage; get elementSize(): { w: number; h: number; }; get ready(): boolean; get isLiveStream(): boolean; play(): Promise<any>; pause(): Promise<any>; stop(): Promise<any>; paused(): Promise<boolean>; setCurrentTime(t: number): Promise<any>; currentTime(): Promise<number>; volume(): Promise<number>; setVolume(v: number): Promise<any>; duration(): Promise<number>; playbackRate(): Promise<number>; setPlaybackRate(r: number): Promise<any>; get isTrimEnabled(): boolean; get trimStart(): number; get trimEnd(): number; setTrimming({ enabled, start, end }: TrimmingParams): Promise<any>; getVideoRect(target?: string | number | null): { x: number; y: number; width: number; height: number; element: HTMLElement; } | null; appendChild(element: HTMLElement, rect?: { x: number; y: number; width: number; height: number; } | null, zIndex?: number): HTMLElement; removeChild(element: HTMLElement): void; get layoutButtons(): HTMLButtonElement[]; get layoutButtonPlugins(): CanvasButtonPlugin[]; } declare class PreviewContainer extends DomClass { private _img; constructor(player: Paella, parentElement: HTMLElement, backgroundImage?: string, backgroundImagePortrait?: string); loadBackgroundImage(src: string): void; } declare class PlaybackBarPopUp { #private; constructor(playbackBar: PlaybackBar); get title(): string; set title(title: string); get currentContent(): HTMLElement | null; get currentContentId(): any; show({ content, title, parent, attachLeft, attachRight, triggerElement }: { content: HTMLElement; title: string; parent: HTMLElement | null; attachLeft: boolean; attachRight: boolean; triggerElement?: HTMLElement; }): any; pop(): boolean; hide(): void; get isHidden(): boolean; } declare class PlaybackBar extends DomClass { #private; constructor(player: Paella, parent: HTMLElement); /** * Gets the popup instance associated with this playback bar */ get popUp(): PlaybackBarPopUp | null; /** * Gets whether the playback bar is enabled */ get enabled(): boolean; /** * Sets the enabled state of the playback bar */ set enabled(e: boolean); /** * Loads the playback bar and its button plugins */ load(): Promise<void>; /** * Unloads the playback bar and removes all plugins */ unload(): Promise<void>; /** * Hides the playback bar user interface */ hideUserInterface(): void; /** * Shows the playback bar user interface if enabled */ showUserInterface(): void; /** * Gets the right-side button plugins container */ get buttonPluginsRight(): HTMLElement | null; /** * Gets the left-side button plugins container */ get buttonPluginsLeft(): HTMLElement | null; /** * Gets the progress indicator instance */ get progressIndicator(): any; /** * Gets the current container size */ get containerSize(): { width: number; height: number; }; /** * Handles resize events for the playback bar */ onResize(): void; /** * Gets all button plugins sorted by order */ getButtonPlugins(): Plugin$1[]; /** * Gets all visible button plugins (non-hidden) sorted by order */ getVisibleButtonPlugins(): Plugin$1[]; } declare enum Events { /** Playback started event */ PLAY = "paella:play", /** Playback paused event */ PAUSE = "paella:pause", /** Playback stopped event */ STOP = "paella:stop", /** Playback ended event */ ENDED = "paella:ended", /** Seek operation performed event */ SEEK = "paella:seek", /** Fullscreen state changed event */ FULLSCREEN_CHANGED = "paella:fullscreenchanged", /** Entered fullscreen mode event */ ENTER_FULLSCREEN = "paella:enterfullscreen", /** Exited fullscreen mode event */ EXIT_FULLSCREEN = "paella:exitfullscreen", /** Volume changed event */ VOLUME_CHANGED = "paella:volumeChanged", /** Time update event (fired periodically during playback) */ TIMEUPDATE = "paella:timeupdate", /** Video trimming settings changed event */ TRIMMING_CHANGED = "paella:trimmingChanged", /** Caption track changed event */ CAPTIONS_CHANGED = "paella:captionsChanged", /** Captions enabled event */ CAPTIONS_ENABLED = "paella:captionsEnabled", /** Captions disabled event */ CAPTIONS_DISABLED = "paella:captionsDisabled", /** Button pressed event */ BUTTON_PRESS = "paella:buttonPress", /** Popup shown event */ SHOW_POPUP = "paella:showPopUp", /** Popup hidden event */ HIDE_POPUP = "paella:hidePopUp", /** Video manifest loaded event */ MANIFEST_LOADED = "paella:manifestLoaded", /** Stream loaded event */ STREAM_LOADED = "paella:streamLoaded", /** Player fully loaded event */ PLAYER_LOADED = "paella:playerLoaded", /** Player unloaded event */ PLAYER_UNLOADED = "paella:playerUnloaded", /** Container resized event */ RESIZE = "paella:resize", /** Container resize ended event */ RESIZE_END = "paella:resizeEnd", /** Video layout changed event */ LAYOUT_CHANGED = "paella:layoutChanged", /** Playback rate changed event */ PLAYBACK_RATE_CHANGED = "paella:playbackRateChanged", /** Video quality changed event */ VIDEO_QUALITY_CHANGED = "paella:videoQualityChanged", /** User interface hidden event */ HIDE_UI = "paella:hideUI", /** User interface shown event */ SHOW_UI = "paella:showUI", /** Cookie consent settings changed event */ COOKIE_CONSENT_CHANGED = "paella:cookieConsentChanged", /** Log message event */ LOG = "paella:log", /** Menu item selected event */ MENU_ITEM_SELECTED = "paella:menuItemSelected" } declare class DataPlugin<PluginC extends DataPluginConfig = DataPluginConfig, D = unknown> extends Plugin$1<PluginC> { get type(): string; get context(): string[]; read(context: string, key: string): Promise<D>; write(context: string, key: string, data: D): Promise<void>; remove(context: string, key: string): Promise<void>; } declare class Data extends PlayerResource { private _dataPlugins; constructor(player: Paella); getDataPlugin(context: string): DataPlugin; getDataPlugins(context: string): DataPlugin[]; read(context: string, key: string): Promise<any>; write(context: string, key: string, data: any): Promise<any>; remove(context: string, key: string): Promise<any>; } export type CaptionCue = { label: string; start: number; startString?: string; end: number; endString?: string; captions: string[]; }; declare class Captions { private _cues; private _label; private _lang; get cues(): CaptionCue[]; get label(): string; get language(): string; set label(l: string); set language(l: string); constructor(label?: string, lang?: string); addCue({ label, start, end, captions }: { label: string; start: number; end: number; captions: string | string[]; }): CaptionCue; getCue(instant: number | string): CaptionCue | null; } declare class CaptionCanvas extends DomClass { private _captionsContainer; private _captions; private _currentCaptions; constructor(player: Paella, parent?: HTMLElement | null); load(): Promise<void>; unload(): void; resize(): void; addCaptions(captions: Captions): void; get captions(): Captions[]; get currentCaptions(): Captions | null; getCaptions({ label, index, lang }: { label?: string; index?: number; lang?: string; }): Captions | undefined; enableCaptions(searchOptions: { label?: string; index?: number; lang?: string; }): void; disableCaptions(): void; } declare const LOG_LEVEL: Readonly<{ readonly DISABLED: 0; readonly ERROR: 1; readonly WARN: 2; readonly INFO: 3; readonly DEBUG: 4; readonly VERBOSE: 5; }>; /** * Type representing log level values */ export type LogLevelValue = typeof LOG_LEVEL[keyof typeof LOG_LEVEL]; /** * Type representing log level names */ export type LogLevelName = keyof typeof LOG_LEVEL; export type LogLevel$1 = LogLevelName | LogLevelValue; declare class Log { private _player; private _context; constructor(player: Paella, context?: string); get context(): string; get player(): Paella; setLevel(level: LogLevel$1): void; currentLevel(): LogLevelValue; error(msg: string, context?: string | null): void; warn(msg: string, context?: string | null): void; info(msg: string, context?: string | null): void; debug(msg: string, context?: string | null): void; verbose(msg: string, context?: string | null): void; } declare class Preferences extends PlayerResource { source: any; sourceName: string; private _loaded; constructor(player: Paella); set(key: string, value: any, { global }?: { global?: boolean | undefined; }): Promise<void>; get(key: string, { global }?: { global?: boolean | undefined; }): Promise<any>; } export type DeepPartial<T> = T extends (infer U)[] ? DeepPartial<U>[] : T extends object ? { [P in keyof T]?: DeepPartial<T[P]>; } : T; export interface SkinThemeIcon { plugin: string; identifier: string; icon: string; } export interface SkinTheme { styleSheets?: string[]; configOverrides?: DeepPartial<Config>; icons?: SkinThemeIcon[]; } declare class Skin { protected _player: Paella; protected _skinUrl: string | null; protected _externalResourcesAllowed: boolean; protected _skinData: SkinTheme; constructor(player: Paella); get player(): Paella; loadSkin(skinParam: string | SkinTheme): Promise<void>; unloadSkin(): void; } declare enum PlayerState { /** Player is unloaded and not initialized */ UNLOADED = 0, /** Player is currently loading the manifest */ LOADING_MANIFEST = 1, /** Manifest has been loaded successfully */ MANIFEST = 2, /** Player is loading/initializing */ LOADING_PLAYER = 3, /** Player is fully loaded and ready */ LOADED = 4, /** Player is unloading the manifest */ UNLOADING_MANIFEST = 5, /** Player is being unloaded */ UNLOADING_PLAYER = 6, /** An error occurred during any operation */ ERROR = 7 } export interface Frame$1 { id: string; time: number; mimetype: string; url: string; thumb: string; } export interface Chapter$1 { id: string; title: string; description?: string; time: number; thumb?: string; } export interface Source$1 { src: string; mimetype: string; res?: { w: number; h: number; }; } export interface Stream$1 { content: string; role?: string; canvas?: string[]; sources: { html?: Source$1[]; mp4?: Source$1[]; hls?: Source$1[]; hlsLive?: Source$1[]; audio?: Source$1[]; }; } export interface CaptionManifestItem$1 { id: string; format: string; url: string; lang: string; text: string; } export interface TimelineImages$1 { url: string; rows: number; cols: number; } declare class StreamsManifest { streams: Stream$1[]; constructor(streams: Stream$1[]); get contents(): string[]; getStream(content: string): Stream$1 | null; getSourceTypes(content: string): string[] | null; getCanvasTypes(content: string): string[]; get isAudioOnly(): boolean; get audioOnlySource(): Source$1 | null; get isNativelyPlayable(): boolean; get nativeSource(): string | null; get nativeType(): string | null; get nativePlayer(): HTMLMediaElement | null; } declare class FrameListManifest { private player?; targetContent: string | null; frames: Frame$1[]; constructor(player: Paella, frameList: any); getImage(time: number, ignoreTrimming?: boolean): Frame$1 | null; get isEmpty(): boolean; } declare class MetadataManifest { duration?: number; title?: string; preview?: string; timelineMarks?: "frameList" | "chapters"; timeline?: TimelineImages$1; constructor(metadata: any); } declare class ChapterManifest { chapterList: Chapter$1[]; constructor(chapters: any); } declare class TrimmingManifest { start: number; end: number; enabled: boolean; constructor(trimming: any); } declare class ManifestParser { private _player; private _videoManifest; private _metadata; private _streams; private _frameList; private _chapters; private _visibleTimeLine; private _captions?; private _trimming; private _timelineImage; constructor(manifestData: any, player: Paella); get metadata(): MetadataManifest; get streams(): StreamsManifest; get frameList(): FrameListManifest; get chapters(): ChapterManifest; get captions(): CaptionManifestItem$1[] | undefined; get trimming(): TrimmingManifest; get visibleTimeLine(): boolean; getTimelineFrameAtTime(time: number): Promise<string | null>; } export interface InitParams { configResourcesUrl?: string; configUrl?: string; repositoryUrl?: string; manifestFileName?: string; defaultVideoPreview?: string; defaultVideoPreviewPortrait?: string; loadConfig?: (configUrl: string, player: Paella) => Promise<any>; getVideoId?: (config: any, player: Paella) => Promise<string | null>; getManifestUrl?: (repositoryUrl: string, videoId: string, config: any, player: Paella) => Promise<string>; getManifestFileUrl?: (manifestUrl: string, manifestFileName: string, config: any, player: Paella) => Promise<string>; loadVideoManifest?: (manifestFileUrl: string, config: any, player: Paella) => Promise<any>; getCookieConsentFunction?: (cookieType: string) => Promise<boolean>; getCookieDescriptionFunction?: () => Promise<string>; plugins?: Array<any>; customLoader?: any; translateFunction?: (word: string | undefined | null, keys?: any) => string; getLanguageFunction?: () => string; setLanguageFunction?: (lang: string) => void; addDictionaryFunction?: (lang: string, dict: any) => void; getDictionariesFunction?: () => any; getDefaultLanguageFunction?: (player: Paella) => string; loadDictionaries?: (player: Paella) => Promise<void>; getProgressIndicator?: (player: Paella) => any; Loader?: any; } export interface LoadUrlOptions { title?: string; duration?: number; preview?: string; previewPortrait?: string; } export interface ContainerSize { w: number; h: number; } export interface CustomIcon { pluginName: string; iconName: string; } declare class Paella { _log: Log; _packageData: any; _skin: Skin; _containerElement: HTMLElement; _initParams: InitParams; _config: any; _defaultVideoPreview: string; _defaultVideoPreviewPortrait: string; _videoId: string | null; _manifestUrl: string | null; _manifestFileUrl: string | null; _manifestData: any; _videoManifest: any; _playerLoaded: boolean; _manifestLoaded: boolean; _resizeEventListener: any; _playerState: number; _customPluginIcons: Record<string, string>; _previewContainer?: PreviewContainer; _cookieConsent?: CookieConsent; _preferences?: Preferences; _videoContainer?: VideoContainer; _playbackBar?: PlaybackBar; _captionsCanvas?: CaptionCanvas; _manifestParser?: ManifestParser; _loader?: any; _errorContainer?: ErrorContainer; _data?: Data; _hideUiTime?: number; _uiHidden: boolean; _resizeEndTimer?: number; _requestedCustomIcons?: CustomIcon[]; __pluginModules?: any[]; __pluginData__?: any; /** * Creates a new Paella player instance. * @param {string|HTMLElement} containerElement - The container element ID or HTML element where the player will be mounted * @param {InitParams} [initParams={}] - Initialization parameters for the player * @param {string} [initParams.configResourcesUrl] - URL for configuration resources * @param {string} [initParams.configUrl] - URL for the configuration file * @param {string} [initParams.repositoryUrl] - Default directory with the manifest video repository * @param {string} [initParams.manifestFileName] - Default manifest file name * @param {Function} [initParams.loadConfig] - Custom function to load configuration * @param {Function} [initParams.getVideoId] - Custom function to get video ID * @param {Function} [initParams.getManifestUrl] - Custom function to get manifest URL * @param {Function} [initParams.getManifestFileUrl] - Custom function to get manifest file URL * @param {Function} [initParams.loadVideoManifest] - Custom function to load video manifest * @param {Function} [initParams.getCookieConsentFunction] - Custom function for cookie consent * @param {Array<PluginRef|Plugin>} [initParams.plugins] - Array of plugin references or instances */ constructor(containerElement: string | HTMLElement, initParams?: InitParams); /** * Gets the current version of the player. * @type {string} */ get version(): string; /** * Gets the array of loaded plugin modules. * @type {PluginModule[]} */ get pluginModules(): any[]; /** * Gets the logger instance for the player. * @type {Log} */ get log(): Log; /** * Indicates if the player is ready for use (fully loaded). * @type {boolean} */ get ready(): boolean; /** * Gets the current player state as a numeric value. * @type {number} */ get state(): number; /** * Gets the current player state as a human-readable string. * @type {string} */ get stateText(): string; /** * Indicates if the player has loaded successfully. * @type {boolean} */ get playerLoaded(): boolean; /** * Indicates if the configuration has been loaded. * @type {boolean} */ get configLoaded(): boolean; /** * Indicates if the video manifest has been loaded. * @type {boolean} */ get videoManifestLoaded(): boolean; /** * Indicates if the video streams have been loaded. * @type {boolean} */ get videoLoaded(): boolean; /** * Gets the Events constants object. * @type {Events} */ get Events(): typeof Events; /** * Gets the PlayerState constants object. * @type {PlayerState} */ get PlayerState(): typeof PlayerState; /** * Gets the PlayerStateNames array. * @type {PlayerStateNames} */ get PlayerStateNames(): readonly string[]; /** * Gets the preferences manager instance. * @type {Preferences} */ get preferences(): Preferences | undefined; /** * Gets the skin manager instance. * @type {Skin} */ get skin(): Skin; /** * Gets the cookie consent manager instance. * @type {CookieConsent} */ get cookieConsent(): CookieConsent | undefined; /** * Gets the data manager instance for plugin data storage. * @type {Data} */ get data(): Data | undefined; /** * Indicates if the player container currently has focus. * @type {boolean} */ get containsFocus(): boolean; /** * Gets/sets the time in milliseconds after which the UI will be hidden. * @type {number} */ get hideUiTime(): number | undefined; set hideUiTime(val: number | undefined); /** * Gets the current size of the player container. * @type {{w: number, h: number}} */ get containerSize(): ContainerSize; /** * Gets the HTML container element for the player. * @type {HTMLElement} */ get containerElement(): HTMLElement; /** * Gets the initialization parameters used to create the player. * @type {InitParams} */ get initParams(): InitParams; /** * Gets the URL for configuration resources. * @type {string} */ get configResourcesUrl(): string; /** * Gets the URL for the main configuration file. * @type {string} */ get configUrl(): string; /** * Gets the loaded configuration object. * @type {Config} */ get config(): any; /** * Gets the default video preview image URL. * @type {string} */ get defaultVideoPreview(): string; /** * Gets the default video preview image URL for portrait mode. * @type {string} */ get defaultVideoPreviewPortrait(): string; /** * Gets the current video identifier. * @type {string} */ get videoId(): string | null; /** * Gets the base URL where the video repository is located. * @type {string} */ get repositoryUrl(): string; /** * Gets the base URL where the video manifest file is located. * @type {string} */ get manifestUrl(): string | null; /** * Gets the video manifest file name. * @type {string} */ get manifestFileName(): string; /** * Gets the full path of the video manifest file. * @type {string} */ get manifestFileUrl(): string | null; /** * Gets the loaded video manifest object. * @type {Manifest} */ get videoManifest(): any; /** * Gets the preview container instance. * @type {PreviewContainer} */ get previewContainer(): PreviewContainer | undefined; /** * Gets the video container instance that manages video playback. * @type {VideoContainer} */ get videoContainer(): VideoContainer | undefined; /** * Gets the playback bar instance. * @type {PlaybackBar} */ get playbackBar(): PlaybackBar | undefined; /** * Gets the captions canvas instance for subtitle display. * @type {CaptionsCanvas} */ get captionsCanvas(): CaptionCanvas | undefined; /** * Gets the video metadata from the manifest. * @type {Record<string, any>} */ get metadata(): Record<string, any>; /** * Gets the video streams array from the manifest. * @type {Stream[]} */ get streams(): any[]; /** * Gets the frame list for video thumbnails. * @type {FrameList} */ get frameList(): any; /** * Gets the chapters information. * @type {Chapters} */ get chapters(): any; /** * Gets the captions information. * @type {Caption[]} */ get captions(): any[]; /** * Gets the trimming parameters for the video. * @type {TrimmingParams} */ get trimming(): any; /** * Indicates if the timeline should be visible. * @type {boolean} */ get visibleTimeLine(): boolean; /** * Gets the timeline frame at the current playback time. * @returns {Promise<string|null>} The timeline frame URL or null if not available */ getTimelineFrame(): Promise<string | null>; /** * Gets the timeline frame at a specific time. * @param {number} time - The time in seconds * @returns {Promise<string|null>} The timeline frame URL or null if not available */ getTimelineFrameAtTime(time: number): Promise<string | null>; /** * Translate a word or phrase. * @param {string | undefined | null} word - The word to translate. * @param {Object} [keys=null] - Optional keys for placeholders. * @returns {string} - The translated word. */ translate(word: string | undefined | null, keys?: any): string; /** * Set the current language. * @param {string} lang - The language code. */ setLanguage(lang: string): void; /** * Get the current language. * @returns {string} - The current language code. */ getLanguage(): string; /** * Add a dictionary for a specific language. * @param {string} lang - The language code. * @param {Object} dict - The dictionary object. */ addDictionary(lang: string, dict: any): void; /** * Get all loaded dictionaries. * @returns {Object} - The dictionaries. */ getDictionaries(): any; /** * Get the default language. * @returns {string} - The default language code. */ getDefaultLanguage(): string; /** * Bind an event to the player. * @param {string | string[]} eventName - The event name. * @param {Function} fn - The callback function. * @param {boolean} [unregisterOnUnload=true] - Whether to unregister the event on unload. */ bindEvent(eventName: string | string[], fn: (data: any) => void, unregisterOnUnload?: boolean): void; /** * Gets a plugin instance by name and optionally by type. * @param {string} name - The plugin name * @param {string|null} [type=null] - The plugin type (optional) * @returns {Plugin|Record<string, Plugin>|undefined} The plugin instance(s) */ getPlugin(name: string, type?: string | null): any | Record<string, any> | undefined; /** * Waits for the player to reach a specific state. * @param {string|number} state - The target state (name or numeric value) * @returns {Promise<void>} A promise that resolves when the state is reached * @throws {Error} If the state is invalid */ waitState(state: string | number): Promise<void>; /** * Load a video from a URL. * @param {string|string[]} url - The video URL(s). * @param {Object} [options] - Additional options. * @param {string} [options.title] - The video title. * @param {number} [options.duration] - The video duration. * @param {string} [options.preview] - The preview image URL. * @param {string} [options.previewPortrait] - The portrait preview image URL. */ loadUrl(url: string | string[], { title, duration, preview, previewPortrait }?: LoadUrlOptions): Promise<void>; /** * Load the video manifest. */ loadManifest(): Promise<void>; /** * Load the player interface. * @returns {Promise<void>} */ loadPlayer(): Promise<void>; /** * Load the player (manifest and interface). * @returns {Promise<void>} */ load(): Promise<void>; /** * Unload the player. * @returns {Promise<void>} */ unload(): Promise<void>; /** * Unloads and then completely removes this Paella instance. Reverts all * effects of the constructor. This method is useful for SPAs where * the instance should be completely removed on navigation. * @returns {Promise<void>} */ destroy(): Promise<void>; /** * Unloads the video manifest and all its resources. * @returns {Promise<void>} */ unloadManifest(): Promise<void>; /** * Unload the player interface. * @returns {Promise<void>} */ unloadPlayer(): Promise<void>; /** * Reload the player. * @param {Function} [onUnloadFn=null] - Function to call after unloading. * @returns {Promise<void>} */ reload(onUnloadFn?: (() => Promise<void>) | null): Promise<void>; /** * Resizes the player and triggers resize events. * @returns {Promise<void>} */ resize(): Promise<void>; /** * Hide the user interface. * @returns {Promise<void>} */ hideUserInterface(): Promise<void>; /** * Show the user interface. * @returns {Promise<void>} */ showUserInterface(): Promise<void>; /** * Play the video. * @returns {Promise<void>} */ play(): Promise<void>; /** * Pause the video. * @returns {Promise<void>} */ pause(): Promise<void>; /** * Toggle between play and pause. * @returns {Promise<void>} */ togglePlay(): Promise<void>; /** * Check if the video is paused. * @returns {Promise<boolean>} */ paused(): Promise<boolean>; /** * Stop the video. * @returns {Promise<void>} */ stop(): Promise<void>; /** * Set the current playback time. * @param {number} t - The time in seconds. * @returns {Promise<void>} */ setCurrentTime(t: number): Promise<void>; /** * Get the current playback time. * @returns {Promise<number>} */ currentTime(): Promise<number | undefined>; /** * Get the current volume. * @returns {Promise<number>} */ volume(): Promise<number | undefined>; /** * Set the volume. * @param {number} v - The volume level (0-1). * @returns {Promise<void>} */ setVolume(v: number): Promise<void>; /** * Get the video duration. * @returns {Promise<number>} */ duration(): Promise<number | undefined>; /** * Get the playback rate. * @returns {Promise<number>} */ playbackRate(): Promise<number | undefined>; /** * Set the playback rate. * @param {number} r - The playback rate. * @returns {Promise<void>} */ setPlaybackRate(r: number): Promise<void>; /** * Skip forward by a number of seconds. * @param {number} s - The number of seconds to skip. * @returns {Promise<void>} */ skipSeconds(s: number): Promise<void>; /** * Rewind by a number of seconds. * @param {number} s - The number of seconds to rewind. * @returns {Promise<void>} */ rewindSeconds(s: number): Promise<void>; /** * Check if fullscreen is supported. * @returns {boolean} */ isFullScreenSupported(): boolean; /** * Enter fullscreen mode. * @returns {Promise<void>} */ enterFullscreen(): Promise<void>; /** * Exit fullscreen mode. * @returns {Promise<void>} */ exitFullscreen(): Promise<void>; /** * Check if the player is in fullscreen mode. * @returns {boolean} */ get isFullscreen(): boolean; /** * Add a custom plugin icon. * @param {string} pluginName - The plugin unique identifier, for example `es.upv.paella.playPauseButton`. * @param {string} iconName - The icon name in the plugin. * @param {string} svgData - The SVG data for the icon. */ addCustomPluginIcon(pluginName: string, iconName: string, svgData: string): void; /** * Remove a custom plugin icon. * @param {string} pluginName - The plugin unique identifier, for example `es.upv.paella.playPauseButton`. * @param {string} iconName - The icon name in the plugin. */ removeCustomPluginIcon(pluginName: string, iconName: string): void; /** * Get a custom plugin icon. * @param {string} pluginName - The plugin name. * @param {string} iconName - The icon name. * @returns {string|null} - The SVG data for the icon, or null if not found. */ getCustomPluginIcon(pluginName: string, iconName: string): string | null | undefined; /** * Gets the list of requested custom icons during the current session. * @type {Array<{pluginName: string, iconName: string}>} */ get requestedCustomIcons(): CustomIcon[]; } declare class ButtonPluginObserver { onIconChanged(plugin: ButtonPlugin, prevIcon: string, newIcon: string): void; onTitleChanged(plugin: ButtonPlugin, prevTitle: string, newTitle: string): void; onStateChanged(plugin: ButtonPlugin, prevText: string, newText: string, prevIcon: string, newIcon: string): void; } declare class ButtonPlugin<PluginC extends ButtonPluginConfig = ButtonPluginConfig> extends UserInterfacePlugin<PluginC> { #private; private _button; private _container; private _isAnchor; private _observer; private _menuIcon; private _icon; private _title; private _statusText; private _statusIcon; private _enabled; static AddButtonPlugin(plugin: ButtonPlugin, buttonAreaElem: HTMLElement | null): Promise<void>; get type(): string; get container(): HTMLElement; get button(): HTMLElement; get interactive(): boolean; get dynamicWidth(): boolean; getId(): string | null; get id(): string | null; getButtonName(): string | null; get buttonName(): string | null; getAriaLabel(): string | null; get ariaLabel(): string | null; getTabIndex(): number | null; get tabIndex(): number | null; getDescription(): string | null; get description(): string | null; get minContainerSize(): number; getMinContainerSize(): number; setObserver(observer: ButtonPluginObserver): void; get icon(): string; set icon(icon: string); get haveIcon(): boolean; get menuIcon(): string; set menuIcon(icon: string); get haveMenuIcon(): boolean; get isMenuButton(): boolean; get title(): string; set title(t: string); get titleSize(): ButtonSize; get side(): ButtonPluginSide; get closePopUps(): boolean; getClosePopUps(): boolean; get parentContainer(): string; get className(): string; enable(): void; disable(): void; hide(): void; show(): void; get hidden(): boolean; get leftSideContainer(): HTMLElement; get leftSideContainerPresent(): boolean; get rightSideContainer(): HTMLElement; get rightSideContainerPresent(): boolean; get stateText(): string | null; get stateIcon(): string | null; setState({ text, icon }?: { text?: null | undefined; icon?: null | undefined; }): void; onStateChange(cb: () => void): void; action(event: Event, callerContainer?: HTMLElement | null): Promise<void>; getAnchorUrl(): Promise<string | null>; get isAnchor(): boolean; onResize({ width, height }: { width: number; height: number; }): void; focus(): void; blur(): void; isFocus(): boolean; get anchorTarget(): string; get anchorDownloadFilename(): string | null; get anchorReferrerPolicy(): string; } declare class PopUpButtonPlugin<PluginC extends PopUpButtonPluginConfig = PopUpButtonPluginConfig> extends ButtonPlugin<PluginC> { constructor(...args: ConstructorParameters<typeof ButtonPlugin>); set refreshContent(c: boolean); get refreshContent(): boolean; get closeParentPopUp(): boolean; getCloseParentPopUp(): boolean; action(evt: Event, cal