47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import React, { Component, CSSProperties } from 'react';
|
|
import flvjs from 'flv.js';
|
|
export declare const FLV_EVENT: Readonly<flvjs.Events>;
|
|
export interface VideoPlayerProps {
|
|
className: string;
|
|
style?: CSSProperties;
|
|
type: string;
|
|
isLive?: boolean;
|
|
cors?: boolean;
|
|
withCredentials?: boolean;
|
|
playId?: number;
|
|
hasAudio?: boolean;
|
|
hasVideo?: boolean;
|
|
duration?: number;
|
|
filesize?: number;
|
|
url?: string;
|
|
autoPlay?: boolean;
|
|
onCreat?: any;
|
|
/**
|
|
* @see https://github.com/Bilibili/flv.js/blob/master/docs/api.md#config
|
|
*/
|
|
config: object;
|
|
}
|
|
export default class VideoPlayer extends Component<VideoPlayerProps, any> {
|
|
state: {
|
|
curPlayUrl: string;
|
|
shouldReinit: boolean;
|
|
};
|
|
flvPlayer: any;
|
|
videoElement: null;
|
|
static getDerivedStateFromProps: (nextProps: {
|
|
url?: any;
|
|
playId?: any;
|
|
}, prevState: {
|
|
curPlayUrl?: any;
|
|
playId?: any;
|
|
}) => {
|
|
playId: any;
|
|
curPlayUrl: any;
|
|
shouldReinit: boolean;
|
|
} | null;
|
|
initFlv: ($video: null) => void;
|
|
componentWillUnmount(): void;
|
|
componentDidUpdate(): void;
|
|
render(): React.JSX.Element;
|
|
}
|