UNPKG

vidstack

Version:

Build awesome media experiences on the web.

69 lines (68 loc) 2.02 kB
import { type ReadSignal } from 'maverick.js'; import { Component, type HTMLCustomElement } from 'maverick.js/element'; import { type MediaContext } from '../core/api/context'; declare global { interface MaverickElements { 'media-time': MediaTimeElement; } } /** * Outputs a media duration (eg: `currentTime`, `duration`, `bufferedAmount`, etc.) value as time * formatted text. * * @docs {@link https://www.vidstack.io/docs/player/components/display/time} * @example * ```html * <media-time type="current"></media-time> * ``` * @example * ```html * <!-- Remaining time. --> * <media-time type="current" remainder></media-time> * ``` */ export declare class Time extends Component<TimeAPI> { static el: import("maverick.js/element").CustomElementDefinition<TimeAPI>; protected _media: MediaContext; protected _time: ReadSignal<string>; protected onAttach(): void; protected _getTime(): string; protected _getSeconds(type: TimeProps['type']): number; render(): import("maverick.js").JSX.Element; } export interface TimeAPI { props: TimeProps; } export interface TimeProps { /** * The type of media time to track. */ type: 'current' | 'buffered' | 'duration'; /** * Whether the time should always show the hours unit, even if the time is less than * 1 hour. * * @example `20:30 -> 0:20:35` */ showHours: boolean; /** * Whether the hours unit should be padded with zeroes to a length of 2. * * @example `1:20:03 -> 01:20:03` */ padHours: boolean | null; /** * Whether the minutes unit should be padded with zeroes to a length of 2. * * @example `5:22 -> 05:22` */ padMinutes: boolean | null; /** * Whether to display the remaining time from the current type, until the duration is reached. * * @example `duration` - `currentTime` */ remainder: boolean; } export interface MediaTimeElement extends HTMLCustomElement<Time> { }