UNPKG

@flowplayer/player

Version:
1,523 lines (1,393 loc) 78 kB
import type { Get } from 'type-fest'; import type { Level } from 'hls.js'; import type { MediaStreamSource } from '@millicast/sdk'; import type { Paths } from 'type-fest'; import type { Representation } from 'dashjs'; import type { Translation } from '@flowplayer/translations'; import type { TupleToUnion } from 'type-fest'; /* Excluded from this release type: AnyLoader */ declare type ArrayToIntersection<T extends Array<unknown>> = T extends [ infer Current, ...infer Remaining ] ? Current & ArrayToIntersection<Remaining> : unknown; /** * Each loader must */ declare type _AttachedEventCheck = { on(event: `${string}:attached`, handler: (e: FPEvent<unknown>) => void): Player; }; /* Excluded from this release type: AUDIO_ONLY_SOURCE */ /* Excluded from this release type: AudioOnlySourceEventDetail */ /** * Represents the parsed WebRTC statistics collected for an input or output audio & video stream. */ declare interface AudioVideoCollect<TAudio, TVideo> { /** Audio statistics. */ audio: TAudio[]; /** Video statistics. */ video: TVideo[]; } declare const AUTOPLAY = "is-autoplay"; /** * @public */ declare type Autoplay = BitOpts | boolean; declare enum AutoplayOpts { OFF = 0, ON = 1, AUDIO_REQUIRED = 2 } /* Excluded from this release type: BEFORE_PAUSE */ /* Excluded from this release type: BEFORE_PLAY */ /** * @public */ declare type BeforePauseEventDetail = { forced: boolean; }; /** * @public */ declare type BeforePlayEventDetail = { forced: boolean; }; /** * @public */ declare type BitOpts = number; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ CAN_PLAY = "canplay"; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ CLICK = "click"; /** * For plugins that add new properties to all source types, combine their src-mixins into one SourceObject * @example * ``` * type Combined = CombineGlobalSrcExtensions<DRMPlugin, PluginWithFooFieldInSrc> // Combined = SourceObject<DRMConfig & FooFieldConfig> * ``` */ declare type CombineGlobalSrcExtensions<PluginSrcs extends unknown[]> = HasGlobalSrcExtensios<PluginSrcs> extends false ? SourceObj : SourceObj & ArrayToIntersection<PickGlobalSrcExtension<PluginSrcs>>; /** * For plugins that define a new src type, make a union of all new src.type declarations * @example * ``` * type Combined = CombineNewSourceTypes<RTSPlugin, SSAIPlugin> // Combined = DRMConfig | FooFieldConfig * ``` */ declare type CombineNewSourceTypes<PluginSrcs extends unknown[]> = TupleToUnion<FilterNewSourceTypes<PluginSrcs>>; declare type CombineSrc<PluginSrcs extends unknown[]> = UnsafeSource<CombineGlobalSrcExtensions<PluginSrcs> | (CombineNewSourceTypes<PluginSrcs> & CombineGlobalSrcExtensions<PluginSrcs>)>; /* Excluded from this release type: Component */ /* Excluded from this release type: Components */ /* Excluded from this release type: CONFIG */ /** * @public */ declare interface Config { src?: UnsafeSource; preload?: "none" | "metadata" | "auto"; controls?: boolean; lang?: string; start_time?: number; autopause?: boolean; rewind?: boolean; loop?: boolean; /** * an access token for the media * @public */ playback_token?: string; /* Excluded from this release type: seamless */ retry?: boolean; autoplay?: Autoplay; start_quality?: BitOpts; live?: boolean; poster?: string; disabled?: boolean; muted?: boolean; /* Excluded from this release type: is_native */ /** * bitflags for UI options */ ui?: BitOpts; /** * your user access token */ token?: string; /* Excluded from this release type: duration */ /** * can the content be seeked to any position */ seekable?: boolean; multiplay?: boolean; ratio?: number | string; logo?: string; logo_href?: string; logo_alt_text?: string; title?: string; description?: string; /** * the number of seconds to have in the buffer before dvr is activated */ seconds_to_dvr?: number; } /* Excluded from this release type: ConfigEventDetail */ /** * @public */ declare type ConfigWith<T> = Config & T; declare type ConfigWithSourceExtensions<PluginBareConfigs extends unknown[]> = Omit<ConfigWith<ArrayToIntersection<PluginBareConfigs>>, "src"> & { src?: CombineSrc<PickSrcExtensions<PluginBareConfigs>>; }; /* Excluded from this release type: CONTENT_REAL_LOAD_START */ /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ CONTEXT_MENU = "contextmenu"; /** * @public */ declare type ContextMenuEventDetail = null; /** * @public * @deprecated * when a cuepoint becomes inactive */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public * @deprecated * when a cuepoint becomes inactive */ CUEPOINT_END = "cuepointend"; /** * @public * @deprecated * when a cuepoint is active */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public * @deprecated * when a cuepoint is active */ CUEPOINT_START = "cuepointstart"; /** * @public * @deprecated * cuepoints parsing is asynchronous * you cannot rely on them existing until * this event is emitted */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public * @deprecated * cuepoints parsing is asynchronous * you cannot rely on them existing until * this event is emitted */ CUEPOINTS = "cuepoints"; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ DATA = "loadeddata"; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ DBL_CLICK = "dblclick"; declare const DESTROYED = "is-destroyed"; /* Excluded from this release type: DeviceId */ declare const DISABLED = "is-disabled"; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ DURATION_CHANGE = "durationchange"; /** * @public * when the player has started playing dvr content */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public * when the player has started playing dvr content */ DVR = "dvr"; /** * @public */ declare type DvrEventDetail = number; declare const ENDED = "is-ended"; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ ENDED_2 = "ended"; declare type EnsureOnAttached<P extends Function, T extends Player> = ExtractPureAPI<T> extends _AttachedEventCheck ? P : "Loaders must implement on('<pluginname>:attached') event"; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ ERROR = "error"; declare const ERRORED = "is-error"; declare namespace events { export { STATUS, VIEWER_COUNT, STATS } } declare namespace events_2 { export { MOUNT, RETRY, ERROR, CONTEXT_MENU, CLICK, DBL_CLICK, KEYUP, KEYDOWN, LOAD, MOUSE_ENTER, MOUSE_LEAVE, MOUSE_UP, MOUSE_DOWN, MOUSE_MOVE, TOUCH_START, TOUCH_MOVE, TOUCH_END, TOUCH_CANCEL, RESIZE, SCROLL, FULLSCREEN_ENTER, FULLSCREEN_EXIT, FULLSCREEN_CHANGE, METADATA, DATA, PROGRESS, TIME_UPDATE, LOAD_START, VOLUME_CHANGE, PAUSE, PLAYING_2 as PLAYING, PLAY, WAITING_2 as WAITING, CAN_PLAY, ENDED_2 as ENDED, SEEKED, SEEKING_2 as SEEKING, DURATION_CHANGE, VIEW_ENTER, VIEW_LEAVE, SOURCE, REAP, QUALITIES, QUALITY_CHANGE, VIDEO_TRACKS, SET_QUALITY, VIDEO_TRACK_SELECT, RECOMMENDATIONS_READY, LANDSCAPE, PORTRAIT, DVR, LIVE, RECOVER, CUEPOINTS, CUEPOINT_START, CUEPOINT_END, STANDARD_ERROR } } declare type ExtractBareConfig<Plugins extends PluginCtor> = Plugins extends PluginCtor<ConfigWith<infer ConfigType>> ? ConfigType : never; declare type ExtractPluginPlayerExtension<Plugin extends PluginCtor> = Plugin extends PluginCtor<infer _uConfigType, PlayerWith<infer PluginPlayer>> ? PluginPlayer : never; declare type ExtractPureAPI<T> = T extends PlayerWith<infer PureAPI> ? PureAPI : never; declare type ExtractSrcExtension<PluginBareConfig> = Get<PluginBareConfig, "src"> extends UnsafeSource<infer SrcMixinType> ? SrcMixinType : never; declare const FEATURE_USAGE = "flowplayer:feature"; /* Excluded from this release type: FeatureUsageEventDetail */ declare type FilterNewSourceTypes<PluginSrcs extends unknown[]> = { [Index in keyof PluginSrcs]: PluginSrcs[Index] extends { type: string; } ? PluginSrcs[Index] : never; }; /** * @public */ declare type FlowplayerCustomElementRegistry = Map<string, string>; declare class FlowplayerError extends Error { readonly message: string; readonly flowplayerErrorCode: FlowplayerErrorCode; readonly config: FlowplayerErrorConfig; static getErrorKey(code: FlowplayerErrorCode): FlowplayerErrorCodeName; readonly id: string; readonly isFatal: boolean; readonly errorKey: string; constructor(message: string, flowplayerErrorCode: FlowplayerErrorCode, config?: FlowplayerErrorConfig); toJSON(): { message: string; flowplayer_error_code: FlowplayerErrorCode; id: string; root_error_id: string | undefined; resource: string | undefined; is_fatal: boolean; is_retry: boolean; }; } declare type FlowplayerErrorCode = (typeof FlowplayerErrorCodeMap)[keyof typeof FlowplayerErrorCodeMap]; declare const FlowplayerErrorCodeMap: { /** Unknown */ readonly Unknown: "00-00"; /** Media Section */ readonly MediaUnknown: "01-00"; readonly MediaUnavailable: "01-01"; readonly MediaUnsupportedVideoFormat: "01-02"; readonly MediaUnsupportedAudioFormat: "01-03"; readonly MediaBitrateExceeded: "01-04"; readonly MediaBufferOverread: "01-05"; readonly MediaIntegerOverflow: "01-06"; readonly MediaQuotaExceeded: "01-07"; readonly MediaInvalidCompositionDuration: "01-08"; readonly MediaInvalidCompositionSourceDuration: "01-09"; readonly MediaInvalidCompositionSourceStartTime: "01-10"; readonly MediaMalformedDepth: "01-11"; /** Playback Section */ readonly PlaybackUnknown: "02-00"; readonly PlaybackVideoBufferUnderRun: "02-01"; readonly PlaybackAudioBufferUnderRun: "02-02"; readonly PlaybackVideoBufferingTimeout: "02-03"; readonly PlaybackAudioBufferingTimeout: "02-04"; readonly PlaybackManifestParseError: "02-05"; readonly PlaybackVideoDecodeError: "02-06"; readonly PlaybackAudioDecodeError: "02-07"; readonly PlaybackDroppedFramesExceeded: "02-08"; readonly PlaybackPlayheadExceedsDuration: "02-09"; readonly PlaybackUnsupportedDevice: "02-10"; readonly PlaybackManifestLoadError: "02-11"; readonly PlaybackManifestLoadTimeout: "02-12"; readonly PlaybackManifestParsingError: "02-13"; readonly PlaybackManifestIncompatibleCodecs: "02-14"; readonly PlaybackLevelEmptyError: "02-15"; readonly PlaybackLevelLoadError: "02-16"; readonly PlaybackLevelLoadTimeout: "02-17"; readonly PlaybackLevelSwitchError: "02-18"; readonly PlaybackAudioTrackLoadError: "02-19"; readonly PlaybackAudioTrackLoadTimeout: "02-20"; readonly PlaybackFragLoadError: "02-21"; readonly PlaybackFragLoadTimeout: "02-22"; readonly PlaybackFragDecryptError: "02-23"; readonly PlaybackFragParsingError: "02-24"; readonly PlaybackFragGap: "02-25"; readonly PlaybackRemuxAllocError: "02-26"; readonly PlaybackBufferAddCodecError: "02-27"; readonly PlaybackBufferIncompatibleCodecs: "02-28"; readonly PlaybackBufferAppendError: "02-29"; readonly PlaybackBufferStalledError: "02-30"; readonly PlaybackBufferFullError: "02-31"; readonly PlaybackBufferSeekOverHole: "02-32"; readonly PlaybackBufferNudgeOnStall: "02-33"; readonly PlaybackInternalException: "02-34"; readonly PlaybackInternalAborted: "02-35"; readonly PlaybackManifestLoaderFailure: "02-36"; readonly PlaybackSegmentBaseLoaderError: "02-37"; readonly PlaybackTimeSyncFailed: "02-38"; readonly PlaybackFragmentLoaderFailure: "02-39"; readonly PlaybackAppendError: "02-40"; readonly PlaybackRemoveError: "02-41"; readonly PlaybackDataUpdateFailed: "02-42"; readonly PlaybackManifestNoStreams: "02-43"; readonly PlaybackUnknownManifestType: "02-44"; readonly PlaybackDashInsufficientSegmentInfo: "02-45"; readonly PlaybackDashNoRepresentations: "02-46"; readonly PlaybackDashNoAdaptationSets: "02-47"; readonly PlaybackDashNoInitSegment: "02-48"; readonly PlaybackDashUnsupportedContainerFormat: "02-49"; readonly PlaybackDashKeySystemMismatch: "02-50"; readonly PlaybackMultipleKeyIDs: "02-51"; readonly PlaybackDashConflictingKeyIDs: "02-52"; readonly PlaybackRestrictedStreams: "02-53"; readonly PlaybackHlsMasterAndMediaTags: "02-54"; readonly PlaybackRepresentationIdConflict: "02-55"; readonly PlaybackHlsUnsupportedKeyFormats: "02-56"; readonly PlaybackManifestNoVariants: "02-57"; readonly PlaybackHlsUndeclaredVariables: "02-58"; readonly PlaybackAes128InvalidKeyLength: "02-59"; readonly PlaybackDashConflictingAes128Keys: "02-60"; readonly PlaybackDashUnsupportedAes128Encryption: "02-61"; readonly PlaybackManifestPatchMismatch: "02-62"; readonly PlaybackEmptyMediaPlaylist: "02-63"; readonly PlaybackNonContiguousCompositionTrack: "02-64"; readonly PlaybackDecoderNotFound: "02-65"; readonly PlaybackDecoderTemporarilyUnavailable: "02-66"; readonly PlaybackIncompatibleAsset: "02-67"; readonly PlaybackNoCompatibleExternalDisplay: "02-69"; readonly PlaybackOutOfMemory: "02-70"; readonly PlaybackToneMappingFailed: "02-71"; readonly PlaybackVideoCompositorFailed: "02-72"; /** Network Section */ readonly NetworkUnknown: "03-00"; readonly NetworkNoInternet: "03-01"; readonly NetworkRequestTimeout: "03-02"; readonly NetworkUnableToResolveHost: "03-03"; readonly NetworkResourceNotFound: "03-04"; readonly NetworkExpiredUrl: "03-05"; readonly NetworkUrlResolutionFailed: "03-06"; readonly NetworkDownloadErrorIdManifest: "03-07"; readonly NetworkDownloadErrorIdSidx: "03-08"; readonly NetworkDownloadErrorIdContent: "03-09"; readonly NetworkDownloadErrorIdInitialization: "03-10"; readonly NetworkDownloadErrorIdXlink: "03-11"; readonly NetworkHttpRequestFailed: "03-12"; readonly NetworkMaxRetriesExceeded: "03-13"; readonly NetworkSegmentMissing: "03-14"; /** HTTP Error Codes */ readonly NetworkHttp400BadRequest: "03-400"; readonly NetworkHttp401Unauthorized: "03-401"; readonly NetworkHttp402PaymentRequired: "03-402"; readonly NetworkHttp403Forbidden: "03-403"; readonly NetworkHttp404NotFound: "03-404"; readonly NetworkHttp405MethodNotAllowed: "03-405"; readonly NetworkHttp406NotAcceptable: "03-406"; readonly NetworkHttp407ProxyAuthenticationRequired: "03-407"; readonly NetworkHttp408RequestTimeout: "03-408"; readonly NetworkHttp409Conflict: "03-409"; readonly NetworkHttp410Gone: "03-410"; readonly NetworkHttp411LengthRequired: "03-411"; readonly NetworkHttp412PreconditionFailed: "03-412"; readonly NetworkHttp413PayloadTooLarge: "03-413"; readonly NetworkHttp414URITooLong: "03-414"; readonly NetworkHttp415UnsupportedMediaType: "03-415"; readonly NetworkHttp416RangeNotSatisfiable: "03-416"; readonly NetworkHttp417ExpectationFailed: "03-417"; readonly NetworkHttp418ImATeapot: "03-418"; readonly NetworkHttp421MisdirectedRequest: "03-421"; readonly NetworkHttp422UnprocessableEntity: "03-422"; readonly NetworkHttp423Locked: "03-423"; readonly NetworkHttp424FailedDependency: "03-424"; readonly NetworkHttp425TooEarly: "03-425"; readonly NetworkHttp426UpgradeRequired: "03-426"; readonly NetworkHttp428PreconditionRequired: "03-428"; readonly NetworkHttp429TooManyRequests: "03-429"; readonly NetworkHttp431RequestHeaderFieldsTooLarge: "03-431"; readonly NetworkHttp451UnavailableForLegalReasons: "03-451"; readonly NetworkHttp500InternalServerError: "03-500"; readonly NetworkHttp501NotImplemented: "03-501"; readonly NetworkHttp502BadGateway: "03-502"; readonly NetworkHttp503ServiceUnavailable: "03-503"; readonly NetworkHttp504GatewayTimeout: "03-504"; readonly NetworkHttp505HTTPVersionNotSupported: "03-505"; readonly NetworkHttp506VariantAlsoNegotiates: "03-506"; readonly NetworkHttp507InsufficientStorage: "03-507"; readonly NetworkHttp508LoopDetected: "03-508"; readonly NetworkHttp510NotExtended: "03-510"; readonly NetworkHttp511NetworkAuthenticationRequired: "03-511"; /** Content Protection Section */ readonly ContentProtectionUnknown: "04-00"; readonly ContentProtectionConcurrentStreamLimitExceeded: "04-01"; readonly ContentProtectionEntitlementRefused: "04-02"; readonly ContentProtectionLicenseExpired: "04-03"; readonly ContentProtectionBadLicenseRequest: "04-04"; readonly ContentProtectionLicenseServerTimeout: "04-05"; readonly ContentProtectionInsufficientHDCPSupport: "04-06"; readonly ContentProtectionGeoRestricted: "04-07"; readonly ContentProtectionParentalControlRestricted: "04-08"; readonly ContentProtectionCDNUnauthorized: "04-09"; readonly ContentProtectionInvalidAccessToken: "04-10"; readonly ContentProtectionKeySystemNoKeys: "04-11"; readonly ContentProtectionKeySystemNoAccess: "04-12"; readonly ContentProtectionKeySystemNoSession: "04-13"; readonly ContentProtectionKeySystemNoConfiguredLicense: "04-14"; readonly ContentProtectionKeySystemCertificateRequestFailed: "04-15"; readonly ContentProtectionKeySystemCertificateUpdateFailed: "04-16"; /** Key System: Session update failed */ readonly ContentProtectionKeySystemSessionUpdateFailed: "04-17"; /** Key System: Status output restricted */ readonly ContentProtectionKeySystemStatusOutputRestricted: "04-18"; /** Key System: Status internal error */ readonly ContentProtectionKeySystemStatusInternalError: "04-19"; /** Key Load Error */ readonly ContentProtectionKeyLoadError: "04-20"; /** Key Load Timeout */ readonly ContentProtectionKeyLoadTimeout: "04-21"; /** Capability MediaKeys Error */ readonly ContentProtectionCapabilityMediaKeysError: "04-22"; /** Manifest indicated protected content, but unable to determine key systems */ readonly ContentProtectionManifestKeySystemUnknown: "04-23"; /** * None of the requested key system configurations are available. * Possible reasons: * - Key system not supported * - Requested features (e.g., persistent state) not supported * - User denied access in prompt * - Key system unavailable in insecure contexts (requires HTTPS) */ readonly ContentProtectionKeySystemUnavailable: "04-24"; /** Browser found requested key system, but failed to create CDM instance */ readonly ContentProtectionCDMCreationFailed: "04-25"; /** Browser created CDM instance but failed to attach it to the video */ readonly ContentProtectionCDMAttachFailed: "04-26"; /** CDM rejected the server certificate (malformed or unsupported format) */ readonly ContentProtectionCDMServerCertificateRejected: "04-27"; /** CDM refused to create a session for unknown reasons */ readonly ContentProtectionCDMSessionCreationFailed: "04-28"; /** CDM unable to generate a license request due to malformed or unsupported init data */ readonly ContentProtectionCDMLicenseRequestFailed: "04-29"; /** License response rejected by the CDM (invalid/malformed response) */ readonly ContentProtectionCDMLicenseResponseRejected: "04-30"; /** Manifest does not specify DRM info, but content is encrypted */ readonly ContentProtectionManifestMissingDRMInfo: "04-31"; /** No license server was provided for the key system signaled by the manifest */ readonly ContentProtectionLicenseServerMissing: "04-32"; /** A required offline session was removed, affecting playback */ readonly ContentProtectionOfflineSessionRemoved: "04-33"; /** Error while executing init data transformation */ readonly ContentProtectionInitDataTransformationError: "04-34"; /** Server certificate request failed */ readonly ContentProtectionServerCertificateRequestFailed: "04-35"; /** HDCP version does not meet the requirements */ readonly ContentProtectionInsufficientHDCPVersion: "04-36"; /** Error when checking HDCP version */ readonly ContentProtectionHDCPVersionCheckFailed: "04-37"; /** Ads Section */ readonly AdsUnknown: "08-00"; readonly AdsVastParseError: "08-100"; readonly AdsInvalidVastSchema: "08-101"; readonly AdsVastVersionNotSupported: "08-102"; readonly AdsUnexpectedAdType: "08-200"; readonly AdsCreativeLinearityMismatch: "08-201"; readonly AdsCreativeDurationMismatch: "08-202"; readonly AdsCreativeSizeMismatch: "08-203"; readonly AdsWrapperVastError: "08-300"; readonly AdsVastResponseRedirectTimeout: "08-301"; readonly AdsWrapperLimitReached: "08-302"; readonly AdsVastResponseEmpty: "08-303"; readonly AdsLinearAdDisplayError: "08-400"; readonly AdsMediaFileNotFound: "08-401"; readonly AdsMediaFileUnavailable: "08-402"; readonly AdsUnsupportedMimeType: "08-403"; readonly AdsUnableToDisplayMediaFile: "08-405"; readonly AdsMezzanineFileMissing: "08-406"; readonly AdsMezzanineFileDownloaded: "08-407"; readonly AdsRejectedAd: "08-408"; readonly AdsInteractiveCreativeError: "08-409"; readonly AdsVerificationNodeExecutionError: "08-410"; readonly AdsNonLinearAdDisplayError: "08-500"; readonly AdsNonLinearAdSizeMismatch: "08-501"; readonly AdsNonLinearAdFetchError: "08-502"; readonly AdsNonLinearUnsupportedType: "08-503"; readonly AdsCompanionAdDisplayError: "08-600"; readonly AdsCompanionAdSizeMismatch: "08-601"; readonly AdsRequiredCompanionAdError: "08-602"; readonly AdsCompanionAdFetchError: "08-603"; readonly AdsUndefinedVastError: "08-900"; readonly AdsUnknownVpaidError: "08-901"; readonly AdsVastDocumentEmpty: "08-999"; }; declare type FlowplayerErrorCodeName = keyof typeof FlowplayerErrorCodeMap; declare type FlowplayerErrorConfig = Partial<{ isFatal: boolean; showErrorUI: boolean; isRetry: boolean; resource: string; rootErrorId: string; retryOpts: Partial<{ retry: (typeof RetryMap)[keyof typeof RetryMap]; retryTimeout: number; }>; }> & Record<string, any>; declare type FlowplayerErrorEventDetail = { error: FlowplayerError; }; /** * @public */ declare type FlowplayerStates = typeof states; /** * @public */ declare interface FlowplayerUMD extends FlowplayerUMDBase { /** * Configure flowplayer and display it in the UI * @param selector - query selector of the HTML element where player will render * @param config - configuration of flowplayer */ (selector: string, config?: Config): Player; /** * Configure flowplayer and display it in the UI * @param element - HTML element where player will render * @param config - configuration of flowplayer */ (element: HTMLElement, config?: Config): Player; /** * Configure flowplayer and display it in the UI * @param selector - query selector of the HTML element where player will render * @param config - configuration of flowplayer */ <T>(selector: string, config?: ConfigWith<T>): Player; /** * Configure flowplayer and display it in the UI * @param element - HTML element where player will render * @param config - configuration of flowplayer */ <T>(element: HTMLElement, config?: ConfigWith<T>): Player; /** * Register plugins in flowplayer * @returns flowplayer instance with registered plugins */ <PluginCtors extends PluginCtor[]>(...plugins: PluginCtors): FlowplayerUMDWithPlugins<MergeConfigs<PluginCtors>, PlayerWith<MergePlayerExtensions<PluginCtors>>>; } declare interface FlowplayerUMDBase { /** * All player instances on the page */ instances: Player[]; /** * Flowplayer core events */ events: typeof events_2; /** * Flowplayer ui states map */ states: FlowplayerStates; /** * Flowplayer errors map */ errors: typeof FlowplayerErrorCodeMap; quality: typeof QualityOpts; autoplay: typeof AutoplayOpts; commit: string; version: string; /** * Flowplayer's custom element registry */ customElements: FlowplayerCustomElementRegistry; /* Excluded from this release type: extensions */ /* Excluded from this release type: defaultElements */ /* Excluded from this release type: components */ /* Excluded from this release type: support */ /* Excluded from this release type: jwt */ /* Excluded from this release type: loaders */ /** * @public * Translations dictionaries to be used with `@flowplayer/translations` package * * See [official documentation](https://developer.wowza.com/docs/wowza-flowplayer/player/translations/) */ i18n: typeof I18n; } /** * @public */ declare interface FlowplayerUMDWithPlugins<ConfigWithPlugins extends Config = Config, PluginPlayer extends Player = Player> extends FlowplayerUMDBase { /** * Configure flowplayer, it's attached plugins and display flowplayer it in the UI * @param selector - query selector of the HTML element where player will render * @param config - Configuration of the flowplayer and the attached plugins */ (selector: string, config?: ConfigWithPlugins): PlayerWithOpts<PluginPlayer, ConfigWithPlugins>; /** * Configure flowplayer, it's attached plugins and display flowplayer it in the UI * @param element - HTML element where player will render * @param config - Configuration of the flowplayer and the attached plugins */ (element: HTMLElement, config?: ConfigWithPlugins): PlayerWithOpts<PluginPlayer, ConfigWithPlugins>; } /** * @public */ declare interface FPEvent<T> extends CustomEvent<T> { /** * @deprecated the data attribute has been migrated to details to match the CustomEvent spec more info: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent */ data?: T; } declare const FULLSCREEN = "is-fullscreen"; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ FULLSCREEN_CHANGE = "fullscreenchange"; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ FULLSCREEN_ENTER = "fullscreenenter"; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ FULLSCREEN_EXIT = "fullscreenexit"; declare const GRABBING = "is-grabbing"; declare const HAS_POSTER = "has-poster"; declare type HasGlobalSrcExtensios<PluginSrcs extends unknown[]> = ArrayToIntersection<PickGlobalSrcExtension<PluginSrcs>>; declare type HasSrcExtensions<PluginBareConfigs extends unknown[]> = TupleToUnion<PickSrcExtensions<PluginBareConfigs>> extends never ? false : true; declare const HOVERED = "is-hovered"; declare class I18n implements Plugin_2 { static pluginName: string; static en: { ads: { ad: string; ads: string; advertisement: string; indicator: string; adchoices: string; }; audio: { button_txt: string; menu_title: string; }; cc: { button: string; menu_title: string; options: string; tracks: string; reset: string; colors: { Black: string; Blue: string; Cyan: string; Green: string; Magenta: string; Red: string; White: string; Yellow: string; }; edgeStyle: { None: string; "Drop shadow": string; Raised: string; Depressed: string; Outline: string; }; fontFamily: { "Monospaced Serif": string; "Proportional Serif": string; "Monospaced Sans-Serif": string; "Proportional Sans-Serif": string; Casual: string; Cursive: string; }; properties: { fontFamily: string; fontSize: string; fontColor: string; fontOpacity: string; backgroundColor: string; backgroundOpacity: string; characterEdgeStyle: string; }; }; chromecast: { start: string; stop: string; }; core: { exit_fullscreen: string; fullscreen: string; mute: string; muted: string; pause: string; play: string; seconds: string; timeline_aria_label: string; unmute: string; volume: string; close: string; "skip-next": string; "skip-prev": string; }; ovp: { starting_in: string; }; playlist: { cancel: string; up_next: string; autoplay: string; now_playing: string; turn_off_autoplay: string; playlist: string; }; qsel: { menu_title: string; }; share: { clipboard_failure: string; clipboard_success: string; embed: string; link: string; menu_title: string; }; speed: { menu_title: string; }; vtsel: { button_txt: string; menu_title: string; }; }; init(config: Config, _root: never, video: Player): void; /* Excluded from this release type: _nonLanguageFields */ /* Excluded from this release type: languagesLoaded */ } declare const IN_VIEWPORT = "is-in-viewport"; /** * Represents the statistics object for an input audio stream. */ declare interface InputAudio extends StatsBase, StatsCodec { /** The value of the MediaStreamTrack's id attribute. */ trackIdentifier: string; /** Packet Jitter measured in seconds for this SSRC. */ jitter?: number; /** * The purpose of the jitter buffer is to recombine RTP packets into frames (in the case of video) and have smooth playout. * The model described here assumes that the samples or frames are still compressed and have not yet been decoded. * It is the sum of the time, in seconds, each audio sample or a video frame takes from the time the first packet * is received by the jitter buffer (ingest timestamp) to the time it exits the jitter buffer (emit timestamp). */ jitterBufferDelay?: number; /** The total number of audio samples or video frames that have come out of the jitter buffer (increasing {@link jitterBufferDelay}). */ jitterBufferEmittedCount?: number; /** Total number of bytes received for this SSRC. */ totalBytesReceived?: number; /** Total number of packets received for this SSRC. */ totalPacketsReceived?: number; /** * Total number of RTP packets lost for this SSRC. * Note that because of how this is estimated, it can be negative if more packets are received than sent. */ totalPacketsLost?: number; /** The ratio of packet loss. */ packetLossRatio?: number; /** Number of packets lost since last collection. */ packetLossDelta?: number; } /** * Represents the statistics object for an input video stream. */ declare interface InputVideo extends InputAudio { /** * Represents the total number of key frames, such as key frames in VP8 [RFC6386] * or IDR-frames in H.264 [RFC6184], successfully decoded for this RTP media stream. */ keyFramesDecoded?: number; /** Represents the width of the last decoded frame. */ frameWidth?: number; /** Represents the height of the last decoded frame. */ frameHeight?: number; /** Represents the total number of frames correctly decoded for this RTP stream, i.e., frames that would be displayed if no frames are dropped. */ framesDecoded?: number; /** The total number of frames dropped prior to decode or dropped because the frame missed its display deadline for this receiver's track. */ framesDropped?: number; /** The number of decoded frames in the last second. */ framesPerSecond?: number; /** Represents the total number of complete frames received on this RTP stream. This metric is incremented when the complete frame is received. */ framesReceived?: number; } /* Excluded from this release type: INTERSECTIONCHANGE */ /* Excluded from this release type: IntersectionChangeEventDetail */ declare const IS_SOURCE_PROCESSING = "is-source-processing"; declare type JSONPlayer = any; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ KEYDOWN = "keydown"; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ KEYUP = "keyup"; /** * @public */ declare type KeyValue = Record<string, any>; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ LANDSCAPE = "landscape"; /** * @public * when src is a livestream */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public * when src is a livestream */ LIVE = "live"; declare const LIVE_2 = "is-live"; declare const LIVE_SEEKED = "is-live-seeked"; /** * @public */ declare type LiveEventDetail = null; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ LOAD = "load"; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ LOAD_START = "loadstart"; declare const LOADED = "is-loaded"; /** * @public A plugin that supports loading new media formats. Use 'class MyPlugin implements Loader\<...\>' when writing your custom Loader * @typeParam PluginPlayer- Player API that will be implemented by the loader. Loader at least must implement on(\<loader-name\>:attached, ...) event handler */ declare interface Loader<PluginOwnConfig extends KeyValue, // FIXME extends Config PluginPlayer extends PlayerWith<_AttachedEventCheck>> extends Plugin_2<PluginOwnConfig, PluginPlayer> { onload: EnsureOnAttached<(config: ConfigWith<PluginOwnConfig>, root: PlayerRoot, video: PlayerWith<PluginPlayer>, src: SourceObj) => void, PluginPlayer>; wants<S = SourceObj>(srcString: SourceStr, srcObj: S, config: ConfigWith<PluginOwnConfig>): boolean; wants<S = KeyValue>(srcString: SourceStr, srcObj: SourceWith<S>, config: ConfigWith<PluginOwnConfig>): boolean; } declare const LOADING = "is-loading"; declare interface Logger { (...args: any[]): void; log(...args: any[]): void; } declare type MapToBareConfigs<Plugins extends PluginCtor[]> = { [PluginType in keyof Plugins]: ExtractBareConfig<Plugins[PluginType]>; }; declare type MapToPlayerExtensions<Plugins extends PluginCtor[]> = { [PluginIndex in keyof Plugins]: ExtractPluginPlayerExtension<Plugins[PluginIndex]>; }; declare const MENU_OPENED = "has-menu-opened"; /** * Combines plugin config and returns a type derived from Config */ declare type MergeConfigs<Plugins extends PluginCtor[]> = MergePluginConfigs<MapToBareConfigs<Plugins>>; declare type MergePlayerExtensions<Plugins extends PluginCtor[]> = ArrayToIntersection<MapToPlayerExtensions<Plugins>>; declare type MergePluginConfigs<PluginBareConfigs extends unknown[]> = HasSrcExtensions<PluginBareConfigs> extends true ? ConfigWithSourceExtensions<PluginBareConfigs> : ConfigWith<ArrayToIntersection<PluginBareConfigs>>; /** * @public * general video events flowplayer uses internally * https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public * general video events flowplayer uses internally * https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events */ METADATA = "loadedmetadata"; /** * @public */ export declare type MillicastSrc = { /** * Stream name. use the Stream Name that you entered when you created the real-time stream in Wowza Video, either through * the {@link https://developer.wowza.com/docs/wowza-video/guides/video-source/encoder-camera/deliver-real-time-streams/ |REST API} or * in the {@link https://www.wowza.com/docs/deliver-real-time-streams-to-viewers-with-wowza-video| UI}. */ streamName: string; /* Excluded from this release type: streamAccountId */ /** * Subscriber token. If you set a Playback Token by enabling stream security in the RTS Wowza Video configuration, you would add it as the subscriberToken. */ subscriberToken?: string; /* Excluded from this release type: __TEST_STREAM_ACCOUNT_ID__ */ type: "wowza/rts"; }; /** @public * when a new player is inserted into the HTML */ declare const /** @public * when a new player is inserted into the HTML */ /** @public * when a new player is inserted into the HTML */ MOUNT = "mount"; /** * @public */ declare type MountEventDetail = null; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ MOUSE_DOWN = "mousedown"; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ MOUSE_ENTER = "mouseenter"; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ MOUSE_LEAVE = "mouseleave"; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ MOUSE_MOVE = "mousemove"; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ MOUSE_UP = "mouseup"; declare const MUTED = "is-muted"; declare const NO_CONTROLS = "no-controls"; declare const NO_DVR = "no-timeline"; /* Excluded from this release type: NON_RECOVERABLE_ERROR */ /* Excluded from this release type: NonRecoverableErrorEventDetail */ /* Excluded from this release type: NQState */ /** * @public */ export declare type OnStats = OnStats_2; /** * Represents the parsed WebRTC statistics collected. */ declare interface OnStats_2 { /** Gets the time at which the statistics were collected as a string value in ISO format. */ timestamp: string; /** List of audio & video output statistics. */ output: AudioVideoCollect<OutputAudio, OutputVideo>; /** List of audio & video input statistics. */ input: AudioVideoCollect<InputAudio, InputVideo>; /** Raw statistics, if {@link WebRTCStatsOptions.includeRawStats | includeRawStats} is set to `true` in the collection options. */ rawStats?: RTCStatsReport; /** * Represents the sum of all round trip time measurements in seconds since the beginning of the session, * based on STUN connectivity check [STUN-PATH-CHAR] responses (responsesReceived), * including those that reply to requests that are sent in order to verify consent [RFC7675]. * The average round trip time can be computed from {@link totalRoundTripTime} by dividing it by {@link responsesReceived}. */ totalRoundTripTime?: number; /** Represents the total number of connectivity check responses received. */ responsesReceived?: number; /** * Represents the latest round trip time measured in seconds, computed from both STUN connectivity checks [STUN-PATH-CHAR], * including those that are sent for consent verification [RFC7675]. */ currentRoundTripTime?: number; /** * It is calculated by the underlying congestion control by combining the available * bitrate for all the outgoing RTP streams using this candidate pair. * The bitrate measurement does not count the size of the IP or other transport layers like TCP or UDP. * It is similar to the TIAS defined in [RFC3890], i.e., * it is measured in bits per second and the bitrate is calculated over a 1 second window. */ availableOutgoingBitrate?: number; /** * It is calculated by the underlying congestion control by combining the available * bitrate for all the incoming RTP streams using this candidate pair. * The bitrate measurement does not count the size of the IP or other transport layers like TCP or UDP. * It is similar to the TIAS defined in [RFC3890], i.e., * it is measured in bits per second and the bitrate is calculated over a 1 second window. */ availableIncomingBitrate?: number; } /** * Represents the statistics object for an output audio stream. */ declare interface OutputAudio extends OutputBase { } /** * Represents the base statistics object for an output stream. */ declare interface OutputBase extends StatsBase, StatsCodec { /** Total number of bytes sent for this SSRC. */ totalBytesSent?: number; /** Number of bytes sent for this SSRC since last collection. */ bytesSentDelta?: number; /** Total number of packets sent for this SSRC. */ totalPacketsSent?: number; /** Number of packets sent for this SSRC since last collection. */ packetsSentDelta?: number; /** * Reflects the current encoder target in bits per second. * The target is an instantaneous value reflecting the encoder's settings, * but the resulting payload bytes sent per second, excluding retransmissions, * should closely correlate to the target. */ targetBitrate?: number; /** The total number of packets that were retransmitted for this SSRC. */ retransmittedPacketsSent?: number; /** Number of packets that were retransmitted for this SSRC since last collection. */ retransmittedPacketsSentDelta?: number; /** * The total number of bytes that were retransmitted for this SSRC, * only including payload bytes. */ retransmittedBytesSent?: number; /** * Number of bytes that were retransmitted for this SSRC, * only including payload bytes since last collection. */ retransmittedBytesSentDelta?: number; } /** * Represents the statistics object for an output video stream. */ declare interface OutputVideo extends OutputBase { /** Represents the width of the last encoded frame. */ frameWidth?: number; /** Represents the height of the last encoded frame. */ frameHeight?: number; /** The number of encoded frames during the last second. */ framesPerSecond?: number; /** Represents the total number of frames sent on this RTP stream. */ framesSent?: number; /** The current reason for limiting the resolution and/or framerate, or "none" if not limited. */ qualityLimitationReason: QualityLimitationReason; /** A record of the total time, in seconds, that this stream has spent in each quality limitation state. */ qualityLimitationDurations?: Record<string, number>; } /** * @public */ declare type OVPMetadata = { player_id?: string; media_id?: string; ad_keywords?: string; title?: string; description?: string; category_name?: string; duration?: number; tags?: string; }; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ PAUSE = "pause"; declare const PAUSED = "is-paused"; declare type PickGlobalSrcExtension<PluginSrcs extends unknown[]> = { [Index in keyof PluginSrcs]: PluginSrcs[Index] extends { type: string; } ? unknown : PluginSrcs[Index]; }; /** * Maps incoming array to the src extension type * @example * ``` * PickSrcExtensions<[ * {configProp: boolean, src: UnsafeSource<{srcProp: boolean}>}, * {} * ]> // = [{srcProp: boolean}, never] * ``` */ declare type PickSrcExtensions<PluginBareConfigs extends unknown[]> = { [PluginType in keyof PluginBareConfigs]: ExtractSrcExtension<PluginBareConfigs[PluginType]>; }; /** * @public */ declare const /** @public * when a new player is inserted into the HTML */ /** * @public */ PLAY = "play"; /** * @public */ declare type Player = HTMLVideoElement & PlayerEventOverloads & { /* Excluded from this release type: renderPlugin */ /** * Disables and enables the player. * @param flag -Forces disabled mode (true) or enabled mode (false). Disabled player cannot be seeked forward. */ toggleDisable: (flag?: boolean) => void; /* Excluded from this release type: original_src */ /** * The root element of the video player. This is the immediate parent element of the video tag. */ root: PlayerRoot; /* Excluded from this release type: playerState */ /* Excluded from this release type: reaper */ /* Excluded from this release type: hasState */ /* Excluded from this release type: transitionState */ /** * Toggles between playing and paused mode. * @param on - Forces the playback (true) or paused state (false). Use this for initial playback of a source configured with setSrc() and when changing the state. */ togglePlay(on?: boolean): Promise<void>; /* Excluded from this release type: toggleFullScreen */ /** * @public * Toggles between normal and fullscreen mode. The optional flag attribute forces the normal sized (false) or fullscreen (false) mode. * The custom fullscreenenter and fullscreenexit events are sent respectively. */ toggleFullScreen(on?: boolean): void; /* Excluded from this release type: toggleMute */ /** * Toggles between muted and original volume level. */ toggleMute(): void; /** * Removes a Flowplayer instance from `flowplayer.instances` and emits the `flowplayer.events.REAP` event, enabling cleanup of unsafe resources. */ destroy(): void; /* Excluded from this release type: render */ /* Excluded from this release type: render */ createComponents(...args: string[]): HTMLElement[]; /** * Adds or changes configuration object. Usually used in conjunction with `setSrc()`. You can use all top-level config options like `subtitle:` , `logo:`, `ima:` etc. * @example * ``` * setOpts({ * subtitles:{ * tracks:[ * { * src: "1.vtt", * label: "English", * default: true * }, { * src: "2.vtt", * label: "Spanish", * default : false }]}, * logo: "https://myserver.com/logo.png" * }) * ``` */ setOpts(config: Config): void; /** * Sets the video source to be played. The src attribute can be a string or an object similar to the src property. */ setSrc(sources: UnsafeSource): void; /* Excluded from this release type: setSrc */ /* Excluded from this release type: setAttrs */ /* Excluded from this release type: opt */ /* Excluded from this release type: enqueueSeek */ /* Excluded from this release type: setState */ setState(state: PlayerState, flag: boolean):