UNPKG

@7sage/vidstack

Version:

UI component library for building high-quality, accessible video and audio experiences on the web.

1,527 lines (1,511 loc) 271 kB
import { DOMEvent, EventsTarget, ViewController, SetRequired, MaybeStopEffect, InferEventDetail, WriteSignal, ReadSignalRecord, Context, Scope, Dispose, Store, State, Writable, Component, ReadSignal } from './vidstack-BNOTL9fc.js'; import * as media_captions from 'media-captions'; import { VTTCue as VTTCue$1, VTTRegion, CaptionsFileFormat, CaptionsParserFactory, VTTHeaderMetadata } from 'media-captions'; import * as DASH from 'dashjs'; import DASH__default from 'dashjs'; import * as HLS from 'hls.js'; type LogLevel = 'silent' | 'error' | 'warn' | 'info' | 'debug'; declare const GROUPED_LOG: unique symbol; declare class GroupedLog { readonly logger: Logger; readonly level: LogLevel; readonly title: string; readonly root?: GroupedLog | undefined; readonly parent?: GroupedLog | undefined; readonly [GROUPED_LOG] = true; readonly logs: ({ label?: string; data: any[]; } | GroupedLog)[]; constructor(logger: Logger, level: LogLevel, title: string, root?: GroupedLog | undefined, parent?: GroupedLog | undefined); log(...data: any[]): GroupedLog; labelledLog(label: string, ...data: any[]): GroupedLog; groupStart(title: string): GroupedLog; groupEnd(): GroupedLog; dispatch(): boolean; } declare class Logger { #private; error(...data: any[]): boolean; warn(...data: any[]): boolean; info(...data: any[]): boolean; debug(...data: any[]): boolean; errorGroup(title: string): GroupedLog; warnGroup(title: string): GroupedLog; infoGroup(title: string): GroupedLog; debugGroup(title: string): GroupedLog; setTarget(newTarget: EventTarget | null): void; dispatch(level: LogLevel, ...data: any[]): boolean; } declare const ADD: unique symbol; declare const REMOVE: unique symbol; declare const RESET: unique symbol; declare const SELECT: unique symbol; declare const READONLY: unique symbol; declare const SET_READONLY: unique symbol; declare const ON_RESET: unique symbol; declare const ON_REMOVE: unique symbol; declare const ON_USER_SELECT: unique symbol; /** @internal */ declare const ListSymbol: { readonly add: typeof ADD; readonly remove: typeof REMOVE; readonly reset: typeof RESET; readonly select: typeof SELECT; readonly readonly: typeof READONLY; readonly setReadonly: typeof SET_READONLY; readonly onReset: typeof ON_RESET; readonly onRemove: typeof ON_REMOVE; readonly onUserSelect: typeof ON_USER_SELECT; }; interface ListItem { id: string; } declare class List<Item extends ListItem, Events extends ListEvents> extends EventsTarget<Events> implements Iterable<Item> { [index: number]: Item | undefined; protected items: Item[]; /** @internal */ protected [ListSymbol.readonly]: boolean; /** @internal */ protected [ListSymbol.onReset]?(trigger?: Event): void; /** @internal */ protected [ListSymbol.onRemove]?(item: Item, trigger?: Event): void; get length(): number; get readonly(): boolean; /** * Returns the index of the first occurrence of the given item, or -1 if it is not present. */ indexOf(item: Item): number; /** * Returns an item matching the given `id`, or `null` if not present. */ getById(id: string): Item | null; /** * Transform list to an array. */ toArray(): Item[]; [Symbol.iterator](): ArrayIterator<Item>; /** @internal */ [ListSymbol.add](item: Item, trigger?: Event): void; /** @internal */ [ListSymbol.remove](item: Item, trigger?: Event): void; /** @internal */ [ListSymbol.reset](trigger?: Event): void; /** @internal */ [ListSymbol.setReadonly](readonly: boolean, trigger?: Event): void; } interface ListEvents<Item extends ListItem = ListItem> { add: ListAddEvent<Item>; remove: ListRemoveEvent<Item>; 'readonly-change': ListReadonlyChangeEvent; } /** * Fired when an item has been added to the list. * * @detail item */ interface ListAddEvent<Item extends ListItem> extends DOMEvent<Item> { } /** * Fired when an item has been removed from the list. * * @detail item */ interface ListRemoveEvent<Item extends ListItem> extends DOMEvent<Item> { } /** * Fired when the readonly state of the list has changed. * * @detail isReadonly */ interface ListReadonlyChangeEvent extends DOMEvent<boolean> { } interface FullscreenEvents { 'fullscreen-change': FullscreenChangeEvent; 'fullscreen-error': FullscreenErrorEvent; } /** * Fired when an element enters/exits fullscreen. The event detail is a `boolean` indicating * if fullscreen was entered (`true`) or exited (`false`). * * @bubbles * @composed * @detail isFullscreen */ interface FullscreenChangeEvent extends DOMEvent<boolean> { } /** * Fired when an error occurs either entering or exiting fullscreen. This will generally occur * if the user has not interacted with the page yet. * * @bubbles * @composed * @detail error */ interface FullscreenErrorEvent extends DOMEvent<unknown> { } declare class FullscreenController extends ViewController<{}, {}, FullscreenEvents> implements FullscreenAdapter { #private; get active(): boolean; get supported(): boolean; protected onConnect(): void; enter(): Promise<void>; exit(): Promise<void>; } declare function canFullscreen(): boolean; interface FullscreenAdapter { /** * Whether the host element is in fullscreen mode. */ readonly active: boolean; /** * Whether the native browser fullscreen API is available, or the current provider can * toggle fullscreen mode. This does not mean that the operation is guaranteed to be successful, * only that it can be attempted. * * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API} */ readonly supported: boolean; /** * Request to display the current host element in fullscreen. * * @throws Error - if fullscreen API is not available. * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullscreen} */ enter(): Promise<void>; /** * Attempt to exit fullscreen on the current host element. * * @throws Error - if fullscreen API is not available. * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/exitFullscreen} */ exit(): Promise<void>; } declare global { interface HTMLElementEventMap extends LoggerEvents { } } interface LoggerEvents { 'vds-log': LogEvent; } interface LogEventDetail { /** * The log level. */ level: LogLevel; /** * Data to be logged. */ data?: any[]; } /** * @bubbles * @composed * @detail log */ interface LogEvent extends DOMEvent<LogEventDetail> { } type ScreenOrientationType = /** * Landscape-primary is an orientation where the screen width is greater than the screen height. * If the device's natural orientation is landscape, then it is in landscape-primary when held * in that position. If the device's natural orientation is portrait, the user agent sets * landscape-primary from the two options as shown in the screen orientation values table. */ 'landscape-primary' /** * Landscape-secondary is an orientation where the screen width is greater than the screen * height. If the device's natural orientation is landscape, it is in landscape-secondary when * rotated 180º from its natural orientation. If the device's natural orientation is portrait, * the user agent sets landscape-secondary from the two options as shown in the screen * orientation values table. */ | 'landscape-secondary' /** * Portrait-primary is an orientation where the screen width is less than or equal to the screen * height. If the device's natural orientation is portrait, then it is in portrait-primary when * held in that position. If the device's natural orientation is landscape, the user agent sets * portrait-primary from the two options as shown in the screen orientation values table. */ | 'portrait-primary' /** * Portrait-secondary is an orientation where the screen width is less than or equal to the * screen height. If the device's natural orientation is portrait, then it is in * portrait-secondary when rotated 180º from its natural position. If the device's natural * orientation is landscape, the user agent sets portrait-secondary from the two options as * shown in the screen orientation values table. */ | 'portrait-secondary'; type ScreenOrientationLockType = /** * Any is an orientation that means the screen can be locked to any one of portrait-primary, * portrait-secondary, landscape-primary and landscape-secondary. */ 'any' /** * Landscape is an orientation where the screen width is greater than the screen height and * depending on platform convention locking the screen to landscape can represent * landscape-primary, landscape-secondary or both. */ | 'landscape' /** * Landscape-primary is an orientation where the screen width is greater than the screen height. * If the device's natural orientation is landscape, then it is in landscape-primary when held * in that position. If the device's natural orientation is portrait, the user agent sets * landscape-primary from the two options as shown in the screen orientation values table. */ | 'landscape-primary' /** * Landscape-secondary is an orientation where the screen width is greater than the screen * height. If the device's natural orientation is landscape, it is in landscape-secondary when * rotated 180º from its natural orientation. If the device's natural orientation is portrait, * the user agent sets landscape-secondary from the two options as shown in the screen * orientation values table. */ | 'landscape-secondary' /** * Natural is an orientation that refers to either portrait-primary or landscape-primary * depending on the device's usual orientation. This orientation is usually provided by the * underlying operating system. */ | 'natural' /** * Portrait is an orientation where the screen width is less than or equal to the screen height * and depending on platform convention locking the screen to portrait can represent * portrait-primary, portrait-secondary or both. */ | 'portrait' /** * Portrait-primary is an orientation where the screen width is less than or equal to the screen * height. If the device's natural orientation is portrait, then it is in portrait-primary when * held in that position. If the device's natural orientation is landscape, the user agent sets * portrait-primary from the two options as shown in the screen orientation values table. */ | 'portrait-primary' /** * Portrait-secondary is an orientation where the screen width is less than or equal to the * screen height. If the device's natural orientation is portrait, then it is in * portrait-secondary when rotated 180º from its natural position. If the device's natural * orientation is landscape, the user agent sets portrait-secondary from the two options as * shown in the screen orientation values table. */ | 'portrait-secondary'; interface ScreenOrientationEvents { 'orientation-change': ScreenOrientationChangeEvent; } interface ScreenOrientationChangeEventDetail { orientation: ScreenOrientationType; lock?: ScreenOrientationLockType; } /** * Fired when the current screen orientation changes. * * @detail orientation */ interface ScreenOrientationChangeEvent extends DOMEvent<ScreenOrientationChangeEventDetail> { } declare class ScreenOrientationController extends ViewController<{}, {}, ScreenOrientationEvents> { #private; /** * The current screen orientation type. * * @signal * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation} * @see https://w3c.github.io/screen-orientation/#screen-orientation-types-and-locks */ get type(): ScreenOrientationType | undefined; /** * Whether the screen orientation is currently locked. * * @signal * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation} * @see https://w3c.github.io/screen-orientation/#screen-orientation-types-and-locks */ get locked(): boolean; /** * Whether the viewport is in a portrait orientation. * * @signal */ get portrait(): boolean; /** * Whether the viewport is in a landscape orientation. * * @signal */ get landscape(): boolean; /** * Whether the native Screen Orientation API is available. */ static readonly supported: boolean; /** * Whether the native Screen Orientation API is available. */ get supported(): boolean; protected onConnect(): void; /** * Locks the orientation of the screen to the desired orientation type using the * Screen Orientation API. * * @param lockType - The screen lock orientation type. * @throws Error - If screen orientation API is unavailable. * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Screen/orientation} * @see {@link https://w3c.github.io/screen-orientation} */ lock(lockType: ScreenOrientationLockType): Promise<void>; /** * Unlocks the orientation of the screen to it's default state using the Screen Orientation * API. This method will throw an error if the API is unavailable. * * @throws Error - If screen orientation API is unavailable. * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Screen/orientation} * @see {@link https://w3c.github.io/screen-orientation} */ unlock(): Promise<void>; } interface MediaRequestEvents { 'media-airplay-request': MediaAirPlayRequestEvent; 'media-audio-track-change-request': MediaAudioTrackChangeRequestEvent; 'media-clip-start-change-request': MediaClipStartChangeRequestEvent; 'media-clip-end-change-request': MediaClipEndChangeRequestEvent; 'media-duration-change-request': MediaDurationChangeRequestEvent; 'media-enter-fullscreen-request': MediaEnterFullscreenRequestEvent; 'media-exit-fullscreen-request': MediaExitFullscreenRequestEvent; 'media-enter-pip-request': MediaEnterPIPRequestEvent; 'media-exit-pip-request': MediaExitPIPRequestEvent; 'media-google-cast-request': MediaGoogleCastRequestEvent; 'media-live-edge-request': MediaLiveEdgeRequestEvent; 'media-loop-request': MediaLoopRequestEvent; 'media-user-loop-change-request': MediaUserLoopChangeRequestEvent; 'media-orientation-lock-request': MediaOrientationLockRequestEvent; 'media-orientation-unlock-request': MediaOrientationUnlockRequestEvent; 'media-mute-request': MediaMuteRequestEvent; 'media-pause-request': MediaPauseRequestEvent; 'media-pause-controls-request': MediaPauseControlsRequestEvent; 'media-play-request': MediaPlayRequestEvent; 'media-quality-change-request': MediaQualityChangeRequestEvent; 'media-rate-change-request': MediaRateChangeRequestEvent; 'media-audio-gain-change-request': MediaAudioGainChangeRequestEvent; 'media-resume-controls-request': MediaResumeControlsRequestEvent; 'media-seek-request': MediaSeekRequestEvent; 'media-seeking-request': MediaSeekingRequestEvent; 'media-start-loading': MediaStartLoadingRequestEvent; 'media-poster-start-loading': MediaPosterStartLoadingRequestEvent; 'media-text-track-change-request': MediaTextTrackChangeRequestEvent; 'media-unmute-request': MediaUnmuteRequestEvent; 'media-volume-change-request': MediaVolumeChangeRequestEvent; } /** * Fired when requesting the AirPlay picker to open. * * @bubbles * @composed */ interface MediaAirPlayRequestEvent extends DOMEvent<void> { } /** * Fired when requesting the media poster to begin loading. This will only take effect if the * `posterLoad` strategy on the player is set to `custom`. * * @bubbles * @composed */ interface MediaPosterStartLoadingRequestEvent extends DOMEvent<void> { } /** * Fired when requesting to change the `mode` on a text track at the given index in the * `TextTrackList` on the player. * * @bubbles * @composed */ interface MediaTextTrackChangeRequestEvent extends DOMEvent<{ index: number; mode: TextTrackMode; }> { } /** * Fired when requesting the media to be muted. * * @bubbles * @composed */ interface MediaMuteRequestEvent extends DOMEvent<void> { } /** * Fired when requesting the media to be unmuted. * * @bubbles * @composed */ interface MediaUnmuteRequestEvent extends DOMEvent<void> { } /** * Whether to request fullscreen on the media (i.e., `<media-player>`). The `prefer-media` option * will first see if the native fullscreen API is available, if not it'll try the media provider. */ type MediaFullscreenRequestTarget = 'prefer-media' | 'media' | 'provider'; /** * Fired when requesting to change the current audio track to the given index in the * `AudioTrackList` on the player. * * @bubbles * @composed */ interface MediaAudioTrackChangeRequestEvent extends DOMEvent<number> { } /** * Fired when requesting to change the clip start time. The event `detail` specifies the new start * time in seconds. * * @bubbles * @composed */ interface MediaClipStartChangeRequestEvent extends DOMEvent<number> { } /** * Fired when requesting to change the clip end time. The event `detail` specifies the new end * time in seconds. * * @bubbles * @composed */ interface MediaClipEndChangeRequestEvent extends DOMEvent<number> { } /** * Fired when requesting to change the length of the media. The event `detail` specifies the * new length in seconds. * * @bubbles * @composed */ interface MediaDurationChangeRequestEvent extends DOMEvent<number> { } /** * Fired when requesting media to enter fullscreen. The event `detail` can specify the * fullscreen target, which can be the media or provider (defaults to `prefer-media`). * * @bubbles * @composed */ interface MediaEnterFullscreenRequestEvent extends DOMEvent<MediaFullscreenRequestTarget> { } /** * Fired when requesting media to exit fullscreen. The event `detail` can specify the fullscreen * target, which can be the media or provider (defaults to `prefer-media`). * * @bubbles * @composed */ interface MediaExitFullscreenRequestEvent extends DOMEvent<MediaFullscreenRequestTarget> { } /** * Fired when requesting media to enter picture-in-picture mode. * * @bubbles * @composed */ interface MediaEnterPIPRequestEvent extends DOMEvent<void> { } /** * Fired when requesting media to exit picture-in-picture mode. * * @bubbles * @composed */ interface MediaExitPIPRequestEvent extends DOMEvent<void> { } /** * Fired when requesting Google Cast. * * @bubbles * @composed */ interface MediaGoogleCastRequestEvent extends DOMEvent<void> { } /** * Fired when requesting media to seek to the live edge (i.e., set the current time to the current * live time). */ interface MediaLiveEdgeRequestEvent extends DOMEvent<void> { } /** * Fired when requesting media playback to begin/resume. * * @bubbles * @composed */ interface MediaPlayRequestEvent extends DOMEvent<void> { } /** * Fired when requesting to change the current video quality to the given index in the * `VideoQualityList` on the player. * * @bubbles * @composed * @detail qualityIndex */ interface MediaQualityChangeRequestEvent extends DOMEvent<number> { } /** * Fired when requesting to change the current playback rate. * * @bubbles * @composed * @detail rate */ interface MediaRateChangeRequestEvent extends DOMEvent<number> { } /** * Fired when requesting to change the current audio gain. * * @bubbles * @composed * @detail gain */ interface MediaAudioGainChangeRequestEvent extends DOMEvent<number> { } /** * Fired when requesting media playback to temporarily stop. * * @bubbles * @composed */ interface MediaPauseRequestEvent extends DOMEvent<void> { } /** * Fired when requesting a time change. In other words, moving the play head to a new position. * * @bubbles * @composed * @detail seekTo */ interface MediaSeekRequestEvent extends DOMEvent<number> { } /** * Fired when seeking/scrubbing to a new playback position. * * @bubbles * @composed * @detail time */ interface MediaSeekingRequestEvent extends DOMEvent<number> { } /** * Fired when requesting media to begin loading. This will only take effect if the `load` * strategy on the player is set to `custom`. * * @bubbles * @composed */ interface MediaStartLoadingRequestEvent extends DOMEvent<void> { } /** * Fired when requesting the media volume to be set to a new level. * * @bubbles * @composed * @detail volume */ interface MediaVolumeChangeRequestEvent extends DOMEvent<number> { } /** * Fired when controls visibility tracking may resume. This is typically called after requesting * tracking to pause via `media-pause-controls-request`. * * @bubbles * @composed */ interface MediaResumeControlsRequestEvent extends DOMEvent<void> { } /** * Fired when controls visibility tracking should pause. This is typically used when a control * is being actively interacted with, and we don't want the controls to be hidden before * the interaction is complete (eg: scrubbing, or settings is open). * * @bubbles * @composed */ interface MediaPauseControlsRequestEvent extends DOMEvent<void> { } /** * Fired when requesting the poster _should_ be rendered by the media provider. This should be * fired if a custom poster is _not_ being used. * * @bubbles * @composed */ interface MediaShowPosterRequestEvent extends DOMEvent<void> { } /** * Fired when requesting the poster should _not_ be rendered by the media provider. This * should be fired if a custom poster element is being used (e.g., `media-poster`). * * @bubbles * @composed */ interface MediaHidePosterRequestEvent extends DOMEvent<void> { } /** * Internal event that is fired by a media provider when requesting media playback to restart after * reaching the end. This event also helps notify the player that media will be looping. * * @internal * @bubbles * @composed */ interface MediaLoopRequestEvent extends DOMEvent<void> { } /** * Fired when the user loop preference changes. * * @bubbles * @composed */ interface MediaUserLoopChangeRequestEvent extends DOMEvent<boolean> { } /** * Fired when requesting the screen orientation to be locked to a certain type. * * @bubbles * @composed */ interface MediaOrientationLockRequestEvent extends DOMEvent<ScreenOrientationLockType> { } /** * Fired when requesting the screen orientation to be unlocked. * * @bubbles * @composed */ interface MediaOrientationUnlockRequestEvent extends DOMEvent<void> { } interface DASHProviderEvents { 'dash-lib-load-start': DASHLibLoadStartEvent; 'dash-lib-loaded': DASHLibLoadedEvent; 'dash-lib-load-error': DASHLibLoadErrorEvent; 'dash-instance': DASHInstanceEvent; 'dash-unsupported': DASHUnsupportedEvent; 'dash-ast-in-future': DASHAstInFutureEvent; 'dash-base-urls-updated': DASHBaseUrlsUpdatedEvent; 'dash-buffer-empty': DASHBufferStalledEvent; 'dash-buffer-loaded': DASHBufferLoadedEvent; 'dash-buffer-level-state-changed': DASHBufferStateChangedEvent; 'dash-buffer-level-updated': DASHBufferLevelUpdatedEvent; 'dash-dvb-font-download-added': DASHDvbFontDownloadAddedEvent; 'dash-dvb-font-download-complete': DASHDvbFontDownloadCompleteEvent; 'dash-dvb-font-download-failed': DASHDvbFontDownloadFailedEvent; 'dash-dynamic-to-static': DASHDynamicToStaticEvent; 'dash-error': DASHErrorEvent; 'dash-fragment-loading-completed': DASHFragmentLoadingCompletedEvent; 'dash-fragment-loading-progress': DASHFragmentLoadingProgressEvent; 'dash-fragment-loading-started': DASHFragmentLoadingStartedEvent; 'dash-fragment-loading-abandoned': DASHFragmentLoadingAbandonedEvent; 'dash-log': DASHLogEvent; 'dash-manifest-loading-started': DASHManifestLoadingStartedEvent; 'dash-manifest-loading-finished': DASHManifestLoadingFinishedEvent; 'dash-manifest-loaded': DASHManifestLoadedEvent; 'dash-metrics-changed': DASHMetricsChangedEvent; 'dash-metric-changed': DASHMetricChangedEvent; 'dash-metric-added': DASHMetricAddedEvent; 'dash-metric-updated': DASHMetricUpdatedEvent; 'dash-period-switch-started': DASHPeriodSwitchStartedEvent; 'dash-period-switch-completed': DASHPeriodSwitchCompletedEvent; 'dash-quality-change-requested': DASHQualityChangeRequestedEvent; 'dash-quality-change-rendered': DASHQualityChangeRenderedEvent; 'dash-track-change-rendered': DASHTrackChangeRenderedEvent; 'dash-stream-initializing': DASHStreamInitializingEvent; 'dash-stream-updated': DASHStreamUpdatedEvent; 'dash-stream-activated': DASHStreamActivatedEvent; 'dash-stream-deactivated': DASHStreamDeactivatedEvent; 'dash-stream-initialized': DASHStreamInitializedEvent; 'dash-stream-teardown-complete': DASHStreamTeardownCompleteEvent; 'dash-text-tracks-added': DASHAllTextTracksAddedEvent; 'dash-text-track-added': DASHTextTrackAddedEvent; 'dash-cue-enter': DASHCueEnterEvent; 'dash-cue-exit': DASHCueExitEvent; 'dash-throughput-measurement-stored': DASHThroughputMeasurementStoredEvent; 'dash-ttml-parsed': DASHTtmlParsedEvent; 'dash-ttml-to-parse': DASHTtmlToParseEvent; 'dash-caption-rendered': DASHCaptionRenderedEvent; 'dash-caption-container-resize': DASHCaptionContainerResizeEvent; 'dash-can-play': DASHCanPlayEvent; 'dash-can-play-through': DASHCanPlayThroughEvent; 'dash-playback-ended': DASHPlaybackEndedEvent; 'dash-playback-error': DASHPlaybackErrorEvent; 'dash-playback-not-allowed': DASHPlaybackNotAllowedEvent; 'dash-playback-metadata-loaded': DASHPlaybackMetaDataLoadedEvent; 'dash-playback-loaded-data': DASHPlaybackLoadedDataEvent; 'dash-playback-paused': DASHPlaybackPausedEvent; 'dash-playback-playing': DASHPlaybackPlayingEvent; 'dash-playback-progress': DASHPlaybackProgressEvent; 'dash-playback-rate-changed': DASHPlaybackRateChangedEvent; 'dash-playback-seeked': DASHPlaybackSeekedEvent; 'dash-playback-seeking': DASHPlaybackSeekingEvent; 'dash-playback-stalled': DASHPlaybackStalledEvent; 'dash-playback-started': DASHPlaybackStartedEvent; 'dash-playback-time-updated': DASHPlaybackTimeUpdatedEvent; 'dash-playback-volume-changed': DASHPlaybackVolumeChangedEvent; 'dash-playback-waiting': DASHPlaybackWaitingEvent; 'dash-manifest-validity-changed': DASHManifestValidityChangedEvent; 'dash-event-mode-on-start': DASHEventModeOnStartEvent; 'dash-event-mode-on-receive': DASHEventModeOnReceiveEvent; 'dash-conformance-violation': DASHConformanceViolationEvent; 'dash-representation-switch': DASHRepresentationSwitchEvent; 'dash-adaptation-set-removed-no-capabilities': DASHAdaptationSetRemovedNoCapabilitiesEvent; 'dash-content-steering-request-completed': DASHContentSteeringRequestCompletedEvent; 'dash-inband-prft': DASHInbandPrftEvent; 'dash-managed-media-source-start-streaming': DASHManagedMediaSourceStartStreamingEvent; 'dash-managed-media-source-end-streaming': DASHManagedMediaSourceEndStreamingEvent; } interface DASHMediaEvent<DetailType = unknown> extends DOMEvent<DetailType> { target: MediaPlayer; } /** * Fired when the browser begins downloading the `dash.js` library. */ interface DASHLibLoadStartEvent extends DASHMediaEvent<void> { } /** * Fired when the `dash.js` library has been loaded. * * @detail constructor */ interface DASHLibLoadedEvent extends DASHMediaEvent<typeof DASH__default.MediaPlayer> { } /** * Fired when the `dash.js` library fails during the download process. * * @detail error */ interface DASHLibLoadErrorEvent extends DASHMediaEvent<Error> { } /** * Fired when the `dash.js` instance is built. This will not fire if the browser does not * support `DASH.js`. * * @detail instance */ interface DASHInstanceEvent extends DASHMediaEvent<DASH__default.MediaPlayerClass> { } /** * Fired when the browser doesn't support DASH natively, _and_ `dash.js` doesn't support * this environment either, most likely due to missing Media Extensions or video codecs. */ interface DASHUnsupportedEvent extends DASHMediaEvent<void> { } /** * Triggered when playback will not start yet as the MPD's `availabilityStartTime` is in the future. * Check delay property in payload to determine time before playback will start. * * @detail data */ interface DASHAstInFutureEvent extends DASHMediaEvent<DASH__default.AstInFutureEvent> { } /** * Triggered when the `BaseURL` have been updated. */ interface DASHBaseUrlsUpdatedEvent extends DASHMediaEvent<void> { } /** * Triggered when the video element's buffer state changes to `stalled`. Check `mediaType` in * payload to determine type (Video, Audio, FragmentedText). */ interface DASHBufferStalledEvent extends DASHMediaEvent<void> { } /** * Triggered when the video element's buffer state changes to `loaded`. Check `mediaType` in payload * to determine type (Video, Audio, FragmentedText). * * @detail data */ interface DASHBufferLoadedEvent extends DASHMediaEvent<DASH__default.BufferEvent> { } /** * Triggered when the video element's buffer state changes, either stalled or loaded. Check * payload for state. * * @detail data */ interface DASHBufferStateChangedEvent extends DASHMediaEvent<DASH__default.BufferStateChangedEvent> { } /** * Triggered when the buffer level of a media type has been updated. */ interface DASHBufferLevelUpdatedEvent extends DASHMediaEvent<void> { } /** * Triggered when a font signalled by a DVB Font Download has been added to the document `ntFaceSet` * interface. * * @detail data */ interface DASHDvbFontDownloadAddedEvent extends DASHMediaEvent<DASH__default.dvbFontDownloadAdded> { } /** * Triggered when a font signalled by a DVB Font Download has successfully downloaded and the * `ntFace` can be used. * * @detail data */ interface DASHDvbFontDownloadCompleteEvent extends DASHMediaEvent<DASH__default.dvbFontDownloadComplete> { } /** * Triggered when a font signalled by a DVB Font Download could not be successfully downloaded, so * the `FontFace` will not be used. * * @detail data */ interface DASHDvbFontDownloadFailedEvent extends DASHMediaEvent<DASH__default.dvbFontDownloadFailed> { } /** * Triggered when a dynamic stream changed to static (transition phase between Live and -Demand). * * @detail data */ interface DASHDynamicToStaticEvent extends DASHMediaEvent<DASH__default.DynamicToStaticEvent> { } /** * Triggered when there is an error from the element or MSE source buffer. * * @detail error */ interface DASHErrorEvent extends DASHMediaEvent<DASH__default.ErrorEvent> { } /** * Triggered when a fragment download has completed. * * @detail data */ interface DASHFragmentLoadingCompletedEvent extends DASHMediaEvent<DASH__default.FragmentLoadingCompletedEvent> { } /** * Triggered when a partial fragment download has completed. */ interface DASHFragmentLoadingProgressEvent extends DASHMediaEvent<void> { } /** * Triggered when a fragment download has started. */ interface DASHFragmentLoadingStartedEvent extends DASHMediaEvent<void> { } /** * Triggered when a fragment download is abandoned due to detection of slow download base on e * ABR abandon rule. * * @detail data */ interface DASHFragmentLoadingAbandonedEvent extends DASHMediaEvent<DASH__default.FragmentLoadingAbandonedEvent> { } /** * Triggered when Debug logger methods are called. * * @detail data */ interface DASHLogEvent extends DASHMediaEvent<DASH__default.LogEvent> { } /** * Triggered when the manifest load has started. */ interface DASHManifestLoadingStartedEvent extends DASHMediaEvent<void> { } /** * Triggered when the manifest loading is finished, providing the request object information. */ interface DASHManifestLoadingFinishedEvent extends DASHMediaEvent<void> { } /** * Triggered when the manifest load is complete, providing the payload. * * @detail data */ interface DASHManifestLoadedEvent extends DASHMediaEvent<DASH__default.ManifestLoadedEvent> { } /** * Triggered anytime there is a change to the overall metrics. */ interface DASHMetricsChangedEvent extends DASHMediaEvent<void> { } /** * Triggered when an individual metric is added, updated or cleared. * * @detail data */ interface DASHMetricChangedEvent extends DASHMediaEvent<DASH__default.MetricChangedEvent> { } /** * Triggered every time a new metric is added. * * @detail data */ interface DASHMetricAddedEvent extends DASHMediaEvent<DASH__default.MetricEvent> { } /** * Triggered every time a metric is updated. * * @detail data */ interface DASHMetricUpdatedEvent extends DASHMediaEvent<DASH__default.MetricEvent> { } /** * Triggered when a new stream (period) starts. * * @detail data */ interface DASHPeriodSwitchStartedEvent extends DASHMediaEvent<DASH__default.PeriodSwitchEvent> { } /** * Triggered at the stream end of a period. * * @detail data */ interface DASHPeriodSwitchCompletedEvent extends DASHMediaEvent<DASH__default.PeriodSwitchEvent> { } /** * Triggered when an ABR up /down switch is initiated; either by user in manual mode or auto de via * ABR rules. * * @detail data */ interface DASHQualityChangeRequestedEvent extends DASHMediaEvent<DASH__default.QualityChangeRequestedEvent> { } /** * Triggered when the new ABR quality is being rendered on-screen. * * @detail data */ interface DASHQualityChangeRenderedEvent extends DASHMediaEvent<DASH__default.QualityChangeRenderedEvent> { } /** * Triggered when the new track is being rendered. * * @detail data */ interface DASHTrackChangeRenderedEvent extends DASHMediaEvent<DASH__default.TrackChangeRenderedEvent> { } /** * Triggered when a stream (period) is being loaded. */ interface DASHStreamInitializingEvent extends DASHMediaEvent<void> { } /** * Triggered when a stream (period) is loaded. */ interface DASHStreamUpdatedEvent extends DASHMediaEvent<void> { } /** * Triggered when a stream (period) is activated. */ interface DASHStreamActivatedEvent extends DASHMediaEvent<void> { } /** * Triggered when a stream (period) is deactivated */ interface DASHStreamDeactivatedEvent extends DASHMediaEvent<void> { } /** * Triggered when a stream (period) is activated. * * @detail data */ interface DASHStreamInitializedEvent extends DASHMediaEvent<DASH__default.StreamInitializedEvent> { } /** * Triggered when the player has been reset. */ interface DASHStreamTeardownCompleteEvent extends DASHMediaEvent<void> { } /** * Triggered once all text tracks detected in the MPD are added to the video element. * * @detail data */ interface DASHAllTextTracksAddedEvent extends DASHMediaEvent<DASH__default.TextTracksAddedEvent> { } /** * Triggered when a text track is added to the video element's `TextTrackList`. * * @detail data */ interface DASHTextTrackAddedEvent extends DASHMediaEvent<DASH__default.TextTracksAddedEvent> { } /** * Triggered when a text track should be shown. * * @detail data */ interface DASHCueEnterEvent extends DASHMediaEvent<DASH__default.CueEnterEvent> { } /** * Triggered when a text track should be hidden. * * @detail data */ interface DASHCueExitEvent extends DASHMediaEvent<DASH__default.CueExitEvent> { } /** * Triggered when a throughput measurement based on the last segment request has been stored. * * @detail data */ interface DASHThroughputMeasurementStoredEvent extends DASHMediaEvent<void> { } /** * Triggered when a `ttml` chunk is parsed. * * @detail data */ interface DASHTtmlParsedEvent extends DASHMediaEvent<DASH__default.TtmlParsedEvent> { } /** * Triggered when a `ttml` chunk has to be parsed. * * @detail data */ interface DASHTtmlToParseEvent extends DASHMediaEvent<DASH__default.TtmlToParseEvent> { } /** * Triggered when a caption is rendered. * * @detail data */ interface DASHCaptionRenderedEvent extends DASHMediaEvent<DASH__default.CaptionRenderedEvent> { } /** * Triggered when the caption container is resized. * * @detail data */ interface DASHCaptionContainerResizeEvent extends DASHMediaEvent<DASH__default.CaptionContainerResizeEvent> { } /** * Sent when enough data is available that the media can be played, at least for a couple of * frames. This corresponds to the `HAVE_ENOUGH_DATA` `readyState`. */ interface DASHCanPlayEvent extends DASHMediaEvent<void> { } /** * This corresponds to the `CAN_PLAY_THROUGH` `readyState`. */ interface DASHCanPlayThroughEvent extends DASHMediaEvent<void> { } /** * Sent when playback completes. */ interface DASHPlaybackEndedEvent extends DASHMediaEvent<void> { } /** * Sent when an error occurs. The element's error attribute contains more information. * * @detail data */ interface DASHPlaybackErrorEvent extends DASHMediaEvent<DASH__default.PlaybackErrorEvent> { } /** * Sent when playback is not allowed (for example if user gesture is needed). */ interface DASHPlaybackNotAllowedEvent extends DASHMediaEvent<void> { } /** * The media's metadata has finished loading; all attributes now contain as much useful * information as they're going to. */ interface DASHPlaybackMetaDataLoadedEvent extends DASHMediaEvent<void> { } /** * The event is fired when the frame at the current playback position of the media has finished * loading; often the first frame. */ interface DASHPlaybackLoadedDataEvent extends DASHMediaEvent<void> { } /** * Sent when playback is paused. * * @detail data */ interface DASHPlaybackPausedEvent extends DASHMediaEvent<DASH__default.PlaybackPausedEvent> { } /** * Sent when the media begins to play (either for the first time, after having been paused, * or after ending and then restarting). * * @detail data */ interface DASHPlaybackPlayingEvent extends DASHMediaEvent<DASH__default.PlaybackPlayingEvent> { } /** * Sent periodically to inform interested parties of progress downloading the media. Information * about the current amount of the media that has been downloaded is available in the media * element's buffered attribute. */ interface DASHPlaybackProgressEvent extends DASHMediaEvent<void> { } /** * Sent when the playback speed changes. * * @detail data */ interface DASHPlaybackRateChangedEvent extends DASHMediaEvent<DASH__default.PlaybackRateChangedEvent> { } /** * Sent when a seek operation completes. */ interface DASHPlaybackSeekedEvent extends DASHMediaEvent<void> { } /** * Sent when a seek operation begins. * * @detail data */ interface DASHPlaybackSeekingEvent extends DASHMediaEvent<DASH__default.PlaybackSeekingEvent> { } /** * Sent when the video element reports stalled. */ interface DASHPlaybackStalledEvent extends DASHMediaEvent<void> { } /** * Sent when playback of the media starts after having been paused; that is, when playback is * resumed after a prior pause event. * * @detail data */ interface DASHPlaybackStartedEvent extends DASHMediaEvent<DASH__default.PlaybackStartedEvent> { } /** * The time indicated by the element's currentTime attribute has changed. * * @detail data */ interface DASHPlaybackTimeUpdatedEvent extends DASHMediaEvent<DASH__default.PlaybackTimeUpdatedEvent> { } /** * Sent when the video element reports that the volume has changed. */ interface DASHPlaybackVolumeChangedEvent extends DASHMediaEvent<void> { } /** * Sent when the media playback has stopped because of a temporary lack of data. * * @detail data */ interface DASHPlaybackWaitingEvent extends DASHMediaEvent<DASH__default.PlaybackWaitingEvent> { } /** * Manifest validity changed - As a result of an MPD validity expiration event. */ interface DASHManifestValidityChangedEvent extends DASHMediaEvent<void> { } /** * Dash events are triggered at their respective start points on the timeline. */ interface DASHEventModeOnStartEvent extends DASHMediaEvent<void> { } /** * Dash events are triggered as soon as they were parsed. */ interface DASHEventModeOnReceiveEvent extends DASHMediaEvent<void> { } /** * Event that is dispatched whenever the player encounters a potential conformance validation at * might lead to unexpected/not optimal behavior. */ interface DASHConformanceViolationEvent extends DASHMediaEvent<void> { } /** * Event that is dispatched whenever the player switches to a different representation. */ interface DASHRepresentationSwitchEvent extends DASHMediaEvent<void> { } /** * Event that is dispatched whenever an adaptation set is removed due to all representations to * being supported. * * @detail data */ interface DASHAdaptationSetRemovedNoCapabilitiesEvent extends DASHMediaEvent<DASH__default.AdaptationSetRemovedNoCapabilitiesEvent> { } /** * Triggered when a content steering request has completed. */ interface DASHContentSteeringRequestCompletedEvent extends DASHMediaEvent<void> { } /** * Triggered when an inband prft (ProducerReferenceTime) boxes has been received. * * @detail data */ interface DASHInbandPrftEvent extends DASHMediaEvent<DASH__default.InbandPrftReceivedEvent> { } /** * The streaming attribute of the Managed Media Source is `true`. */ interface DASHManagedMediaSourceStartStreamingEvent extends DASHMediaEvent<void> { } /** * The streaming attribute of the Managed Media Source is `false`. */ interface DASHManagedMediaSourceEndStreamingEvent extends DASHMediaEvent<void> { } interface GoogleCastEvents { 'google-cast-load-start': GoogleCastLoadStartEvent; 'google-cast-loaded': GoogleCastLoadedEvent; 'google-cast-prompt-open': GoogleCastPromptEvent; 'google-cast-prompt-close': GoogleCastPromptEvent; 'google-cast-prompt-error': GoogleCastPromptErrorEvent; } interface GoogleCastEvent<DetailType = unknown> extends DOMEvent<DetailType> { target: MediaPlayer; } /** * Fired when the Google Cast framework starts loading. */ interface GoogleCastLoadStartEvent extends GoogleCastEvent<void> { } /** * Fired when the Google Cast framework has loaded. */ interface GoogleCastLoadedEvent extends GoogleCastEvent<void> { } /** * Fired when the Google Cast prompt is opened/closed. */ interface GoogleCastPromptEvent extends GoogleCastEvent<void> { } interface GoogleCastPromptError extends Error { code: GoogleCastPromptErrorCode; } type GoogleCastPromptErrorCode = 'CAST_NOT_AVAILABLE' | 'CANCEL' | 'TIMEOUT' | 'API_NOT_INITIALIZED' | 'INVALID_PARAMETER' | 'EXTENSION_NOT_COMPATIBLE' | 'EXTENSION_MISSING' | 'RECEIVER_UNAVAILABLE' | 'SESSION_ERROR' | 'CHANNEL_ERROR' | 'NO_DEVICES_AVAILABLE' | 'LOAD_MEDIA_FAILED'; /** * Fired when requesting Google Cast has failed. */ interface GoogleCastPromptErrorEvent extends GoogleCastEvent<GoogleCastPromptError> { } interface HLSProviderEvents { 'hls-lib-load-start': HLSLibLoadStartEvent; 'hls-lib-loaded': HLSLibLoadedEvent; 'hls-lib-load-error': HLSLibLoadErrorEvent; 'hls-instance': HLSInstanceEvent; 'hls-unsupported': HLSUnsupportedEvent; 'hls-media-attaching': HLSMediaAttachingEvent; 'hls-media-attached': HLSMediaAttachedEvent; 'hls-media-detaching': HLSMediaDetachingEvent; 'hls-media-detached': HLSMediaDetachedEvent; 'hls-buffer-reset': HLSBufferResetEvent; 'hls-buffer-codecs': HLSBufferCodecsEvent; 'hls-buffer-created': HLSBufferCreatedEvent; 'hls-buffer-appending': HLSBufferAppendingEvent; 'hls-buffer-appended': HLSBufferAppendedEvent; 'hls-buffer-eos': HLSBufferEosEvent; 'hls-buffer-flushing': HLSBufferFlushingEvent; 'hls-buffer-flushed': HLSBufferFlushedEvent; 'hls-manifest-loading': HLSManifestLoadingEvent; 'hls-manifest-loaded': HLSManifestLoadedEvent; 'hls-manifest-parsed': HLSManifestParsedEvent; 'hls-level-switching': HLSLevelSwitchingEvent; 'hls-level-switched': HLSLevelSwitchedEvent; 'hls-level-loading': HLSLevelLoadingEvent; 'hls-level-loaded': HLSLevelLoadedEvent; 'hls-level-updated': HLSLevelUpdatedEvent; 'hls-level-pts-updated': HLSLevelPtsUpdatedEvent; 'hls-levels-updated': HLSLevelsUpdatedEvent; 'hls-audio-tracks-updated': HLSAudioTracksUpdatedEvent; 'hls-audio-track-switching': HLSAudioTrackSwitchingEvent; 'hls-audio-track-switched': HLSAudioTrackSwitchedEvent; 'hls-audio-track-loading': HLSAudioTrackLoadingEvent; 'hls-audio-track-loaded': HLSAudioTrackLoadedEvent; 'hls-subtitle-tracks-updated': HLSSubtitleTracksUpdatedEvent; 'hls-subtitle-tracks-cleared': HLSSubtitleTracksClearedEvent; 'hls-subtitle-track-switch': HLSSubtitleTrackSwitchEvent; 'hls-subtitle-track-loading': HLSSubtitleTrackLoadingEvent; 'hls-subtitle-track-loaded': HLSSubtitleTrackLoadedEvent; 'hls-subtitle-frag-processed': HLSSubtitleFragProcessedEvent; 'hls-cues-parsed': HLSCuesParsedEvent; 'hls-non-native-text-tracks-found': HLSNonNativeTextTracksFoundEvent; 'hls-init-pts-found': HLSInitPtsFoundEvent; 'hls-frag-loading': HLSFragLoadingEvent; 'hls-frag-load-emergency-aborted': HLSFragLoadEmergencyAbortedEvent; 'hls-frag-loaded': HLSFragLoadedEvent; 'hls-frag-decrypted': HLSFragDecryptedEvent; 'hls-frag-parsing-init-segment': HLSFragParsingInitSegmentEvent; 'hls-frag-parsing-userdata': HLSFragParsingUserdataEvent; 'hls-frag-parsing-metadata': HLSFragParsingMetadataEvent; 'hls-frag-parsed': HLSFragParsedEvent; 'hls-frag-buffered-data': HLSFragBufferedDataEvent; 'hls-frag-changed': HLSFragChangedEvent; 'hls-fps-drop': HLSFpsDropEvent; 'hls-fps-drop-level-capping': HLSFpsDropLevelCappingEvent; 'hls-error': HLSErrorEvent; 'hls-destroying': HLSDestroyingEvent; 'hls-key-loading': HLSKeyLoadingEvent; 'hls-key-loaded': HLSKeyLoadedEvent; 'hls-back-buffer-reached': HLSBackBufferReachedEvent; } interface HLSMediaEvent<DetailType = unknown> extends DOMEvent<DetailType> { target: MediaPlayer; } /** * Fired when the browser begins downloading the `hls.js` library. */ interface HLSLibLoadStartEvent extends HLSMediaEvent<void> { } /** * Fired when the `hls.js` library has been loaded. * * @detail constructor */ interface HLSLibLoadedEvent extends HLSMediaEvent<typeof HLS.default> { } /** * Fired when the `hls.js` library fails during the download process. * * @detail error */ interface HLSLibLoadErrorEvent extends HLSMediaEvent<Error> { } /** * Fired when the `hls.js` instance is built. This will not fire if the browser does not * support `hls.js`. * * @detail instance */ interface HLSInstanceEvent extends HLSMediaEvent<HLS.default> { } /** * Fired when the browser doesn't support HLS natively, _and_ `hls.js` doesn't support * this environment either, most likely due to missing Media Extensions or video codecs. */ interface HLSUnsupportedEvent extends HLSMediaEvent<void> { } /** * Fired before `MediaSource` begins attaching to the media element. * * @detail data */ interface HLSMediaAttachingEvent extends HLSMediaEvent<HLS.MediaAttachingData> { } /** * Fired when `MediaSource` has been successfully attached to the media element. * * @detail data */ interface HLSMediaAttachedEvent extends HLSMediaEvent<HLS.MediaAttachedData> { } /** * Fired before detaching `MediaSource` from the media element. */ interface HLSMediaDetachingEvent extends HLSMediaEvent<void> { } /** * Fired when `MediaSource` has been detached from media element. */ interface HLSMediaDetachedEvent extends HLSMediaEvent<void> { } /** * Fired when we buffer is going to be reset. */ interface HLSBufferResetEvent extends HLSMediaEvent<void> { } /** * Fired when we know about the codecs that we need buffers for to push into. * * @detail data */ interface HLSBufferCodecsEvent extends HLSMediaEvent<HLS.BufferCodecsData> { } /** * Fired when `SourceBuffer`'s have been created. * * @detail data */ interface HLSBufferCreatedEvent extends HLSMediaEvent<HLS.BufferCreatedData> { } /** * Fired when we begin appending a media segment to the buffer. * * @detail data */ interface HLSBufferAppendingEvent extends HLSMediaEvent<HLS.BufferAppendingData> { } /** * Fired when we are done with appending a media segment to the buffer. * * @detail data */ interface HLSBufferAppendedEvent extends HLSMediaEvent<HLS.BufferAppendedData> { } /** * Fired when the stream is finished and we want to notify the media buffer that there will be no * more data. * * @detail data */ interface HLSBufferEosEvent extends HLSMediaEvent<HLS.BufferEOSData> { } /** * Fired when the media buffer should be flushed. * * @detail data */ interface HLSBufferFlushingEvent extends HLSMediaEvent<HLS.BufferFlushingData> { } /** * Fired when the media buffer has been flushed. * * @detail data */ interface HLSBufferFlushedEvent extends HLSMediaEvent<HLS.BufferFlushedData> { } /** * Fired to signal that manifest loading is starting. * * @detail data */ interface HLSManifestLoadingEvent extends HLSMediaEvent<HLS.ManifestLoadingData> { } /** * Fired after the manifest has been loaded. * * @detail data */ interface HLSManifestLoadedEvent extends HLSMediaEvent<HLS.ManifestLoadedData> { } /** * Fired after manifest has been parsed. * * @detail data */ interface HLSManifestParsedEvent extends HLSMediaEvent<HLS.ManifestParsedData> { } /** * Fired when a level switch is requested. * * @detail data */ interface HLSLevelSwitchingEvent extends HLSMediaEvent<HLS.LevelSwitchingData> { } /** * Fired when a level switch is effective. * * @detail data */ interface HLSLevelSwitchedEvent extends HLSMediaEvent<HLS.LevelSwitchedData> { } /** * Fired when a level playlist loading starts. * * @detail data */ interface HLSLevelLoadingEvent extends HLSMediaEvent<HLS.LevelLoadingData> { } /** * Fired when a level playlist loading finishes. * * @detail data */ interface HLSLevelLoadedEvent extends HLSMediaEvent<HLS.LevelLoadedData> { } /** * Fired when a level's details have been updated based on previous details, after it has been * loaded. *