import { ILogger } from 'js-logger'; import { ILogHandler } from 'js-logger'; import { ILogLevel } from 'js-logger'; export declare const AbrMode: { readonly MANUAL: "manual"; readonly AUTO: "auto"; }; export declare const AdBreakType: { readonly PRE: "preroll"; readonly MID: "midroll"; readonly POST: "postroll"; readonly OVERLAY: "overlay"; }; export declare const AdEventType: { /** * Fired when the ad can be skip by the user. */ readonly AD_CAN_SKIP: "adcanskip"; /** * Fired when the ad manifest has been loaded. */ readonly AD_MANIFEST_LOADED: "admanifestloaded"; /** * Fired when ad data is available. */ readonly AD_LOADED: "adloaded"; /** * Fired when the ad starts playing. */ readonly AD_STARTED: "adstarted"; /** * Fired when the ad is resumed. */ readonly AD_RESUMED: "adresumed"; /** * Fired when the ad is paused. */ readonly AD_PAUSED: "adpaused"; /** * Fired when the ad is clicked. */ readonly AD_CLICKED: "adclicked"; /** * Fired when the ad is skipped by the user. */ readonly AD_SKIPPED: "adskipped"; /** * Fired when the ad completes playing. */ readonly AD_COMPLETED: "adcompleted"; /** * Fired when an error occurred while the ad was loading or playing. */ readonly AD_ERROR: "aderror"; /** * Fired when the ads plugin is done playing all own ads. */ readonly ADS_COMPLETED: "adscompleted"; /** * Fired when the ads manager is done playing all the ads. */ readonly ALL_ADS_COMPLETED: "alladscompleted"; /** * Fired when content should be paused. This usually happens right before an ad is about to cover the content. */ readonly AD_BREAK_START: "adbreakstart"; /** * Fired when content should be resumed. This usually happens when an ad finishes or collapses. */ readonly AD_BREAK_END: "adbreakend"; /** * Fired when the ad playhead crosses first quartile. */ readonly AD_FIRST_QUARTILE: "adfirstquartile"; /** * Fired when the ad playhead crosses midpoint. */ readonly AD_MIDPOINT: "admidpoint"; /** * Fired when the ad playhead crosses third quartile. */ readonly AD_THIRD_QUARTILE: "adthirdquartile"; /** * Fired when the ad is closed by the user. */ readonly USER_CLOSED_AD: "userclosedad"; /** * Fired when the ad volume has changed. */ readonly AD_VOLUME_CHANGED: "advolumechanged"; /** * Fired when the ad volume has been muted. */ readonly AD_MUTED: "admuted"; /** * Fired on ad time progress. */ readonly AD_PROGRESS: "adprogress"; /** * Fired when the ad has stalled playback to buffer. */ readonly AD_BUFFERING: "adbuffering"; /** * Fired when an ad waterfalling occurred */ readonly AD_WATERFALLING: "adwaterfalling"; /** * Fired when an ad waterfalling failed */ readonly AD_WATERFALLING_FAILED: "adwaterfallingfailed"; /** * Fires when browser fails to autoplay an ad. */ readonly AD_AUTOPLAY_FAILED: "adautoplayfailed"; }; export declare const AdTagType: { readonly VAST: "vast"; readonly VMAP: "vmap"; }; /** * Audio track representation of the player. * @classdesc */ export declare class AudioTrack extends Track { /** * The kind of the track. i.e. description, main. * @member * @type {AudioTrackKind} * @private */ private _kind; /** * The flavor ID of the track. * @member * @type {string | undefined} * @private */ private _flavorId; /** * Getter for the kind value of the track. * @public * @returns {AudioTrackKind} - The kind value of the track. */ get kind(): AudioTrackKind; /** * Getter for the flavor ID of the track. * @public * @returns {string | undefined} - The flavor ID of the track. */ get flavorId(): string | undefined; /** * Setter for the kind value of the track. * @public * @param {AudioTrackKind} value - The kind of the track. */ set kind(value: AudioTrackKind); /** * Setter for the flavor ID of the track. * @public * @param {string | undefined} value - The flavor ID of the track. */ set flavorId(value: string | undefined); /** * @constructor * @param {Object} settings - The track settings object. */ constructor(settings?: any); } export declare enum AudioTrackKind { MAIN = "main", DESCRIPTION = "description" } export declare const AutoPlayType: PKAutoPlayTypes; export declare class BaseMediaSourceAdapter extends FakeEventTarget implements IMediaSourceAdapter { /** * The id of the adapter. * @member {string} id * @static * @private */ static id: string; /** * Passing the getLogger function to the actual media source adapter. * @type {Function} * @static */ static getLogger: (name?: string) => ILogger; protected static _logger: ILogger; /** * The adapter config. * @member {Object} _config * @private */ protected _config: any; /** * The source object. * @member {PKMediaSourceObject} _sourceObj * @private */ protected _sourceObj?: PKMediaSourceObject; /** * The dom video element. * @member {HTMLVideoElement} _videoElement * @private */ protected _videoElement: HTMLVideoElement; /** * The adapter capabilities * @private */ protected _capabilities: PKMediaSourceCapabilities; /** * The event manager of the adapter. * @type {EventManager} * @private */ protected _eventManager: EventManager; /** * The load promise * @member {Promise<{tracks: Array}>} - _loadPromise * @type {Promise<{tracks: Array}>} * @private */ protected _loadPromise: Promise<{ tracks: Array; }> | undefined; /** * The duration change handler. * @type {Function} * @private */ private _onDurationChanged; /** * Checks if the media source adapter is supported. * @function isSupported * @returns {boolean} - Whether the media source adapter is supported. * @static */ static isSupported(): boolean; /** * check for media source supported on browser * @static * @returns {boolean} - Whether the media source is supported. */ static isMSESupported(): boolean; /** * @constructor * @param {HTMLVideoElement} videoElement - The video element which bind to media source adapter. * @param {PKMediaSourceObject} source - The source object. * @param {Object} config - The media source adapter configuration. */ constructor(videoElement: HTMLVideoElement, source: PKMediaSourceObject, config?: any); /** * Destroys the media source adapter. * @function destroy * @returns {void} */ destroy(): Promise; /** * Triggers the appropriate track changed event. * @param {Track} track - The selected track. * @private * @returns {void} */ protected _onTrackChanged(track: VideoTrack | AudioTrack | TextTrack_2 | ImageTrack): void; /** * Dispatch an adapter event forward. * @param {string} name - The name of the event. * @param {?Object} payload - The event payload. * @returns {void} */ protected _trigger(name: string, payload?: any): void; /** Must implemented methods by the derived media source adapter **/ static canPlayType(mimeType: string, preferNative: boolean): boolean; applyTextTrackStyles(sheet: CSSStyleSheet, styles: TextStyle, containerId: string, engineClassName?: string): void; load(): Promise<{ tracks: Track[]; }>; selectVideoTrack(videoTrack: VideoTrack): void; selectAudioTrack(audioTrack: AudioTrack): void; selectTextTrack(textTrack: TextTrack_2): void; selectImageTrack(imageTrack: ImageTrack): void; hideTextTrack(): void; enableAdaptiveBitrate(): void; isAdaptiveBitrateEnabled(): boolean; applyABRRestriction(restrictions: PKABRRestrictionObject): void; protected _getLiveEdge(): number; seekToLiveEdge(): void; isLive(): boolean; isOnLiveEdge(): boolean; setMaxBitrate(bitrate: number): void; attachMediaSource(): void; detachMediaSource(): void; /** * Handling live time update (as is not triggered when video is paused, but the current time changed) * @function _handleLiveTimeUpdate * @returns {void} * @private */ private _handleLiveTimeUpdate; /** * Disables all the existing text tracks. * @public * @returns {void} */ disableNativeTextTracks(): void; /** * Checks if the adapter can recover from an error triggered by the video element error * @param {Event} event - the html5 video element error * @returns {boolean} - if it can recover or not * @public */ handleMediaError(event?: MediaError): boolean; getStartTimeOfDvrWindow(): number; getThumbnail(time: number): ThumbnailInfo | null; getSegmentDuration(): number; get liveDuration(): number; /** * throw a run time error * @param {string} name of the unimplemented function * @returns {any} void/string/boolean */ private static _throwNotImplementedError; /** * Getter for the src that the adapter plays on the video element. * In case the adapter preformed a load it will return the manifest url. * @public * @returns {string} - The src url. */ get src(): string; /** * Setter for the src that the adapter plays on the video element. * @param {string} source - The src url. * @public * @returns {void} */ set src(source: string); /** * @public * @return {PKMediaSourceCapabilities} - The adapter capabilities. */ get capabilities(): PKMediaSourceCapabilities; get targetBuffer(): number; getDrmInfo(): PKDrmDataObject | null; setCachedUrls(cachedUrls: string[]): void; } /** * Base middleware. * @classdesc */ export declare class BaseMiddleware { /** * Id of the middleware instance. * @public */ id: string; /** * Calls the next handler in the middleware chain. * @param {Function} next - The next handler in the middleware chain. * @returns {void} */ callNext(next: (...args: any[]) => any): void; } /** * @param {Array} list The array to search. * @param {Function} comparisonFn * Called and provided a candidate item as the first argument. * Should return: * > -1 if the item should be located at a lower index than the provided item. * > 1 if the item should be located at a higher index than the provided item. * > 0 if the item is the item you're looking for. * * @return {any} The object if it is found or null otherwise. */ declare function binarySearch(list?: Array, comparisonFn?: ((param: T) => number)): T | null; export declare type CapabilityResult = { [capabilityName: string]: any; }; declare type CategoryType = { [category: string]: number; }; declare type CodeType = { [code: string]: number; }; export declare const CorsType: { readonly ANONYMOUS: "anonymous"; readonly USE_CREDENTIALS: "use-credentials"; }; /** * Create a standard TextTrackCue. * @param {TimedMetadata} timedMetadata - timed metadata object. * @returns {TextTrackCue} - the created text track cue * @private */ export declare function createTextTrackCue(timedMetadata: TimedMetadata): PKTextTrackCue | null; /** * Create a timed metadata object from a standard TextTrackCue. * @param {TextTrackCue} cue - text track cue. * @returns {?TimedMetadata} - the created timed metadata object. * @private */ export declare function createTimedMetadata(cue: TextTrackCue): TimedMetadata | null; export declare const CustomEventType: { /** * Fires when the media is loaded. */ readonly MEDIA_LOADED: "medialoaded"; /** * Fires when the player ends reset operation. */ readonly PLAYER_RESET: "playerreset"; /** * Fires when the player ends destroy operation. */ readonly PLAYER_DESTROY: "playerdestroy"; /** * Fires when the player enters fullscreen. */ readonly ENTER_FULLSCREEN: "enterfullscreen"; /** * Fires when the player exits fullscreen. */ readonly EXIT_FULLSCREEN: "exitfullscreen"; /** * Fires when browser fails to play. */ readonly PLAY_FAILED: "playfailed"; /** * Fires when browser fails to autoplay with sound. */ readonly AUTOPLAY_FAILED: "autoplayfailed"; /** * Fires when browser fails to autoplay with sound but start muted autoplay instead. */ readonly FALLBACK_TO_MUTED_AUTOPLAY: "fallbacktomutedautoplay"; /** * Fires when change source flow started. */ readonly CHANGE_SOURCE_STARTED: "changesourcestarted"; /** * Fires when change source flow ended. */ readonly CHANGE_SOURCE_ENDED: "changesourceended"; /** * Fires when the volume has been muted/unmute. */ readonly MUTE_CHANGE: "mutechange"; /** * Fires when the active video track has been changed. */ readonly VIDEO_TRACK_CHANGED: "videotrackchanged"; /** * Fires when the active audio track has been changed. */ readonly AUDIO_TRACK_CHANGED: "audiotrackchanged"; /** * Fires when the active text track has been changed. */ readonly TEXT_TRACK_CHANGED: "texttrackchanged"; /** * Fires when the active image track has been changed. */ readonly IMAGE_TRACK_CHANGED: "imagetrackchanged"; /** * Fires when the text track added to native */ readonly TEXT_TRACK_ADDED: "texttrackadded"; /** * Fires when the active text track cue has changed. */ readonly TEXT_CUE_CHANGED: "textcuechanged"; /** * Fires when the player tracks have been changed. */ readonly TRACKS_CHANGED: "trackschanged"; /** * Fires when the abr mode change from 'auto' to 'manual' or vice versa. */ readonly ABR_MODE_CHANGED: "abrmodechanged"; /** * Fires when the player state has been changed. */ readonly PLAYER_STATE_CHANGED: "playerstatechanged"; /** * Fires when playback start requested. */ readonly PLAYBACK_START: "playbackstart"; /** * Fires on the first 'play' event. */ readonly FIRST_PLAY: "firstplay"; /** * Fires on the first 'playing' event. */ readonly FIRST_PLAYING: "firstplaying"; /** * Fires when the playback (includes postrolls) is ended. */ readonly PLAYBACK_ENDED: "playbackended"; /** * Fires when the player has selected the source to play. */ readonly SOURCE_SELECTED: "sourceselected"; /** * Fires when the text track style has changed. */ readonly TEXT_STYLE_CHANGED: "textstylechanged"; /** * Fired when the adapter recovered from a media error */ readonly MEDIA_RECOVERED: "mediarecovered"; /** * Fired when the vr stereo mode changed */ readonly VR_STEREO_MODE_CHANGED: "vrstereomodechanged"; /** * Fired when the frames drop are exceeds the allowed (configured) threshold */ readonly FPS_DROP: "fpsdrop"; /** * Fired when the a bookmark service returns an error * This event will be removed once plugins will have a way to expose their event enums */ readonly BOOKMARK_ERROR: "bookmarkerror"; /** * Fired when the a bookmark service returns a concurrency limit error * This event will be removed once plugins will have a way to expose their event enums */ readonly CONCURRENCY_LIMIT: "concurrencylimit"; /** * Fired when the player container changes it's dimensions */ readonly RESIZE: "resize"; /** * Fired when the timed metadata triggered */ readonly TIMED_METADATA: "timedmetadata"; /** * Fired when the timed metadata triggered */ readonly TIMED_METADATA_CHANGE: "timedmetadatachange"; /** * Fires when new timed metadata added */ readonly TIMED_METADATA_ADDED: "timedmetadataadded"; /** * Fired when a fragment or segment is done loading successfully */ readonly FRAG_LOADED: "fragloaded"; /** * Fired when a manifest is done loading successfully */ readonly MANIFEST_LOADED: "manifestloaded"; /** * Fired when the user interact with the player ui */ readonly USER_GESTURE: "usergesture"; /** * Fired when the drm license is responded from the DRM server */ readonly DRM_LICENSE_LOADED: "drmlicenseloaded"; /** * Fired when the source url switched */ readonly SOURCE_URL_SWITCHED: "sourceurlswitched"; /** * Fired when a new timeline region is parsed and added by the playback engine */ readonly TIMELINE_REGION_ADDED: "timelineregionadded"; /** * Fired when a new timeline region entered */ readonly TIMELINE_REGION_ENTER: "timelineregionenter"; /** * Fired when a new timeline region exited */ readonly TIMELINE_REGION_EXIT: "timelineregionexit"; /** * Fired when playback reaches 25% of the total duration */ readonly PLAY_REACHED_25_PERCENT: "playreached25percent"; /** * Fired when playback reaches 50% of the total duration */ readonly PLAY_REACHED_50_PERCENT: "playreached50percent"; /** * Fired when playback reaches 75% of the total duration */ readonly PLAY_REACHED_75_PERCENT: "playreached75percent"; /** * Fired when playback reaches 90% of the total duration */ readonly PLAY_REACHED_90_PERCENT: "playreached90percent"; /** * Fired when playback reaches 100% of the total duration */ readonly PLAY_REACHED_100_PERCENT: "playreached100percent"; /** * Fired when new thumbnail ks is updated */ readonly THUMBNAIL_KS_UPDATED: "thumbnailksupdated"; }; export declare type DeferredPromise = { resolve: (value?: any | PromiseLike) => void; reject: (reason?: any) => void; catch: (param: () => any) => void; then(param: () => void): any; }; declare const _Dom: { /** * Adds class name to an element * @param {Element} element - an HTML element * @param {string} className - a class name * @returns {void} */ addClassName(element: HTMLElement, className: string): void; /** * Removes class name from an element * @param {Element} element - an HTML element * @param {string} className - a class name * @returns {void} */ removeClassName(element: HTMLElement, className: string): void; /** * Checks if an element has a class name * @param {Element} element - an HTML element * @param {string} className - a class name * @returns {boolean} - weather an element contains a class name */ hasClassName(element: HTMLElement, className: string): boolean; /** * Add element attribute * @param {Element} element - an HTML element * @param {string} name - attribute name * @param {string} value - attribute value * @returns {void} */ setAttribute(element: HTMLElement, name: string, value: string): void; /** * Remove element attribute * @param {Element} element - an HTML element * @param {string} name - attribute name * @returns {void} */ removeAttribute(element: HTMLElement, name: string): void; /** * Set element style * @param {Element} element - an HTML element * @param {string} name - style name * @param {string} value - style value * @returns {void} */ setStyle(element: HTMLElement, name: string, value: string): void; /** * Adds a node to the end of the list of children of a specified parent node. * @param {Element} parent - The parent node. * @param {Element} child - The child node. * @returns {void} */ appendChild(parent?: HTMLElement, child?: HTMLElement): void; /** * Removes an element from his parent node. * @param {Element} parent - The parent node. * @param {Element} child - The child node. * @returns {void} */ removeChild(parent?: Node | null, child?: HTMLElement): void; /** * Prepend HTML element * @param {HTMLElement} child - the child to prepend * @param {HTMLElement} parent - the parent to preprend to * @returns {void} */ prependTo(child: HTMLElement, parent: HTMLElement): void; /** * Returns a reference to the element by its ID. * @param {string} id - The desired id. * @returns {Element} - The element with the desired id. */ getElementById(id: string): any; /** * Returns a live HTMLCollection of elements with the given tag name. * @param {string} tagName - The desired tag name. * @returns {Element} - The elements with the desired tag name. */ getElementsByTagName(tagName: string): any; /** * Creates the HTML element specified by tagName. * @param {string} tagName - The tag name. * @returns {Element} - The element just created. */ createElement(tagName: string): any; /** * Loads an external style sheet asynchronously. * @param {string} url - The css url to load. * @return {Promise} - The loading promise. * @public */ loadStyleSheetAsync(url: string): Promise; /** * Loads script asynchronously. * @param {string} url - The url to load. * @return {Promise} - The loading promise. * @public */ loadScriptAsync(url: string): Promise; /** * Returns the first element that matches a specified CSS selector(s) in the document. * @param {string} selector - One or more CSS selectors to match the element. * @returns {Element} - The first element that matches a specified CSS selector(s) in the document. */ getElementBySelector(selector: string): any; /** * Inserts a node as a child, right before an existing child. * @param {HTMLElement} parent - The parent node object. * @param {HTMLElement} newChild - The node object to insert. * @param {?HTMLElement} existingChild - The child node to insert the new node before. If set to null, the insertBefore method will insert the newChild at the end. * @returns {Element} - The first element that matches a specified CSS selector(s) in the document. */ insertBefore(parent: HTMLElement, newChild: HTMLElement, existingChild?: HTMLElement | null): HTMLElement | null; }; export declare const DrmScheme: { WIDEVINE: string; PLAYREADY: string; FAIRPLAY: string; }; export declare class EngineDecoratorProvider implements IEngineDecoratorProvider { private _name; private _getEngineDecorator; constructor(plugin: IEngineDecoratorProvider); getEngineDecorator(engine: IEngine, dispatchEventHandler: (event: FakeEvent) => void): IEngineDecorator; getName(): string; } /** * Engine Provider * @classdesc */ declare class EngineProvider { /** * The logger of the Engine provider. * @member {any} _logger * @static * @private */ private static _logger; /** * The Engine registry. * @member {Object} _engineProviders * @static * @private */ private static _engineProviders; /** * Add an engine to the registry. * @function register * @param {string} id - The engine id. * @param {IEngineStatic} engine - The engine to register. * @static * @returns {void} */ static register(id: string, engine: IEngineStatic): void; /** * Remove an engine from the registry. * @function unRegister * @param {string} id - The engine id. * @static * @returns {void} */ static unRegister(id: string): void; /** * Get the appropriate Engines. * @function getEngines * @returns {Array} - The Array of engines, or null if such doesn't exists. * @static */ static getEngines(): Array; /** * Destroys and clear the registered engines * @static * @returns {void} */ static destroy(): void; } export declare const EngineType: { readonly HTML5: "html5"; readonly FLASH: "flash"; readonly SILVERLIGHT: "silverlight"; readonly CAST: "cast"; readonly YOUTUBE: "youtube"; readonly IMAGE: "image"; readonly DOCUMENT: "document"; }; export declare const Env: IEnv; /** * @classdesc This is a description of the error class. */ declare class Error_2 { severity: number; category: number; code: number; data: any; errorDetails: any; /** * @enum {number} */ static Severity: SeverityType; /** * @enum {number} */ static Category: CategoryType; /** * @enum {number} */ static Code: CodeType; private static _logger; /** * @constructor * @param {number} severity - error's severity * @param {number} category - error's category. * @param {number} code - error's code. * @param {any} data - additional data for the error. * @param {any} errorDetails - error details including title and message - optional. */ constructor(severity: number, category: number, code: number, data?: any, errorDetails?: any); } export { Error_2 as Error } /** * These are the listener types defined in the closure extern for EventTarget. * @typedef {EventListener|function(!Event):(boolean|undefined)} */ declare function EventListener_2(event: FakeEvent): boolean | void; /** * Creates a new EventManager. An EventManager maintains a collection of "event * bindings" between event targets and event listeners. * * @struct * @constructor * @implements {IDestroyable} */ export declare class EventManager { private _bindingMap; constructor(); /** * Detaches all event listeners. * @override */ destroy(): Promise; /** * Attaches an event listener to an event target for only one time. * @param {EventTarget} target - The event target. * @param {string} type - The event type. * @param {ListenerType} listener - The event listener. * @param {?Object} options - The event options. * @returns {void} */ listenOnce(target: EventTarget | FakeEventTarget, type: string, listener: ListenerType, options?: any): void; /** * Attaches an event listener to an event target. * @param {EventTarget} target The event target. * @param {string} type The event type. * @param {ListenerType} listener The event listener. * @param {?Object} options The event options. * @returns {void} */ listen(target: EventTarget | FakeEventTarget, type: string, listener: ListenerType, options?: any): void; /** * Detaches an event listener from an event target. * @param {EventTarget} target The event target. * @param {string} type The event type. * @param {ListenerType} [listener] The event listener to detach. If no given, detaches all event listeners of the target and type. * @returns {void} */ unlisten(target: any, type: string, listener?: ListenerType): void; /** * Detaches all event listeners from all targets. * @returns {void} */ removeAll(): void; } export declare const EventType: PKEventTypes; /** * Create an Event work-alike object based on the dictionary. * The event should contain all of the same properties from the dict. * @param {string} type - * @param {Object=} opt_dict - * @constructor * @extends {Event} */ export declare class FakeEvent { /** @const {boolean} */ bubbles: boolean; /** @const {boolean} */ cancelable: boolean; /** @const {boolean} */ defaultPrevented: boolean; /** * According to MDN, Chrome uses high-res timers instead of epoch time. * Follow suit so that timeStamps on FakeEvents use the same base as * on native Events. * @const {number} * @see https://developer.mozilla.org/en-US/docs/Web/API/Event/timeStamp */ timeStamp: number | Date; /** @const {string} */ type: string; /** @const {boolean} */ isTrusted: boolean; /** @type {EventTarget} */ currentTarget: any; /** @type {EventTarget} */ target: any; /** * Non-standard property read by FakeEventTarget to stop processing listeners. * @type {boolean} */ stopped: boolean; payload: any; constructor(type: string, payload?: any); /** * Does nothing, since FakeEvents have no default. Provided for compatibility * with native Events. * @override */ preventDefault(): void; /** * Stops processing event listeners for this event. Provided for compatibility * with native Events. * @override */ stopImmediatePropagation(): void; /** * Does nothing, since FakeEvents do not bubble. Provided for compatibility * with native Events. * @override */ stopPropagation(): void; } /** * A work-alike for EventTarget. Only DOM elements may be true EventTargets, * but this can be used as a base class to provide event dispatch to non-DOM * classes. Only FakeEvents should be dispatched. * * @struct * @constructor * @export */ export declare class FakeEventTarget { private _listeners; private readonly dispatchTarget; private __logger; constructor(); /** * Add an event listener to this object. * * @param {string} type The event type to listen for. * @param {FakeEventTarget.EventListener} listener The callback or * listener object to invoke. * @param {boolean=} opt_capturing Ignored. FakeEventTargets do not have * parents, so events neither capture nor bubble. * @override * @export */ addEventListener(type: string, listener: typeof EventListener_2): void; /** * Remove an event listener from this object. * * @param {string} type The event type for which you wish to remove a listener. * @param {FakeEventTarget.EventListener} listener The callback or * listener object to remove. * @param {boolean=} opt_capturing Ignored. FakeEventTargets do not have * parents, so events neither capture nor bubble. * @override * @export */ removeEventListener(type: string, listener: typeof EventListener_2): void; /** * Dispatch an event from this object. * * @param {!Event} event The event to be dispatched from this object. * @return {boolean} True if the default action was prevented. * @override * @export */ dispatchEvent(event: FakeEvent): boolean; } /** * Filter the video tracks which not in the range * @function filterVideoTracksByRestriction * @param {Array} videoTracks - The tracks to filter * @param {PKABRRestrictionObject} restriction - The restriction * @returns {Array} - The relevant video tracks after restrictions. */ export declare function filterTracksByRestriction(videoTracks: VideoTrack[], restriction: PKABRRestrictionObject): VideoTrack[]; export declare type FontAlignmentOptions = 'default' | 'left' | 'center' | 'right'; export declare type FontScaleOptions = -1 | 0 | 2; export declare type FontSizeOptions = '100%' | '112.5%' | '125%'; declare const _Generator: { /** * Generates unique id. * @param {number} length - The length of the id. * @returns {string} - The generated id. */ uniqueId: (length?: number) => string; /** * Generates GUID. * @return {string} - GUID * @private */ guid: () => string; }; export declare const getCapabilities: typeof Player.getCapabilities; /** * get a logger * @param {?string} name - the logger name * @returns {Object} - the logger class */ export declare function getLogger(name?: string): ILogger; /** * get the log level * @param {?string} name - the logger name * @returns {PKLogLevelObject} - the log level */ export declare function getLogLevel(name?: string): ILogLevel; declare const getSubtitleStyleSheet: (playerId: string) => CSSStyleSheet; export declare const Html5EventType: { /** * Fires when the loading of an audio/video is aborted */ readonly ABORT: "abort"; /** * Fires when the browser can start playing the audio/video */ readonly CAN_PLAY: "canplay"; /** * Fires when the browser can play through the audio/video without stopping for buffering */ readonly CAN_PLAY_THROUGH: "canplaythrough"; /** * Fires when the duration of the audio/video is changed */ readonly DURATION_CHANGE: "durationchange"; /** * Fires when the current playlist is empty */ readonly EMPTIED: "emptied"; /** * Fires when the current playlist is ended */ readonly ENDED: "ended"; /** * Fires when an error occurred during the loading of an audio/video */ readonly ERROR: "error"; /** * Fires when the browser has loaded the current frame of the audio/video */ readonly LOADED_DATA: "loadeddata"; /** * Fires when the browser has loaded meta data for the audio/video */ readonly LOADED_METADATA: "loadedmetadata"; /** * Fires when the browser starts looking for the audio/video */ readonly LOAD_START: "loadstart"; /** * Fires when the audio/video has been paused */ readonly PAUSE: "pause"; /** * Fires when the audio/video has been started or is no longer paused */ readonly PLAY: "play"; /** * Fires when the audio/video is playing after having been paused or stopped for buffering */ readonly PLAYING: "playing"; /** * Fires when the browser is downloading the audio/video */ readonly PROGRESS: "progress"; /** * Fires when the playing speed of the audio/video is changed */ readonly RATE_CHANGE: "ratechange"; /** * Fires when the user is finished moving/skipping to a new position in the audio/video */ readonly SEEKED: "seeked"; /** * Fires when the user starts moving/skipping to a new position in the audio/video */ readonly SEEKING: "seeking"; /** * Fires when the browser is trying to get media data, but data is not available */ readonly STALLED: "stalled"; /** * Fires when the browser is intentionally not getting media data */ readonly SUSPEND: "suspend"; /** * Fires when the current playback position has changed */ readonly TIME_UPDATE: "timeupdate"; /** * Fires when the volume has been changed */ readonly VOLUME_CHANGE: "volumechange"; /** * Fires when the video stops because it needs to buffer the next frame */ readonly WAITING: "waiting"; /** * Fires when the engine enters picture in picture */ readonly ENTER_PICTURE_IN_PICTURE: "enterpictureinpicture"; /** * Fires when the engine exits picture in picture */ readonly LEAVE_PICTURE_IN_PICTURE: "leavepictureinpicture"; /** * Fires when the engine changes presentation mode on safari webkitpresentationmodechanged */ readonly PRESENTATION_MODE_CHANGED: "webkitpresentationmodechanged"; }; declare const _Http: { protocol: string; execute: (url: string, params: any, method?: string, headers?: Map, timeout?: number, ontimeout?: ((...args: any[]) => any) | undefined) => Promise; jsonp: typeof jsonp; convertHeadersToDictionary: (headerRow: string) => { [header: string]: string; }; }; declare interface IBrowser { /** * Possible values : * Amaya, Android Browser, Arora, Avant, Baidu, Blazer, Bolt, Camino, Chimera, Chrome, * Chromium, Comodo Dragon, Conkeror, Dillo, Dolphin, Doris, Edge, Epiphany, Fennec, * Firebird, Firefox, Flock, GoBrowser, iCab, ICE Browser, IceApe, IceCat, IceDragon, * Iceweasel, IE [Mobile], Iron, Jasmine, K-Meleon, Konqueror, Kindle, Links, * Lunascape, Lynx, Maemo, Maxthon, Midori, Minimo, MIUI Browser, [Mobile] Safari, * Mosaic, Mozilla, Netfront, Netscape, NetSurf, Nokia, OmniWeb, Opera [Mini/Mobi/Tablet], * Phoenix, Polaris, QQBrowser, RockMelt, Silk, Skyfire, SeaMonkey, SlimBrowser, Swiftfox, * Tizen, UCBrowser, Vivaldi, w3m, Yandex */ name: string | undefined; /** * Determined dynamically */ version: string | undefined; /** * Determined dynamically * @deprecated */ major: string | undefined; } export declare interface ICapability { runCapability(): void; getCapability(): Promise; setCapabilities(capabilities: { [name: string]: any; }): void; } declare interface ICPU { /** * Possible architecture: * 68k, amd64, arm, arm64, avr, ia32, ia64, irix, irix64, mips, mips64, pa-risc, * ppc, sparc, sparc64 */ architecture: string | undefined; } declare interface IDevice { /** * Determined dynamically */ model: string | undefined; /** * Possible type: * console, mobile, tablet, smarttv, wearable, embedded */ type: string | undefined; /** * Possible vendor: * Acer, Alcatel, Amazon, Apple, Archos, Asus, BenQ, BlackBerry, Dell, GeeksPhone, * Google, HP, HTC, Huawei, Jolla, Lenovo, LG, Meizu, Microsoft, Motorola, Nexian, * Nintendo, Nokia, Nvidia, Ouya, Palm, Panasonic, Polytron, RIM, Samsung, Sharp, * Siemens, Sony-Ericsson, Sprint, Xbox, ZTE */ vendor: string | undefined; } export declare interface IDrmProtocol { isConfigured(drmData: Array, drmConfig: PKDrmConfigObject): boolean; canPlayDrm(drmData: Array): boolean; setDrmPlayback(...any: any[]): void; } export declare interface IEngine extends FakeEventTarget { restore(source: PKMediaSourceObject, config: Object): void; destroy(): void; attach(): void; detach(): void; play(): Promise | undefined; pause(): void; load(startTime?: number): Promise<{ tracks: Track[]; }>; reset(): void; selectVideoTrack(videoTrack: VideoTrack): void; selectAudioTrack(audioTrack: AudioTrack): void; selectTextTrack(textTrack: TextTrack_2): void; selectImageTrack(imageTrack: ImageTrack): void; isPictureInPictureSupported(): boolean; enterPictureInPicture(): void; exitPictureInPicture(): void; hideTextTrack(): void; enableAdaptiveBitrate(): void; isAdaptiveBitrateEnabled(): boolean; applyABRRestriction(restrictions: PKABRRestrictionObject): void; seekToLiveEdge(): void; getStartTimeOfDvrWindow(): number; isLive(): boolean; getVideoElement(): HTMLVideoElement; resetAllCues(): void; attachMediaSource(): void; detachMediaSource(): void; getThumbnail(time: number): ThumbnailInfo | null; isOnLiveEdge(): boolean; addTextTrack(kind: TextTrackKind, label?: string, language?: string): TextTrack | undefined; getNativeTextTracks(): TextTrack[]; getDrmInfo(): PKDrmDataObject | null; setCachedUrls(cachedUrls: string[]): any; shouldAddTextTrack?(): void; id: string; currentTime: number; duration: number; liveDuration: number; volume: number; paused: boolean; seeking: boolean; played: TimeRanges; buffered: TimeRanges; videoHeight: number; videoWidth: number; muted: boolean; defaultMuted: boolean; src: string; poster: string; preload: 'none' | 'metadata' | 'auto' | ''; autoplay: boolean; controls: boolean; loop: boolean; error: MediaError | null; seekable: TimeRanges; ended: boolean; playbackRate: number; playbackRates: Array; defaultPlaybackRate: number; isInPictureInPicture: boolean; networkState: number; readyState: number; playsinline: boolean; crossOrigin: string | null; targetBuffer: number; availableBuffer: number; mediaSourceAdapter: IMediaSourceAdapter | null; } declare interface IEngine_2 { /** * Possible name: * Amaya, EdgeHTML, Gecko, iCab, KHTML, Links, Lynx, NetFront, NetSurf, Presto, * Tasman, Trident, w3m, WebKit */ name: string | undefined; /** * Determined dynamically */ version: string | undefined; } export declare interface IEngineDecorator { active: boolean; dispatchEvent(event: FakeEvent): boolean; restore?: (source: PKMediaSourceObject, config: any) => void; reset?: () => void; destroy?: () => void; attach?: () => void; detach?: () => void; getVideoElement?: () => HTMLVideoElement; selectVideoTrack?: (videoTrack: VideoTrack) => void; selectAudioTrack?: (audioTrack: AudioTrack) => void; selectTextTrack?: (textTrack: TextTrack_2) => void; hideTextTrack?: () => void; enableAdaptiveBitrate?: () => void; isAdaptiveBitrateEnabled?: () => boolean; seekToLiveEdge?: () => void; getStartTimeOfDvrWindow?: () => number; isLive?: () => boolean; play?: () => void; pause?: () => void; load?: (startTime?: number) => Promise; enterPictureInPicture?: () => void; exitPictureInPicture?: () => void; isPictureInPictureSupported?: () => boolean; resetAllCues?: () => void; attachMediaSource?: () => void; detachMediaSource?: () => void; id?: string; src?: string; currentTime?: number; duration?: number; volume?: number; paused?: boolean; seeking?: boolean; seekable?: TimeRanges; played?: TimeRanges; buffered?: TimeRanges; muted?: boolean; defaultMuted?: boolean; poster?: string; preload?: string; autoplay?: boolean; loop?: boolean; controls?: boolean; playbackRates?: Array; playbackRate?: number; defaultPlaybackRate?: number; ended?: boolean; error?: MediaError; networkState?: number; readyState?: number; videoHeight?: number; videoWidth?: number; playsinline?: boolean; crossOrigin?: string; isInPictureInPicture?: boolean; targetBuffer?: number; availableBuffer?: number; } export declare interface IEngineDecoratorProvider { getEngineDecorator(engine: IEngine, dispatchEventHandler: Function): IEngineDecorator; getName(): string; } export declare interface IEngineStatic { id: string; createEngine(source: PKMediaSourceObject, config: Object, playerId: string): IEngine; canPlaySource(source: PKMediaSourceObject, preferNative: boolean, drmConfig: PKDrmConfigObject): boolean; runCapabilities(): void; getCapabilities(): Promise; setCapabilities(capabilities: { [name: string]: any; }): void; prepareVideoElement(playerId: string): void; isSupported(): boolean; } declare interface IEnv extends IResult { isConsole: boolean; isSmartTV: boolean; isMobile: boolean; isTablet: boolean; isWearable: boolean; isEmbedded: boolean; isIPadOS: boolean; isSafari: boolean; isIOS: boolean; isMacOS: boolean; isChrome: boolean; isEdge: boolean; } export declare type ImageSourceOptions = { thumbnailAPIParams: { [parmaName: string]: string; }; }; export declare class ImageTrack extends Track { private _url; private _width; private _height; private _duration; private _rows; private _cols; private _customData; constructor(settings: { id: string; active: boolean; index: number; url: string; width: number; height: number; duration: number; rows: number; cols: number; customData: any; }); get url(): string; get width(): number; get height(): number; get duration(): number; get rows(): number; get cols(): number; get customData(): any; get sliceWidth(): number; get sliceHeight(): number; } export declare interface IMediaSourceAdapter extends FakeEventTarget { src: string; liveDuration: number; capabilities: PKMediaSourceCapabilities; targetBuffer: number; load(startTime?: number): Promise<{ tracks: Track[]; }>; handleMediaError(error?: MediaError): boolean; destroy(): Promise; selectVideoTrack(videoTrack: VideoTrack): void; selectAudioTrack(audioTrack: AudioTrack): void; selectTextTrack(textTrack: TextTrack_2): void; selectImageTrack(imageTrack: ImageTrack): void; hideTextTrack(): void; enableAdaptiveBitrate(): void; isAdaptiveBitrateEnabled(): boolean; seekToLiveEdge(): void; isLive(): boolean; isOnLiveEdge(): boolean; getStartTimeOfDvrWindow(): number; setMaxBitrate(bitrate: number): void; attachMediaSource(): void; detachMediaSource(): void; getSegmentDuration(): number; disableNativeTextTracks(): void; getThumbnail(time: number): ThumbnailInfo | null; getDrmInfo(): PKDrmDataObject | null; applyABRRestriction(restriction: PKABRRestrictionObject): void; applyTextTrackStyles(sheet: CSSStyleSheet, styles: TextStyle, containerId: string, engineClassName?: string): void; setCachedUrls(cachedUrls: string[]): any; } export declare interface IMediaSourceAdapterStatic { id: string; isSupported(): boolean; isMSESupported(): boolean; canPlayType(mimeType: string): boolean; canPlayDrm(drmData: Array, drmConfig: PKDrmConfigObject): boolean; createAdapter(videoElement: HTMLVideoElement, source: PKMediaSourceObject, config: Object): IMediaSourceAdapter; } declare interface IOS { /** * Possible 'os.name' * AIX, Amiga OS, Android, Arch, Bada, BeOS, BlackBerry, CentOS, Chromium OS, Contiki, * Fedora, Firefox OS, FreeBSD, Debian, DragonFly, Gentoo, GNU, Haiku, Hurd, iOS, * Joli, Linpus, Linux, Mac OS, Mageia, Mandriva, MeeGo, Minix, Mint, Morph OS, NetBSD, * Nintendo, OpenBSD, OpenVMS, OS/2, Palm, PCLinuxOS, Plan9, Playstation, QNX, RedHat, * RIM Tablet OS, RISC OS, Sailfish, Series40, Slackware, Solaris, SUSE, Symbian, Tizen, * Ubuntu, UNIX, VectorLinux, WebOS, Windows [Phone/Mobile], Zenwalk */ name: string | undefined; /** * Determined dynamically */ version: string | undefined; } declare interface IResult { ua: string; browser: IBrowser; device: IDevice; engine: IEngine_2; os: IOS; cpu: ICPU; } /** * JSONP utility. * @param {string} url - The url of the request. * @param {string} callback - Callback function to be called when the request returns. * @param {Object} options - Object contains configuration (currently only timeout). * @returns {Promise<*>} - A promise with the callback output. */ declare function jsonp(url: string, callback: (...args: any[]) => any, options: { timeout: number; }): Promise; /** * @typedef {function(!Event)} */ declare type ListenerType = EventListener | ((event: FakeEvent) => any); /** * @param {Object} config - The configuration of the player * @returns {Player} - The player instance */ declare function loadPlayer(config: any): Player; export default loadPlayer; export { loadPlayer } export declare type LoggerLevels = { TRACE: ILogLevel; TIME: ILogLevel; ERROR: ILogLevel; INFO: ILogLevel; DEBUG: ILogLevel; WARN: ILogLevel; OFF: ILogLevel; }; export declare const LogLevel: LoggerLevels; export declare const LogLevelType: Record; export declare type MaybeState = State | null; /** * Media source provider * @classdesc */ declare class MediaSourceProvider { /** * The logger of the media source provider. * @member {any} _logger * @static * @private */ private static _logger; /** * The media source adapter registry. * @member {Array} _mediaSourceAdapters * @static * @private */ private static _mediaSourceAdapters; /** * The selected adapter for playback. * @type {null|IMediaSourceAdapterStatic} * @static * @private */ private static _selectedAdapter; /** * Add a media source adapter to the registry. * @function register * @param {IMediaSourceAdapterStatic} mediaSourceAdapter - The media source adapter to register. * @static * @returns {void} */ static register(mediaSourceAdapter: IMediaSourceAdapterStatic): void; /** * Remove a media source adapter from the registry. * @function unRegister * @param {IMediaSourceAdapterStatic} mediaSourceAdapter - The media source adapter to unRegister. * @static * @returns {void} */ static unRegister(mediaSourceAdapter: IMediaSourceAdapterStatic): void; /** * Checks if the a media source adapter can play a given source. * @param {PKMediaSourceObject} source - The source object to check. * @param {boolean} [preferNative=true] - prefer native flag. * @param {PKDrmConfigObject} drmConfig - The drm config. * @returns {boolean} - Whether a media source adapter can play the source. * @public * @static */ static canPlaySource(source: PKMediaSourceObject, preferNative: boolean | undefined, drmConfig: PKDrmConfigObject): boolean; /** * Orders the media source adapters array according to the preferNative value. * @param {boolean} preferNative - Whether to prefer native playback. * @private * @returns {void} */ static _orderMediaSourceAdapters(preferNative: boolean): void; /** * Get the appropriate media source adapter to the video source. * @function getMediaSourceAdapter * @param {HTMLVideoElement} videoElement - The video element which requires adapter for a given mimeType. * @param {PKMediaSourceObject} source - The selected source object. * @param {Object} config - The player configuration. * @returns {IMediaSourceAdapter|null} - The selected media source adapter, or null if such doesn't exists. * @static */ static getMediaSourceAdapter(videoElement: HTMLVideoElement, source: PKMediaSourceObject, config: any): IMediaSourceAdapter | null; /** * Destroys the media source adapter provider necessary props. * @static * @returns {void} */ static destroy(): void; } export declare const MediaType: PKMediaTypes; declare const MimeType_2: PKMimeTypes; export { MimeType_2 as MimeType } /** * A simple multimap template. * @constructor * @struct * @template T */ declare class MultiMap { private _map; constructor(); /** * Add a key, value pair to the map. * @param {K} key - * @param {T} value - * @returns {void} */ push(key: K, value: T): void; /** * Set an array of values for the key, overwriting any previous data. * @param {K} key - * @param {!Array.} values - * @returns {void} */ set(key: K, values: T[]): void; /** * Check for a key. * @param {K} key - * @return {boolean} true if the key exists. */ has(key: K): boolean; /** * Get a list of values by key. * @param {K} key - * @return {Array.} or null if no such key exists. */ get(key: K): Array; /** * Get a list of all values. * @returns {!Array.} - */ getAll(): T[]; /** * Remove a specific value, if it exists. If there are no more values to the key, the key is removed * @param {K} key - * @param {T} value - * @returns {void} */ remove(key: K, value: T): void; /** * Get all keys from the multimap. * @return {!Array.} */ keys(): Iterator; /** * Clear all keys and values from the multimap. * @returns {void} */ clear(): void; } export declare const NAME: string; declare const _Number: { /** * @param {number} n - A certain number * @returns {boolean} - If the input is a number */ isNumber: (n: number) => boolean; /** * @param {number} n - A certain number * @returns {boolean} - If the input is an integer */ isInt: (n: number) => boolean; /** * @param {number} n - A certain number * @returns {boolean} - If the input is a float */ isFloat: (n: number) => boolean; }; declare const _Object: { /** * @param {Array} objects - The objects to merge * @returns {Object} - The merged object. */ merge: (objects: Array) => any; /** * @param {any} item - The item to check. * @returns {boolean} - Whether the item is an object. */ isObject: (item: any) => boolean; /** * @param {any} item - The item to check if it's class * @returns {boolean} - Whether the item is a class */ isClassInstance: (item: any) => boolean; /** * @param {any} target - The target object. * @param {any} sources - The objects to merge. * @returns {Object} - The merged object. */ mergeDeep: (target: any, ...sources: any) => any; /** * @param {any} data - The data to copy. * @returns {any} - The copied data. */ copyDeep: (data: any) => any; /** * Checks if an object is an empy object. * @param {Object} obj - The object to check * @returns {boolean} - Whether the object is empty. */ isEmptyObject: (obj: object) => boolean; /** * Checks for nested object properties. * @param {Object} obj - The object to check. * @param {string} propertyPath - The path to check. * @returns {boolean} - The value in this path. */ getPropertyPath: (obj: object, propertyPath: string) => any; /** * Checks for nested object properties. * @param {Object} obj - The object to check. * @param {string} propertyPath - The path to check. * @returns {boolean} - Whether the path exists in the object. */ hasPropertyPath: (obj: object, propertyPath: string) => boolean; /** * Create an object with a given property path. * @param {Object} obj - The object to create on. * @param {string} path - The path to create in the object. * @param {any} value - The value to set in the path. * @returns {Object} - The result object. */ createPropertyPath: (obj: object, path: string, value?: any) => any; /** * Deleted a property path from an object. * @param {Object} obj - The object to delete the property path from. * @param {string} path - The path to delete in the object. * @returns {void} */ deletePropertyPath: (obj: object, path: string) => void; /** * Creates deferred promise which can resolved/rejected outside the promise scope. * @returns {DeferredPromise} - The promise with resolve and reject props. */ defer: () => DeferredPromise; /** * Binds an handler to a desired context. * @param {any} thisObj - The handler context. * @param {Function} fn - The handler. * @returns {Function} - The new bound function. * @public */ bind: (thisObj: any, fn: (...args: any[]) => any) => (...args: any[]) => any; }; export declare type PKAbrConfigObject = { fpsDroppedMonitoringThreshold: number; fpsDroppedFramesInterval: number; capLevelOnFPSDrop: boolean; }; export declare type PKABRRestrictionObject = { minHeight: number; maxHeight: number; minWidth: number; maxWidth: number; minBitrate: number; maxBitrate: number; }; export declare type PKAdBreakOptions = { type?: string; position?: number; numAds?: number; }; export declare type PKAdOptions = { system?: string; url?: string; contentType?: string; title?: string; position?: number; duration?: number; clickThroughUrl?: string; posterUrl?: string; skipOffset?: number; linear: boolean; width: number; height: number; bitrate: number; bumper: boolean; inStream?: boolean; vpaid?: boolean; streamId?: string; wrapperAdIds: Array; wrapperCreativeIds: Array; wrapperAdSystems: Array; }; declare type PKAutoPlayTypes = { [type: string]: string | boolean; }; export declare type PKCustomLabelsConfigObject = { audio: Function; qualities: Function; video: Function; }; export declare type PKDimensionsConfig = { width: number; height: number; ratio?: string; }; export declare type PKDrmConfigObject = { keySystem: string; }; export declare type PKDrmDataObject = { licenseUrl: string; scheme: string; certificate?: string; }; export declare type PKEventTypes = typeof Html5EventType & typeof CustomEventType & typeof AdEventType; declare type PKExternalCaptionObject = { url: string; label: string; language: string; default?: boolean; type?: string; }; export declare type PKExternalThumbnailsConfig = { vttUrl: string; }; export declare type PKLogConfigObject = { level: string; handler?: ILogHandler; }; export declare type PKMediaSourceCapabilities = { [fpsControl: string]: boolean; }; export declare type PKMediaSourceObject = { mimetype: string; url: string; id?: string; bandwidth: number; width: number; height: number; drmData?: Array; }; export declare type PKMediaSourceOptionsObject = { forceRedirectExternalStreams: boolean; redirectExternalStreamsHandler?: Function; redirectExternalStreamsTimeout?: number; }; declare type PKMediaTypes = { [type: string]: string; }; export declare type PKMetadataConfigObject = { name?: string; description?: string; mediaType?: string; metas?: Object; tags?: string; epgId?: string; recordingId?: string; audioFlavors?: Array; createdAt?: number; updatedAt?: number; endDate?: number; }; export declare type PKMimeTypes = { [mime: string]: Array; }; export declare type PKNetworkConfigObject = { requestFilter?: Function; responseFilter?: Function; maxStaleLevelReloads: number; }; export declare type PKOrientationType = { [type: string]: string; }; export declare type PKPlaybackConfigObject = { audioLanguage: string; textLanguage: string; captionsDisplay: boolean; additionalAudioLanguage: string | [string]; additionalTextLanguage: string | [string]; volume: number; playsinline: boolean; crossOrigin: string; preload: string; autoplay: PKAutoPlayTypes; allowMutedAutoPlay: boolean; updateAudioDescriptionLabels: boolean; muted: boolean; pictureInPicture: boolean; streamPriority: Array; preferNative: PKPreferNativeConfigObject; inBrowserFullscreen: boolean; playAdsWithMSE: boolean; screenLockOrientionMode: string; }; export declare type PKPlaybackOptionsObject = { html5: { hls: any; dash: any; }; }; export declare type PKPlayerDimensions = { width: number; height: number; }; export declare type PKPlayOptionsObject = { programmatic: boolean; }; export declare type PKPreferNativeConfigObject = { hls: boolean; dash: boolean; }; export declare type PKRequestObject = { url: string; body: ArrayBuffer | ArrayBufferView | string | null; headers: { [header: string]: string; }; }; export declare type PKRequestType = { [request: string]: number; }; export declare type PKResponseObject = { url: string; originalUrl: string; data: ArrayBuffer | ArrayBufferView; headers: { [header: string]: string; }; }; export declare type PKSessionConfigObject = { id?: string; ks?: string; isAnonymous?: boolean; partnerId?: number; uiConfId?: number; }; export declare type PKSourcesConfigObject = { hls: Array; dash: Array; progressive: Array; image: Array; document: Array; captions?: Array; thumbnails?: PKExternalThumbnailsConfig; options: PKMediaSourceOptionsObject; type: string; dvr: boolean; metadata: PKMetadataConfigObject; id?: string; poster?: string; duration?: number; startTime?: number; endTime?: number; vr?: any; imageSourceOptions?: ImageSourceOptions; seekFrom?: number; clipTo?: number; mediaEntryType?: PKMediaTypes; }; export declare type PKStatsObject = { targetBuffer: number; availableBuffer: number; }; export declare type PKStreamingConfigObject = { forceBreakStall: boolean; lowLatencyMode: boolean; trackEmsgEvents: boolean; switchDynamicToStatic: boolean; }; export declare type PKStreamPriorityObject = { engine: string; format: string; }; export declare type PKStreamTypes = Record<'DASH' | 'HLS' | 'PROGRESSIVE' | 'IMAGE' | 'DOCUMENT', PlayerStreamTypes>; export declare interface PKTextConfigObject { enableCEA708Captions: boolean; useShakaTextTrackDisplay: boolean; useNativeTextTrack: boolean; textTrackDisplaySetting: PKTextTrackDisplaySettingObject; textStyle: PKTextStyleObject; forceCenter: boolean; captionsTextTrack1Label: string; captionsTextTrack1LanguageCode: string; captionsTextTrack2Label: string; captionsTextTrack2LanguageCode: string; } /** * @typedef {Object} PKTextStyleObject@typedef {Object} PKTextStyleObject * @property {"100%" | "112.5%" | "125%"} fontSize='100%' - Percentage unit relative to the parent element's font size. * @property {-1 | 0 | 2} fontScale=0 - - Integer number representing the scaling factor relative to the parent element's font size. * @property {string} fontFamily='sans-serif' * @property {[number, number, number]} fontColor=[255, 255, 255] - Color in RGB format. * @property {number} fontOpacity=1 * @property {Array<[number, number, number, number, number, number]>} fontEdge=[] * @property {[number, number, number]} backgroundColor=[0, 0, 0] - Color in RGB format. * @property {number} backgroundOpacity=1 * @property {number} fontWeight=400 */ export declare type PKTextStyleObject = { fontSize: FontSizeOptions; textAlign: FontAlignmentOptions; fontScale: FontScaleOptions; fontFamily: string; fontColor: [number, number, number]; fontOpacity: number; fontEdge: Array<[number, number, number, number, number, number]>; backgroundColor: [number, number, number]; backgroundOpacity: number; fontWeight: number; }; export declare interface PKTextTrackCue extends TextTrackCue { value: { key: string; data: string | any; }; type?: string; } export declare type PKTextTrackDisplaySettingObject = { line: string | number; lineAlign: string; align: string; position: number; positionAlign: string; snapToLines: boolean; vertical: string; size: number; }; export declare type PKThumbnailVttCue = { startTime: number; endTime: number; imgUrl: string; coordinates: { x: number; y: number; } | null; size: { height: number; width: number; } | null; }; export declare type PKTrackTypes = { [track: string]: string; }; export declare type PKVideoDimensionsObject = { videoHeight: number; videoWidth: number; }; export declare type PKVideoElementStore = { [id: string]: HTMLVideoElement; } | {}; /** * The playback middleware. */ declare class PlaybackMiddleware { /** * The actions of the playback middleware. * @static */ static Actions: { [action: string]: string; }; /** * The middleware implementation. * @private * @member */ private _middleware; /** * @constructor */ constructor(); /** * Registers a playback middleware instance to the middleware chain. * @param {BaseMiddleware} middlewareInstance - The middleware instance. * @public * @returns {void} */ use(middlewareInstance: BaseMiddleware): void; /** * Runs a load chain. * @param {Function} callback - The last load handler in the chain. * @public * @returns {void} */ load(callback: () => void): void; /** * Runs a play chain. * @param {Function} callback - The last play handler in the chain. * @public * @returns {void} */ play(callback: () => any): void; /** * Runs a pause chain. * @param {Function} callback - The last pause handler in the chain. * @public * @returns {void} */ pause(callback: () => any): void; /** * Runs a setCurrentTime chain. * @param {Number} to - The number to set in seconds. * @param {Function} callback - The last setCurrentTime handler in the chain. * @public * @returns {void} */ setCurrentTime(to: number, callback: () => any): void; } /** * The HTML5 player class. * @classdesc */ export declare class Player extends FakeEventTarget { /** * The player class logger. * @type {any} * @static * @private */ static _logger: ILogger; /** * Runs the engines capabilities tests. * @returns {void} * @public * @static */ static runCapabilities(): void; /** * Gets the engines capabilities. * @param {?string} engineType - The engine type. * @return {Promise} - The engines capabilities object. * @public * @static */ static getCapabilities(engineType?: string): Promise<{ [name: string]: any; }>; /** * Sets an engine capabilities. * @param {string} engineType - The engine type. * @param {Object} capabilities - The engine capabilities. * @returns {void} * @public * @static */ static setCapabilities(engineType: string, capabilities: { [name: string]: any; }): void; /** * The event manager of the player. * @type {EventManager} * @private */ private _eventManager; /** * The poster manager of the player. * @type {PosterManager} * @private */ private _posterManager; /** * The runtime configuration of the player. * @type {Object} * @private */ private _config; /** * The current sources object. * @type {PKSourcesConfigObject} * @private */ private _sources; /** * The playback engine. * @type {IEngine} * @private */ private _engine; /** * The state manager of the player. * @type {StateManager} * @private */ private _stateManager; /** * The tracks of the player. * @type {Array} * @private */ private _tracks; /** * The player ready promise * @type {Promise<*>} * @private */ private _readyPromise?; /** * Whether the play is the first or not * @type {boolean} * @private */ private _firstPlay; /** * Whether the playing is the first or not * @type {boolean} * @private */ private _firstPlaying; /** * Whether the playback already start * @type {boolean} * @private */ private _playbackStart; /** * If quality has changed after playback ended - pend the change * @type {boolean} * @private */ private _pendingSelectedVideoTrack; /** * The available playback rates for the player. * @type {Array} * @private */ private _playbackRates; /** * The default playback rate for the player. * @type {number} * @private */ private _defaultPlaybackRate; /** * The player DOM element container. * @type {HTMLDivElement} * @private */ private _el; /** * The player text DOM element container. * @type {HTMLDivElement} * @private */ private _textDisplayEl; /** * The player black cover div. * @type {HTMLDivElement} * @private */ private _blackCoverEl; /** * The player DOM id. * @type {string} * @private */ private _playerId; /** * The player last updated text cues list * @type {Array} * @private */ private _activeTextCues; /** * The player text disaply settings * @type {PKTextTrackDisplaySettingObject} * @private */ private _textDisplaySettings; /** * The player text style settings * @type {TextStyle} * @private */ private _textStyle; /** * The playback middleware of the player. * @type {PlaybackMiddleware} * @private */ private _playbackMiddleware; /** * The environment(os,device,browser) object of the player. * @type {Object} * @private */ private _env; /** * The currently selected engine type * @type {string} * @private */ private _engineType; /** * The currently selected stream type * @type {string} * @private */ private _streamType; /** * The current playback attributes state * @type {Object} * @private */ private _playbackAttributesState; /** * Whether a load media request has sent, the player should wait to media. * @type {boolean} * @private */ private _loadingMedia; /** * Whether the player is loading a source. * @type {boolean} * @private */ private _loading; /** * Reset indicator state. * @type {boolean} * @private */ private _reset; /** * Destroyed indicator state. * @type {boolean} * @private */ private _destroyed; /** * Fallback to muted auto play mode indicator. * @type {boolean} * @private */ private _fallbackToMutedAutoPlay; /** * holds the external tracks handler controller * @type {ExternalCaptionsHandler} * @private */ private _externalCaptionsHandler; /** * holds the external tracks handler controller * @type {ExternalCaptionsHandler} * @private */ private _externalThumbnailsHandler; /** * holds the full screen controller * @type {FullscreenController} * @private */ private _fullscreenController; /** * holds the resize observer. Incharge of notifying on resize changes. * @type {?AdsController} * @private */ private _resizeWatcher; /** * Whether the user interacted with the player * @type {boolean} * @private */ private _hasUserInteracted; /** * Whether the video is seeked to live edge * @type {boolean} * @private */ private _isOnLiveEdge; /** * Whether should load after attach media used * @type {boolean} * @private */ private _shouldLoadAfterAttach; /** * The aspect ratio of the player. * @type {?string} * @private */ private _aspectRatio; /** * The engine decorator manager. * @type {?EngineDecoratorManager} * @private */ private _engineDecoratorManager; private _cachedUrls; private _timePercentEvent; /** * @param {Object} config - The configuration for the player instance. * @constructor */ constructor(config?: any); /** * Configures the player according to a given configuration. * @param {Object} config - The configuration for the player instance. * @returns {void} */ configure(config?: any): void; /** * Configures the player metadata according to a given configuration. * @param {PKMetadataConfigObject} sourcesMetadata - The sources metadata for the player instance. * @returns {void} */ setSourcesMetadata(sourcesMetadata: PKMetadataConfigObject): void; /** * Configures the player according to a given configuration. * @param {PKSourcesConfigObject} sources - The sources for the player instance. * @returns {void} */ setSources(sources: PKSourcesConfigObject): void; /** * The player readiness * @public * @returns {Promise<*>} - The ready promise */ ready(): Promise; /** * Load media * @public * @returns {void} */ load(): void; /** * Start/resume playback. * @param {PKPlayOptionsObject} playOptions - additional options to control the play. * @param {boolean} playOptions.programmatic - if true, the play call was not initiated by a user gesture and should be handled like auto play. * @returns {void} * @public */ play(playOptions?: PKPlayOptionsObject): void; /** * Pause playback. * @returns {void} * @public */ pause(): void; /** * Gets the view of the player (i.e the dom container object). * @return {HTMLElement} - The dom container. * @public */ getView(): HTMLElement; /** * @returns {HTMLVideoElement} - The video element. * @public */ getVideoElement(): HTMLVideoElement | undefined; /** * Get video height. * @returns {?number} - The intrinsic height of the video. * @public */ get videoHeight(): number | null; /** * Get video width. * @returns {?number} - The intrinsic width of the video. * @public */ get videoWidth(): number | null; /** * Resets the necessary components before change media. * @public * @param {boolean} isChangeMedia - Whether or not this reset triggered due to change media * @returns {void} */ reset(isChangeMedia?: boolean): void; /** * Destroys the player. * @returns {void} * @public */ destroy(): void; /** * Hides the black cover div. * @public * @returns {void} */ hideBlackCover(): void; /** * Shows the black cover div. * @public * @returns {void} */ showBlackCover(): void; /** * Attach the engine's media source * @public * @returns {void} */ attachMediaSource(): void; /** * detach the engine's media source * @public * @returns {void} */ detachMediaSource(): void; /** * detach the engine's media source * @public * @returns {void} * @param {IEngineDecoratorProvider} engineDecoratorProvider - function to create the decorator */ registerEngineDecoratorProvider(engineDecoratorProvider: IEngineDecoratorProvider): void; /** * Get the first buffered range of the engine. * @returns {TimeRanges} - First buffered range of the engine in seconds. * @public */ get buffered(): TimeRanges | null; get stats(): PKStatsObject; /** * Set the current time in seconds. * @param {Number} to - The number to set in seconds. * @public */ set currentTime(to: number); /** * Get the current time in seconds. * @returns {?Number} - The playback current time. * @public */ get currentTime(): number | null; /** * Get the duration in seconds. * @returns {?Number} - The playback duration. * @public */ get duration(): number | null; /** * Get the live duration in seconds. * @returns {?Number} - The live duration. * @public */ get liveDuration(): number | null; /** * Set playback volume. * @param {Number} vol - The volume to set. * @returns {void} * @public */ set volume(vol: number); /** * Get playback volume. * @returns {?Number} - The playback volume. * @public */ get volume(): number | null; /** * Get paused state. * @returns {?boolean} - Whether the video is paused or not. * @public */ get paused(): boolean | null; /** * Get seeking state. * @returns {?boolean} - Whether the video is seeking or not. * @public */ get seeking(): boolean | null; /** * Set playsinline attribute. * Relevant for iOS 10 and up: * Elements will now be allowed to play inline, and will not automatically enter fullscreen mode when playback begins. * @param {boolean} playsinline - Whether the video should plays in line. */ set playsinline(playsinline: boolean); /** * Get playsinline attribute. * Relevant for iOS 10 and up: * Elements will now be allowed to play inline, and will not automatically enter fullscreen mode when playback begins. * @returns {boolean} - Whether the video plays in line. */ get playsinline(): boolean | null; /** * Set player muted state. * @param {boolean} mute - The mute value. * @returns {void} * @public */ set muted(mute: boolean); /** * Get player muted state. * @returns {?boolean} - Whether the video is muted or not. * @public */ get muted(): boolean | null; /** * Get the player source. * @returns {?string} - The current source of the player. * @public */ get src(): string | null; /** * Sets the dimensions of the player. * @param {PKDimensionsConfig} dimensions - the player dimensions config. * @returns {void} * @public */ set dimensions(dimensions: PKDimensionsConfig); private _getTargetElement; /** * Get the dimensions of the player. * @returns {PKPlayerDimensions} - The dimensions of the player. * @public */ get dimensions(): PKPlayerDimensions; /** * Get the poster source URL * @returns {string} - the poster image URL */ get poster(): string; /** * Sets the playbackRate property. * @param {number} rate - The playback speed of the video. */ set playbackRate(rate: number); /** * Gets the current playback speed of the video. * @returns {number} - The current playback speed of the video. */ get playbackRate(): number | null; /** * Gets the possible playback speeds of the video. * @returns {Array} - The possible playback speeds speed of the video. */ get playbackRates(): Array; /** * Gets the default playback speed of the video. * @returns {number} - The default playback speed of the video. */ get defaultPlaybackRate(): number; /** * get the engine type * @returns {string} - html5 */ get engineType(): string; /** * get the stream type * @returns {string} - hls|dash|progressive */ get streamType(): string; /** * Getter for the environment of the player instance. * @return {Object} - The current environment object. * @public */ get env(): IEnv; /** * Get the player config. * @returns {Object} - A copy of the player configuration. * @public */ get config(): any; /** * Get the current player sources object. * @returns {Object} - A copy of the player configuration. * @public */ get sources(): PKSourcesConfigObject; /** * Get whether the user already interacted with the player * @returns {boolean} - Whether the user interacted with the player * @public */ get hasUserInteracted(): boolean; /** * Set the _loadingMedia flag to inform the player that a load media request has sent. * @param {boolean} loading - Whether a load media request has sent. * @returns {void} * @public */ set loadingMedia(loading: boolean); /** * Set crossOrigin attribute. * @param {?string} crossOrigin - 'anonymous' or 'use-credentials' * anonymous: CORS requests for this element will not have the credentials flag set. * use-credentials: CORS requests for this element will have the credentials flag set; this means the request will provide credentials. */ set crossOrigin(crossOrigin: string); /** * Get crossOrigin attribute. * @returns {?string} - 'anonymous' or 'use-credentials' **/ get crossOrigin(): string | null; /** * Get ended attribute state. * @returns {?boolean} - Whether the media has been ended. **/ get ended(): boolean | null; /** * Get the playback middleware. * @returns {PlaybackMiddleware} - The playback middleware. */ get playbackMiddleware(): PlaybackMiddleware; /** * Get the poster manager. * @returns {PlaybackMiddleware} - The poster manager. */ get posterManager(): PosterManager; /** * Checking if the current playback is live. * @function isLive * @returns {boolean} - Whether playback is live. * @public */ isLive(): boolean; /** * Checking if the current playback is audio only. * @function isAudio * @returns {boolean} - Whether playback is audio. * @private */ isAudio(): boolean; /** * Get whether the video is seeked to live edge in dvr * @returns {boolean} - Whether the video is seeked to live edge in dvr * @public */ isOnLiveEdge(): boolean; /** * Checking if the current live playback has DVR window. * @function isDvr * @returns {boolean} - Whether live playback has DVR window. * @public */ isDvr(): boolean; /** * Seeking to live edge. * @function seekToLiveEdge * @returns {void} * @public */ seekToLiveEdge(): void; shouldAddTextTrack(): boolean; /** * Get the start time of DVR window in live playback in seconds. * @returns {Number} - start time of DVR window. * @public */ getStartTimeOfDvrWindow(): number; /** * Returns the tracks according to the filter. if no filter given returns the all tracks. * @function getTracks * @template {Track | AudioTrack | TextTrack | VideoTrack} T * @param {string} [type] - a tracks filter, should be 'video', 'audio' or 'text'. * @returns {Array} - The parsed tracks. * @public */ getTracks(type?: TrackTypes): T[]; /** * Get an object includes the active video/audio/text tracks * @return {{video: VideoTrack, audio: AudioTrack, text: TextTrack}} - The active tracks object */ getActiveTracks(): { video: VideoTrack; audio: AudioTrack; text: TextTrack_2; }; /** * change quality * @function changeQuality * @param {?Track} track - the track to change * @returns {void} * @public */ changeQuality(track: any | string): void; /** * Select a track * @function selectTrack * @param {?Track} track - the track to select * @returns {void} * @public */ selectTrack(track?: Track): void; /** * Hide the text track * @function hideTextTrack * @returns {void} * @public */ hideTextTrack(): void; /** * Show the text track. * @returns {void} * @public */ showTextTrack(): void; /** * Add text track * @function addTextTrack * @param {string} kind - Specifies the kind of text track. * @param {?string} label - A string specifying the label for the text track. * @param {?string} language - A two-letter language code that specifies the language of the text track. * @returns {?TextTrack} - A TextTrack Object, which represents the new text track. * @public */ addTextTrack(kind: TextTrackKind, label?: string, language?: string): TextTrack | undefined; /** * get the native text tracks * @function getNativeTextTracks * @returns {Array} - The native TextTracks array. * @public */ getNativeTextTracks(): Array; /** * Enables adaptive bitrate switching. * @function enableAdaptiveBitrate * @returns {void} * @public */ enableAdaptiveBitrate(): void; /** * Checking if adaptive bitrate switching is enabled. * @function isAdaptiveBitrateEnabled * @returns {boolean} - Whether adaptive bitrate is enabled. * @public */ isAdaptiveBitrateEnabled(): boolean; /** * update the ABR restriction config * @function _applyABRRestriction * @returns {void} * @param {Object} config - new config which configure for checking if it relevant config has changed * @private */ private _applyABRRestriction; /** * update the text track config from current config * @function _applyTextTrackConfig * @returns {void} * @param {Object} config - new config which configure for checking if it relevant config has changed * @private */ private _applyTextTrackConfig; /** * Returns in-stream thumbnail for a chosen time. * @param {number} time - playback time. * @public * @return {?ThumbnailInfo} - Thumbnail info */ getThumbnail(time: number): ThumbnailInfo | null; /** * update the text display settings * @param {PKTextTrackDisplaySettingObject} settings - text cue display settings * @public * @returns {void} */ setTextDisplaySettings(settings: PKTextTrackDisplaySettingObject): void; get textDisplaySetting(): any; /** * Sets style attributes for text tracks. * @param {TextStyle} style - text styling settings * @returns {void} */ set textStyle(style: TextStyle); /** * Gets style attributes for text tracks. * @returns {?TextStyle} - the current style attribute */ get textStyle(): TextStyle; /** * @returns {boolean} - Whether the player is in fullscreen mode. * @public */ isFullscreen(): boolean; /** * Notify the player that the ui application entered to fullscreen. * @public * @returns {void} */ notifyEnterFullscreen(): void; /** * Notify the player that the ui application exited from fullscreen. * @public * @returns {void} */ notifyExitFullscreen(): void; /** * Request the player to enter fullscreen. * @public * @param {string} elementId - element id to full screen * @returns {void} */ enterFullscreen(elementId?: string): void; /** * Request the player to exit fullscreen. * @public * @returns {void} */ exitFullscreen(): void; /** * Request the player to enter picture in picture mode * @public * @returns {void} */ enterPictureInPicture(): void; /** * Request the player to exit picture in picture mode * @public * @returns {void} */ exitPictureInPicture(): void; /** * Check if the player is in picture in picture mode * @public * @return {boolean} if the player is in picture in picture mode or not */ isInPictureInPicture(): boolean; /** * Check if picture in picture supported in this environment * @public * @return {boolean} if the picture in picture feature is supported in this environment */ isPictureInPictureSupported(): boolean; /** * Checking if the selected source is VR. * @returns {boolean} - Whether is VR. * @public */ isVr(): boolean; /** * get the log level * @param {?string} name - the logger name * @returns {Object} - the log level */ getLogLevel(name?: string): ILogLevel; /** * sets the logger level * @param {Object} level - the log level * @param {?string} name - the logger name * @returns {void} */ setLogLevel(level: ILogLevel, name?: string): void; getDrmInfo(): PKDrmDataObject | null; private _applyCustomSubtitleStyles; /** * Remove the current text track from the player view. * @returns {void} * @private */ private _resetTextDisplay; /** * For browsers which block auto play, use the user gesture to open the video element and enable playing via API. * @returns {void} * @private */ private _prepareVideoElement; /** * Set the config level of the player * @returns {void} * @param {Object} config - object containing the log level. * @private */ private _setConfigLogLevel; /** * Check if sources has been received. * @param {PKSourcesConfigObject} sources - sources config. * @returns {boolean} - Whether sources has been received to the player. * @private */ private _hasSources; /** * Creates the player container. * @private * @returns {void} */ private _createPlayerContainer; /** * Appends the engine's video element to the player's div container. * @private * @returns {void} */ private _appendEngineEl; /** * Appends DOM elements by the following priority: * 1. poster (strongest) * 2. black screen * 3. subtitles (weakest) * @private * @returns {void} */ private _appendDomElements; /** * Creates the ready promise. * @private * @returns {void} */ private _createReadyPromise; /** * Handles the playback rate. * @private * @returns {void} */ private _handlePlaybackRate; /** * Selects an engine to play a source according to a given stream priority. * @return {boolean} - Whether a proper engine was found to play the given sources * according to the priority. * @private */ private _selectEngineByPriority; /** * Loads the selected engine. * @param {IEngineStatic} Engine - The selected engine. * @param {PKMediaSourceObject} source - The selected source object. * @private * @returns {void} */ private _loadEngine; /** * Checks if the current engine is a YouTube engine. * @returns {boolean} - whether the engine is a YouTube engine or not * @private */ private _isYouTubeEngine; /** * Creates an engine or an engine decorator. * @param {IEngine} Engine - The selected engine. * @param {PKMediaSourceObject} source - The selected source object. * @returns {void} * @private */ private _createEngine; /** * Listen to all HTML5 defined events and trigger them on the player * @private * @returns {void} */ private _attachMedia; /** * In iframe embed add title element with the entry name * @returns {void} * @private */ private _addTitleOnIframe; /** * if the media was recovered (after a media failure) then initiate play again (if that was the state before) * @returns {void} * @private */ private _handleRecovered; /** * The text track changed event object * @param {FakeEvent} event - payload with text track * @returns {void} * @private */ private _onTextTrackChanged; /** * Reset the active cues hasBeenReset = true and then reposition it, timeout here is for the screen to * finish render the fullscreen * @returns {void} * @private */ private _resetTextCuesAndReposition; /** * Handles the playback options, from current state or config. * @returns {void} * @private */ private _handlePlaybackOptions; /** * Handles preload. * @returns {void} * @private */ private _handlePreload; private _autoPlay; /** } * Checks auto play configuration and handles initialization accordingly. * @returns {void} * @private */ private _handleAutoPlay; /** * Play after async ads * @private * @returns {void} */ private _playAfterAsyncMiddleware; private _load; /** * Handles and sets the initial dimensions configuration if such exists. * @private * @returns {void} */ private _handleDimensions; /** * Start/resume the engine playback. * @private * @returns {void} */ private _play; /** * Checking if player should seek to live edge. * @returns {boolean} - Whether player should seek to live edge. * @private */ private _shouldPlayerSeekToLiveEdge; /** * Starts the engine pause. * @private * @returns {void} */ private _pause; /** * Set the current time in seconds. * @param {Number} to - The number to set in seconds. * @private * @returns {void} */ private _setCurrentTime; /** * @function _onPause * @return {void} * @private */ private _onPause; /** * @function _onPlay * @return {void} * @private */ private _onPlay; /** * @function _onPlaying * @return {void} * @private */ private _onPlaying; /** * Checks if the video has reached the configured endTime and pauses if necessary. * Pauses only once and allows the user to continue playing afterward. * @private * @returns {void} */ private _checkTimeUpdate; /** * @function _onPlayFailed * @param {FakeEvent} event - the play failed event * @return {void} * @private */ private _onPlayFailed; /** * @function _onEnded * @return {void} * @private */ private _onEnded; /** * Resets the state flags of the player. * @returns {void} * @private */ private _resetStateFlags; /** * Calculates the aspect ratio of the player. * @param {HTMLDivElement} targetElement - the player root element. * @param {PKDimensionsConfig} dimensions - the player dimensions input. * @returns {void} * @public */ private _calcRatio; /** * @returns {Object} - The default configuration of the player. * @private * @static */ static get _defaultConfig(): any; /** * handle tracks change * @param {FakeEvent} event - the tracks change event payload * @private * @returns {void} */ _onTracksChanged(event: FakeEvent): void; /** * update the player tracks * @param {Array} tracks - the player tracks * @private * @returns {void} */ _updateTracks(tracks: Array): void; /** * Returns the tracks according to a type. * @function _getTextTracks * @template {TextTrack | AudioTrack | VideoTrack} T * @param {T} [type] - a tracks type filter. * @returns {Array} - The parsed tracks. * @private */ private _getTracksByType; /** * Returns the image tracks. * @function _getImageTracks * @returns {Array} - The image tracks. * @private */ private _getImageTracks; /** * Returns the text tracks. * @function _getTextTracks * @returns {Array} - The text tracks. * @private */ _getTextTracks(): Array; /** * Returns the video tracks. * @function _getVideoTracks * @returns {Array} - The video tracks. * @private */ private _getVideoTracks; /** * Returns the audio tracks. * @function _getAudioTracks * @returns {Array} - The audio tracks. * @private */ private _getAudioTracks; /** * Mark the selected track as active * @function _markActiveTrack * @param {Track} track - the track to mark * @returns {void} * @private */ private _markActiveTrack; /** * handle text cue change * @param {FakeEvent} event - the cue change event payload * @private * @returns {void} */ private _onCueChange; /** * update the text cue display settings * @private * @returns {void} */ private _updateCueDisplaySettings; /** * update the text display * @param {Array} cues - list of cues * @private * @returns {void} */ private _updateTextDisplay; /** * Add off text track if there are actual text tracks associated with media * setting this track is the same as calling Player's hideTextTrack * @private * @returns {void} */ private _addTextTrackOffOption; /** * Sets the default tracks defined in the player config. * @returns {void} * @private */ private _setDefaultTracks; /** * Gets the track language that should be set by default. * @param {Array} tracks - the audio or text tracks. * @param {string} configuredLanguage - The configured language (can be also "auto"). * @param {?T} defaultTrack - The default track. * @private * @returns {string} - The track language to set by default. */ private _getLanguage; /** * Sets a specific default track. * @template {TextTrack | AudioTrack} T * @param {Array} tracks - the audio or text tracks. * @param {string} language - The track language. * @param {Track} defaultTrack - The default track to set in case there is no language configured. * @param {string} additionalLanguage - additional track language. * @returns {void} * @private */ private _setDefaultTrack; /** * Sets the video track selected by the user. * @returns {void} * @private */ private _setDefaultVideoTrack; /** * Checks for callbacks that should change the tracks, and call them on the * respective track group (audio/text/video) * @private * @returns {void} */ private _maybeSetTracksLabels; /** * * @template {AudioTrack | TextTrack | VideoTrack} T * @param {Array} tracks - tracks * @param {Function} callback - application label callback, returns a string * @private * @returns {void} */ private _setTracksCustomLabels; /** * Gets the player event types. * @returns {PKEventTypes} - The event types of the player. * @public */ get Event(): PKEventTypes; /** * Gets the player TextStyle. * @returns {TextStyle} - The TextStyle class * @public */ get TextStyle(): typeof TextStyle; /** * Gets the player state types. * @returns {PKStateTypes} - The state types of the player. * @public */ get State(): typeof StateType; /** * Gets the player tracks types. * @returns {TrackType} - The tracks types of the player. * @public */ get Track(): typeof TrackType; /** * Gets the player log level types. * @returns {PKLogLevelTypes} - The log level types of the player. * @public */ get LogLevelType(): Record; /** * Gets the player log level objects. * @returns {PKLogLevels} - The log levels objects of the player. * @public */ get LogLevel(): LoggerLevels; /** * Gets the player abr modes. * @returns {PKAbrModes} - The abr modes of the player. * @public */ get AbrMode(): typeof AbrMode; /** * Gets the player media types. * @returns {PKMediaTypes} - The media types of the player. * @public */ get MediaType(): typeof MediaType; /** * Gets the player stream types. * @returns {PKStreamTypes} - The stream types of the player. * @public */ get StreamType(): typeof StreamType; /** * Gets the player engine types. * @returns {PKEngineTypes} - The engine types of the player. * @public */ get EngineType(): typeof EngineType; /** * Gets the player cors types. * @returns {PKCorsTypes} - The player cors types. * @public */ get CorsType(): typeof CorsType; /** * Gets the ad break types. * @returns {PKAdBreakTypes} - The ad break types of the player. * @public */ get AdBreakType(): typeof AdBreakType; /** * Gets the ad break tag types. * @returns {PKAdTagTypes} - The ad tag types of the player. * @public */ get AdTagType(): typeof AdTagType; /** * Gets the player static error class. * @returns {PKError} - The player static error class. * @public */ get Error(): typeof Error_2; setCachedUrls(cachedUrls: string[]): void; setSeekFrom(seekFrom: number): void; setClipTo(clipTo: number): void; clearReset(): void; } export declare type PlayerStreamTypes = 'dash' | 'hls' | 'progressive' | 'image' | 'document'; declare class PosterManager { /** * Poster image URL * @type {string} * @private */ private _posterUrl; /** * The poster HTML Div element. * @type {HTMLDivElement} * @private */ private _el; constructor(); /** * Set the poster source URL * @param {string} posterUrl - the poster image URL * @public * @returns {void} */ setSrc(posterUrl?: string): void; /** * Get the poster source URL * @public * @returns {string} - the poster image URL */ get src(): string; /** * Get the poster HTML Div element * @public * @returns {HTMLDivElement} - Poster HTML Dom element */ getElement(): HTMLDivElement; /** * Create the HTML Div element of the poster * @private * @returns {void} */ private _createEl; /** * Removes the poster element from the dom * @private * @returns {void} */ private _removeEl; /** * Show the poster image * @public * @private * @returns {void} */ show(): void; /** * Hide the poster image * @public * @returns {void} */ hide(): void; /** * Resets the poster url and the background image * @public * @returns {void} */ reset(): void; /** * Destroys the poster element * @public * @returns {void} */ destroy(): void; } export declare const registerEngine: typeof EngineProvider.register; export declare const registerMediaSourceAdapter: typeof MediaSourceProvider.register; export declare const RequestType: PKRequestType; declare const resetSubtitleStyleSheet: (playerId: string) => void; /** * A Factory class to create a resize observer for the player. */ declare class ResizeWatcher extends FakeEventTarget { private _observer?; private _el?; constructor(); /** * Removes resize listeners. * @returns {void} */ destroy(): void; /** * Start listening to a resize of the element. * @param {HTMLElement} el - the element to listen to. * @returns {void} */ init(el: HTMLElement): void; private _createNativeObserver; private _createIframeObserver; private _triggerResize; } export declare const ScreenOrientationType: PKOrientationType; export declare const setCapabilities: typeof Player.setCapabilities; /** * sets the logger handler * @private * @param {LogHandlerType} handler - the log level * @returns {void} */ export declare function setLogHandler(handler: ILogHandler): void; /** * sets the logger level * @param {PKLogLevelObject} level - the log level * @param {?string} name - the logger name * @returns {void} */ export declare function setLogLevel(level: ILogLevel, name?: string): void; declare type SeverityType = { [severity: string]: number; }; /** * This class describes a player state. * @classdesc */ export declare class State { /** * The type of the state. * Can be one of those describes in states.js * @member * @type {string} * @public */ type: string; /** * The duration that the player was in this state. * @member * @type {number} * @private */ private _duration; /** * The timestamp that this state started. * @member * @type {number} * @private */ private _timestamp; /** * @constructor * @param {string} type - The type of the state. */ constructor(type: string); /** * Getter for the duration of the state. * @returns {number} - The duration of the state */ get duration(): number; /** * Setter for the duration of the state. * @param {number} endTime - The timestamp of the next state. */ set duration(endTime: number); } export declare type StateChanged = { oldState: MaybeState; newState: MaybeState; }; export declare const StateType: { readonly IDLE: "idle"; readonly LOADING: "loading"; readonly PLAYING: "playing"; readonly PAUSED: "paused"; readonly BUFFERING: "buffering"; }; export declare const StreamType: { readonly DASH: "dash"; readonly HLS: "hls"; readonly PROGRESSIVE: "progressive"; readonly IMAGE: "image"; readonly DOCUMENT: "document"; }; declare const _String: { /** * Uppercase the first letter of a string * @param {String} string - String to be uppercased * @return {String} - The uppercased string * @public * @method toTitleCase */ capitlize: (string: string) => string; /** * @param {string} string - Certain string * @param {string} searchString - Certain string * @returns {boolean} - Whether the string: string is ending with string: searchString */ endsWith: (string: string, searchString: string) => boolean; }; /** * Creates a TextStyle object. * *

* Note that although this API is based on FCC guidelines, we cannot guarantee * that your application is in compliance with this or any other guideline. *

* * @constructor * @struct * @export */ export declare class TextStyle { /** * Defined set of font families * @enum {Object.}} * @export */ static FontFamily: { [font: string]: string; }; /** * Defined in {@link https://goo.gl/ZcqOOM FCC 12-9}, paragraph 111, footnote * 448. Each value is an array of the three RGB values for that color. * @enum {Object.}} * @export */ static StandardColors: { [coloer: string]: [number, number, number]; }; /** * Defined in {@link https://goo.gl/ZcqOOM FCC 12-9}, paragraph 111. * @enum {Object.}} * @export */ static StandardOpacities: { [opacityLevel: string]: number; }; /** * Defined in {@link https://goo.gl/ZcqOOM FCC 12-9}, paragraph 111. * The styles to achieve these effects are not specified anywhere. * * Each inner array represents a shadow, and is composed of RGB values for the * shadow color, followed by pixel values for x-offset, y-offset, and blur. * * @enum {!Array.} * @export */ static EdgeStyles: { [edgeStyle: string]: Array<[number, number, number, number, number, number]>; }; /** * Possible font sizes are 100%, 115%, 125% */ static FontSizes: { label: FontSizeOptions; value: FontScaleOptions; name?: string; }[]; /** * Possible font weights are Light, Normal, SemiBold, Bold */ static StandardFontWeights: { label: string; value: number; }[]; /** * Possible font alignments are left, center, right */ static FontAlignment: { label: string; value: FontAlignmentOptions; }[]; /** * Creates a CSS RGBA sctring for a given color and opacity values * @param {TextStyle.StandardColors} color - color value in RGB * @param {TextStyle.StandardOpacities} opacity - opacity value * @return {string} - CSS rgba string * @private */ static toRGBA(color: [number, number, number], opacity: number): string; static fromJson(setting: PKTextStyleObject): TextStyle; static toJson(text: TextStyle): PKTextStyleObject; private _fontSizeIndex; set fontSize(fontSize: string); private _fontWeightIndex; set fontWeight(weight: string | number); textAlign: FontAlignmentOptions; /** * Percentage string matching a FontSizes entry */ get fontSize(): FontSizeOptions; set fontScale(fontScale: number); get fontWeight(): number; /** * Numeric value matching a FontSizes entry (for backward compatibility) */ get fontScale(): FontScaleOptions; /** * @type {TextStyle.FontFamily} */ fontFamily: string; /** * @type {TextStyle.StandardColors} */ fontColor: [number, number, number]; /** * @type {TextStyle.StandardOpacities} * @expose */ fontOpacity: number; /** * @type {TextStyle.StandardColors} */ backgroundColor: [number, number, number]; /** * @type {TextStyle.StandardOpacities} */ backgroundOpacity: number; /** * @type {TextStyle.EdgeStyles} * @expose */ fontEdge: Array<[number, number, number, number, number, number]>; getTextShadow(): string; /** * Compute the CSS text necessary to represent this TextStyle. * Output does not contain any selectors. * * @return {string} - ::CUE CSS string */ toCSS(): string; /** * clones the textStyle object * @returns {TextStyle} the cloned textStyle object */ clone(): TextStyle; /** * comparing between 2 textStyle objects. * @param {TextStyle} textStyle - The textStyle to compare with. * @returns {boolean} - Whether the text styles are equal. */ isEqual(textStyle: TextStyle): boolean; get implicitFontScale(): number; } declare class TextTrack_2 extends Track { static MODE: Record<'DISABLED' | 'SHOWING' | 'HIDDEN', TextTrackMode>; static KIND: Record<'METADATA' | 'SUBTITLES' | 'CAPTIONS', TextTrackKind>; static EXTERNAL_TRACK_ID: string; private static _tracksCount; private _kind; private _external; private _default; private _mode; constructor(settings?: TrackSettings); static _generateIndex(): number; static reset(): void; get mode(): string | undefined; set mode(mode: string); get kind(): string; get external(): boolean; get default(): boolean; static isMetaDataTrack(track: any): boolean; static isNativeTextTrack(track: any): boolean; static isExternalTrack(track: any): boolean; } export { TextTrack_2 as PKTextTrack } export { TextTrack_2 as TextTrack } export declare class ThumbnailInfo { private _url; private _width; private _height; private _x; private _y; constructor(info: { url: string; width: number; height: number; x: number; y: number; }); get url(): string; get width(): number; get height(): number; get x(): number; get y(): number; } export declare class TimedMetadata { static TYPE: { [type: string]: string; }; startTime: number; endTime: number; id: string; type: string; metadata: string | any; /** * @constructor * @param {number} startTime - start time. * @param {number} endTime - end time. * @param {string} id - id. * @param {string} type - type. * @param {any} metadata - metadata. */ constructor(startTime: number, endTime: number, id: string, type: string, metadata: any); } /** * General track representation of the player. * @classdesc */ export declare class Track { /** * Comparing language strings. * @param {string} inputLang - The configured language. * @param {string} trackLang - The default track language. * @param {string} additionalLanguage - Additional configured language. * @param {boolean} equal - Optional flag to check for matching languages. * @returns {boolean} - Whether the strings are equal or starts with the same substring. */ static langComparer(inputLang: string, trackLang: string, additionalLanguage?: string | string[], equal?: boolean): boolean; private static _langComparer; private static _isLangEqual; private static _isLangPrefixEqual; static clone(track: any): T; /** * The id of the track. * @member * @type {string} * @private */ private _id; /** * The active mode of the track. * @member * @type {boolean} * @private */ private _active; /** * The label of the track. * @member * @type {string} * @private */ protected _label: string | undefined; /** * The language of the track. * @member * @type {string} * @private */ private _language; /** * The index of the track. * @member * @type {number} * @private */ protected _index: number; /** * Indicator if track available or not. * @member * @type {boolean} * @private */ private _available; /** * The clone function reference. * @member * @type {Function} * @public */ clone: (...args: any[]) => any; /** * Getter for the track id. * @public * @returns {?string} - The track id. */ get id(): number; /** * Getter for the active mode of the track. * @public * @returns {boolean} - The active mode of the track. */ get active(): boolean; /** * Setter for the active mode of the track. * @public * @param {boolean} value - Whether the track is active or not. */ set active(value: boolean); /** * Getter for the label of the track. * @public * @returns {string} - The label of the track. */ get label(): string | undefined; /** * Getter for the language of the track. * @public * @returns {string} - The language of the track. */ get language(): string; /** * Getter for the index of the track. * @public * @returns {number} - The index of the track. */ get index(): number; /** * Getter for the available indicator * @public * @returns {boolean} - The indicator if track available or not. */ get available(): boolean; /** * Setter for the index of the track. * @public * @param {number} value - The index of the track. * @returns {void} */ set index(value: number); /** * Setter for the label of the track. * @public * @param {string} value - The label of the track. */ set label(value: string); /** * Setter for the available indicator * @public * @param {boolean} isAvailable - The indicator if track available or not */ set available(isAvailable: boolean); /** * Setter for the language of the track. * @public * @param {string} value - The language of the track. */ set language(value: string); /** * @constructor * @param {Object} settings - The track settings object. */ constructor(settings?: any); } declare type TrackSettings = { kind?: string; external?: boolean; default?: boolean; active?: boolean; label?: string; language?: string; }; export declare const TrackType: { readonly VIDEO: "video"; readonly AUDIO: "audio"; readonly TEXT: "text"; readonly IMAGE: "image"; }; export declare type TrackTypes = 'video' | 'audio' | 'text' | 'image'; export declare type Transition = { [state: string]: { [event: string]: Function; }; }; export declare const unRegisterEngine: typeof EngineProvider.unRegister; declare namespace Utils { export { ResizeWatcher, MultiMap, binarySearch, _Number as Number, _String as String, _Object as Object, _Generator as Generator, _Dom as Dom, _Http as Http, _VERSION as VERSION, getSubtitleStyleSheet, resetSubtitleStyleSheet } } export { Utils } export { Utils as utils } export declare const VERSION: string; declare const _VERSION: { /** * Compares two software version numbers (e.g. "1.7.1" or "1.2b"). * * @param {string} v1 The first version to be compared. * @param {string} v2 The second version to be compared. * @param {object} [options] Optional flags that affect comparison behavior: * lexicographical: (true/[false]) compares each part of the version strings lexicographically instead of naturally; * this allows suffixes such as "b" or "dev" but will cause "1.10" to be considered smaller than "1.2". * zeroExtend: ([true]/false) changes the result if one version string has less parts than the other. In * this case the shorter string will be padded with "zero" parts instead of being considered smaller. * * @returns {number|NaN} * - 0 if the versions are equal * - a negative integer iff v1 < v2 * - a positive integer iff v1 > v2 * - NaN if either version string is in the wrong format */ compare: (v1: string, v2: string, options?: any) => number; }; /** * Video track representation of the player. * @classdesc */ export declare class VideoTrack extends Track { /** * @member {number} _bandwidth - The bandwidth of the video track * @type {number} * @private */ private _bandwidth; /** * @member {number} _width - The width of the video track * @type {number} * @private */ private _width; /** * @member {number} _height - The height of the video track * @type {number} * @private */ private _height; /** * @public * @returns {number} - The bandwidth of the video track */ get bandwidth(): number; /** * @public * @returns {number} - The width of the video track */ get width(): number; /** * @public * @returns {number} - The height of the video track */ get height(): number; /** * @constructor * @param {Object} settings - The track settings object */ constructor(settings?: any); } export * from "js-logger"; export { }