|
|
|
|
|
|
|
|
|
|
|
import React from 'react'; |
|
|
|
export type pausePlacement = 'bottomRight' | 'center'; |
|
|
|
export type languageType = 'zh' | 'en'; |
|
|
|
export type videoType = 'h264' | 'hls'; |
|
|
|
export type toastPosition = 'leftTop' | 'rightTop' | 'leftBottom' | 'rightBottom' | 'center'; |
|
|
|
export type progressFloatPosition = 'tp' | 'bt'; |
|
|
|
|
|
|
|
|
|
export type scaleMode = 'scaleToFill' | 'widthFix' | 'heightFix'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export type qualityName = 'SD' | 'HD' | 'FHD' | 'BD'; |
|
|
|
export type qualityKey = '360P' | '540P' | '720P' | '1080P'; |
|
|
|
export interface qualityAttributes<T = qualityName> { |
|
name: T; |
|
url: string; |
|
} |
|
export interface videoOption<T = string, K = boolean, U = number> { |
|
|
|
|
|
|
|
width?: U; |
|
|
|
|
|
|
|
height?: U; |
|
|
|
|
|
|
|
videoSrc: T; |
|
|
|
|
|
|
|
theme?: T; |
|
|
|
|
|
|
|
autoPlay?: K; |
|
|
|
|
|
|
|
mode?: scaleMode; |
|
|
|
|
|
|
|
poster?: T; |
|
|
|
|
|
|
|
setEndPlayContent?: React.ReactNode; |
|
|
|
|
|
|
|
setBufferContent?: React.ReactNode; |
|
|
|
|
|
|
|
setPauseButtonContent?: React.ReactNode; |
|
|
|
|
|
|
|
pausePlacement?: pausePlacement; |
|
|
|
|
|
|
|
hideMouseTime?: U; |
|
|
|
|
|
|
|
isShowMultiple?: K; |
|
|
|
|
|
|
|
isShowSet?: K; |
|
|
|
|
|
|
|
isShowScreenshot?: K; |
|
|
|
|
|
|
|
isShowPicture?: K; |
|
|
|
|
|
|
|
isShowWebFullScreen?: K; |
|
|
|
|
|
|
|
language?: languageType; |
|
|
|
|
|
|
|
isShowPauseButton?: K; |
|
|
|
|
|
|
|
quality?: qualityAttributes[]; |
|
|
|
|
|
|
|
videoType?: videoType; |
|
|
|
|
|
|
|
isToast?: K; |
|
|
|
|
|
|
|
toastPosition?: toastPosition; |
|
|
|
|
|
|
|
isProgressFloat?: K; |
|
|
|
|
|
|
|
progressFloatPosition?: progressFloatPosition; |
|
} |
|
export interface videoAttributes<T = number, K = boolean> { |
|
|
|
|
|
|
|
isPlay: K; |
|
|
|
|
|
|
|
currentTime: T; |
|
|
|
|
|
|
|
duration: T; |
|
|
|
|
|
|
|
bufferedTime: T; |
|
|
|
|
|
|
|
isPictureinpicture: K; |
|
|
|
|
|
|
|
volume: T; |
|
|
|
|
|
|
|
multiple: T; |
|
|
|
|
|
|
|
isEndEd: K; |
|
|
|
|
|
|
|
error: null | T; |
|
} |
|
export type noParVoid = () => void; |
|
|
|
export type parVoid<T> = (par: T) => void; |
|
|
|
export interface videoMethod<T = noParVoid> { |
|
|
|
|
|
|
|
load: T; |
|
|
|
|
|
|
|
play: T; |
|
|
|
|
|
|
|
pause: T; |
|
|
|
|
|
|
|
setVolume: parVoid<number>; |
|
|
|
|
|
|
|
seek: parVoid<number>; |
|
|
|
|
|
|
|
setVideoSrc: parVoid<string>; |
|
} |
|
export type callBackType<T = videoAttributes> = (e: T) => void; |
|
export interface videoCallback<T = callBackType, U = callBackType<qualityKey>> { |
|
|
|
|
|
|
|
onProgressMouseDown: T; |
|
|
|
|
|
|
|
onPlay: T; |
|
|
|
|
|
|
|
onPause: T; |
|
|
|
|
|
|
|
onTimeChange: T; |
|
|
|
|
|
|
|
onEndEd: T; |
|
|
|
|
|
|
|
onProgressMouseUp: T; |
|
|
|
|
|
|
|
onError: noParVoid; |
|
|
|
|
|
|
|
onvolumechange: T; |
|
|
|
|
|
|
|
onQualityChange: U; |
|
} |
|
export interface videoparameter extends Partial<videoCallback> { |
|
style?: React.CSSProperties; |
|
|
|
|
|
|
|
option: videoOption; |
|
className?: string; |
|
} |
|
export type JoLPlayerRef = videoMethod & |
|
videoAttributes & { |
|
video: HTMLVideoElement; |
|
}; |
|
|
|
interface CompoundedComponent |
|
extends React.ForwardRefExoticComponent<videoparameter & React.RefAttributes<JoLPlayerRef>> {} |
|
declare const JolPlayer: CompoundedComponent; |
|
export default JolPlayer; |
|
export { JolPlayer }; |
|
|