@ebay/ebayui-core
Version:
Collection of core eBay components; considered to be the building blocks for all composite structures, pages & apps.
110 lines (109 loc) • 3.37 kB
TypeScript
import type { WithNormalizedProps } from "../../global";
declare global {
interface Window {
shaka: any;
}
}
export interface PlayPauseEvent {
originalEvent: Event;
player: any;
auto: boolean;
}
export interface VolumeEvent {
originalEvent: Event;
volume: number;
muted: boolean;
}
interface VideoInput extends Omit<Marko.HTML.Video, `on${string}`> {
"play-view"?: "fullscreen" | "inline";
volume?: number;
action?: "play" | "pause";
"volume-slider"?: boolean;
clip?: any[];
source: Marko.AttrTag<Marko.HTML.Source>;
/**
* Whether to show the default layout or compact layout
* @default default
*/
layout?: "default" | "compact";
/**
* The navigation link for the video
* @example <@nav href="www.ebay.com" target="_blank"/>
*/
nav?: Marko.AttrTag<Marko.HTML.A>;
/**
* Whether to pause the video when it is less than 50% visible in the viewport
* @default false
*/
offscreenPause?: boolean;
/**
* @deprecated Use `a11y-report-text` instead
*/
"report-text"?: Marko.HTMLAttributes["aria-label"];
"a11y-report-text"?: Marko.HTMLAttributes["aria-label"];
"a11y-mute-text"?: Marko.HTMLAttributes["aria-label"];
"a11y-unmute-text"?: Marko.HTMLAttributes["aria-label"];
"a11y-fullscreen-text"?: Marko.HTMLAttributes["aria-label"];
"a11y-exit-fullscreen-text"?: Marko.HTMLAttributes["aria-label"];
"spinner-timeout"?: number;
thumbnail?: string;
track?: Marko.AttrTag<Marko.HTML.Track>;
"error-text"?: string;
"a11y-play-text"?: Marko.HTMLAttributes["aria-label"];
"a11y-load-text"?: Marko.HTMLAttributes["aria-label"];
"on-play"?: (event: PlayPauseEvent) => void;
"on-pause"?: (event: PlayPauseEvent) => void;
"on-volume-change"?: (event: VolumeEvent) => void;
"on-load-error"?: (err: Error) => void;
"shaka-config"?: any;
}
export interface Input extends WithNormalizedProps<VideoInput> {
}
interface State {
played: boolean;
failed: boolean;
volumeSlider: boolean;
action: "play" | "pause" | "";
}
declare class Video extends Marko.Component<Input, State> {
video: HTMLVideoElement;
root: HTMLElement;
containerEl: HTMLElement;
playButtonContainer: HTMLElement;
player: any;
ui: any;
shaka: any;
observer: IntersectionObserver;
isInViewport: boolean;
isAutoPlay: boolean;
isAutoPause: boolean;
userPaused: boolean;
isFocusFromVideoClick: boolean;
mouseDownHandler: () => void;
windowFocusHandler: () => void;
windowBlurHandler: () => void;
isPlaylist(source: Marko.HTML.Source & {
src: string;
}): boolean;
handleResize(): void;
alignSeekbar(): void;
handlePause(originalEvent: Event): void;
handlePlaying(originalEvent: Event): void;
handleVolumeChange(originalEvent: Event): void;
handleError(err: Error): void;
showControls(): void;
takeAction(): void;
onInput(input: Input): void;
onCreate(input: Input): void;
_loadSrc(index?: number): void;
_attach(): void;
handleSuccess(): void;
onMount(): void;
setupIntersectionObserver(): void;
handleMouseDown(): void;
handleWindowFocus(): void;
handleWindowBlur(): void;
onDestroy(): void;
_loadVideo(): void;
}
export default Video;