UNPKG

@aidenlx/player

Version:

Headless web components that make integrating media on the a web a breeze.

218 lines 9.86 kB
import { type PropertyValues, type TemplateResult } from 'lit'; import { type Ref } from 'lit/directives/ref.js'; import { CanPlay, MediaProviderElement, MediaType, ViewType } from '../../media'; export declare const AUDIO_EXTENSIONS: RegExp; export declare const VIDEO_EXTENSIONS: RegExp; /** * A DOMString` indicating the `CORS` setting for this media element. * * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin */ export declare type MediaCrossOriginOption = 'anonymous' | 'use-credentials'; /** * Is a `DOMString` that reflects the `preload` HTML attribute, indicating what data should be * preloaded, if any. */ export declare type MediaPreloadOption = 'none' | 'metadata' | 'auto'; /** * `DOMTokenList` that helps the user agent select what controls to show on the media element * whenever the user agent shows its own set of controls. The `DOMTokenList` takes one or more of * three possible values: `nodownload`, `nofullscreen`, and `noremoteplayback`. * * @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/controlsList */ export declare type MediaControlsList = 'nodownload' | 'nofullscreen' | 'noremoteplayback' | 'nodownload nofullscreen' | 'nodownload noremoteplayback' | 'nofullscreen noremoteplayback' | 'nodownload nofullscreen noremoteplayback'; /** * The object which serves as the source of the media associated with the `HTMLMediaElement`. The * object can be a `MediaStream`, `MediaSource`, `Blob`, or `File` (which inherits from `Blob`). * * @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/srcObject * @link https://developer.mozilla.org/en-US/docs/Web/API/MediaStream * @link https://developer.mozilla.org/en-US/docs/Web/API/MediaSource * @link https://developer.mozilla.org/en-US/docs/Web/API/Blob * @link https://developer.mozilla.org/en-US/docs/Web/API/File */ export declare type MediaSrcObject = MediaStream | MediaSource | Blob | File; /** * Enables loading, playing and controlling media files via the HTML5 MediaElement API. This is * used internally by the `vds-audio` and `vds-video` components. This provider only contains * glue code so don't bother using it on it's own. * * @slot - Pass `<source>` and `<track>` elements to the underlying HTML5 media player. */ export declare class Html5MediaElement extends MediaProviderElement { /** * Determines what controls to show on the media element whenever the browser shows its own set * of controls (e.g. when the controls attribute is specified). * * @example 'nodownload nofullscreen noremoteplayback' * @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/controlsList */ controlsList: MediaControlsList | undefined; /** * Whether to use CORS to fetch the related image. * * @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/crossOrigin */ crossOrigin: MediaCrossOriginOption | undefined; /** * Reflects the muted attribute, which indicates whether the audio output should be muted by * default. This property has no dynamic effect. To mute and unmute the audio output, use * the `muted` property. * * @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/defaultMuted */ defaultMuted: boolean | undefined; /** * A `double` indicating the default playback rate for the media. * * @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/defaultPlaybackRate */ defaultPlaybackRate: number | undefined; /** * Whether to disable the capability of remote playback in devices that are * attached using wired (HDMI, DVI, etc.) and wireless technologies (Miracast, Chromecast, * DLNA, AirPlay, etc). * * @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/disableRemotePlayback * @see https://www.w3.org/TR/remote-playback/#the-disableremoteplayback-attribute */ disableRemotePlayback: boolean | undefined; /** * Provides a hint to the browser about what the author thinks will lead to the best user * experience with regards to what content is loaded before the video is played. * * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#attr-preload */ preload: MediaPreloadOption | undefined; /** * The width of the media player. */ width: number | undefined; /** * The height of the media player. */ height: number | undefined; protected __src: string; /** * The URL of a media resource to use. * * @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/src */ get src(): string; set src(newSrc: string); protected readonly _mediaRef: Ref<HTMLMediaElement>; get mediaElement(): HTMLMediaElement | undefined; /** * Sets or returns the object which serves as the source of the media associated with the * `HTMLMediaElement`. * * @default undefined * @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/srcObject */ get srcObject(): MediaSrcObject | undefined; set srcObject(newSrcObject: MediaSrcObject | undefined); /** * Indicates the readiness state of the media. * * @default ReadyState.HaveNothing * @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState */ get readyState(): number; /** * Indicates the current state of the fetching of media over the network. * * @default NetworkState.Empty */ get networkState(): number; protected firstUpdated(changedProps: PropertyValues): void; disconnectedCallback(): void; /** * Override this to modify the content rendered inside `<audio>` and `<video>` elements. */ protected _renderMediaChildren(): TemplateResult; protected _timeRAF?: number; protected _cancelTimeUpdates(): void; protected _requestTimeUpdates(): void; protected _requestTimeUpdate(): void; protected _updateCurrentTime(newTime: number, triggerEvent?: Event): void; protected _handleDefaultSlotChange(): void; protected _cleanupOldSourceNodes(): void; protected _hasAttachedSourceNodes: boolean; protected _attachNewSourceNodes(): void; protected _isMediaWaiting: boolean; handleMediaCanLoad(): Promise<void>; protected _isListeningToMediaElement: boolean; protected _bindMediaEventListeners(): void; protected _handleAbort(event: Event): void; protected _handleCanPlay(event: Event): void; protected _handleCanPlayThrough(event: Event): void; protected _handleLoadStart(event: Event): void; protected _handleEmptied(event: Event): void; protected _handleLoadedData(event: Event): void; /** * Can be used to indicate another engine such as `hls.js` will attach to the media element * so it can handle certain ready events. */ protected _willAnotherEngineAttach(): boolean; protected get _mediaReadyOnMetadataLoad(): boolean; protected _handleLoadedMetadata(event: Event): void; protected _determineMediaType(event: Event): void; protected _handlePlay(event: Event): void; protected _handlePause(event: Event): void; protected _handlePlaying(event: Event): void; protected _handleDurationChange(event: Event): void; protected _handleProgress(event: Event): void; protected _handleRateChange(event: Event): void; protected _handleSeeking(event: Event): void; protected _handleSeeked(event: Event): void; protected _handleStalled(event: Event): void; protected _handleVolumeChange(event: Event): void; protected _handleWaiting(event: Event): void; protected _handleSuspend(event: Event): void; protected _handleEnded(event: Event): void; protected _handleLoop(): void; protected _handleError(event: Event): void; protected _getPaused(): boolean; protected _getVolume(): number; protected _setVolume(newVolume: number): void; protected _setCurrentTime(newTime: number): void; protected _getMuted(): boolean; protected _setMuted(isMuted: boolean): void; protected _handleMediaSrcChange(): Promise<void>; get engine(): HTMLMediaElement | undefined; get buffered(): TimeRanges; /** * Returns a `MediaError` object for the most recent error, or `undefined` if there has not been * an error. * * @default undefined * @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/error */ get error(): MediaError | undefined; canPlayType(type: string): CanPlay; play(): Promise<void | undefined>; pause(): Promise<void | undefined>; /** * 🧑‍🔬 **EXPERIMENTAL:** Returns a `MediaStream` object which is streaming a real-time capture * of the content being rendered in the media element. This method will return `undefined` * if this API is not available. * * @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/captureStream */ captureStream(): MediaStream | undefined; /** * Resets the media element to its initial state and begins the process of selecting a media * source and loading the media in preparation for playback to begin at the beginning. The * amount of media data that is prefetched is determined by the value of the element's * `preload` attribute. * * 💡 You should generally not need to call this method as it's handled by the library. * * @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/load */ load(): void; protected _getMediaType(): MediaType; protected _getViewType(): ViewType; } //# sourceMappingURL=Html5MediaElement.d.ts.map