import React, { Component, EventHandler, HTMLAttributes, MutableRefObject, SyntheticEvent } from 'react';
import { CloudinaryVideo } from '@cloudinary/url-gen';
import { HtmlVideoLayer, Plugins, VideoPoster, VideoSources } from '@cloudinary/html';
declare type ReactEventHandler = EventHandler>;
interface VideoProps extends HTMLAttributes {
cldVid: CloudinaryVideo;
cldPoster?: VideoPoster;
plugins?: Plugins;
sources?: VideoSources;
innerRef?: ((instance: any) => void) | MutableRefObject | null;
useFetchFormat?: boolean;
controls?: boolean;
loop?: boolean;
muted?: boolean;
poster?: string;
preload?: string;
autoPlay?: boolean;
playsInline?: boolean;
onPlay?: ReactEventHandler;
onLoadStart?: ReactEventHandler;
onPlaying?: ReactEventHandler;
onError?: ReactEventHandler;
onEnded?: ReactEventHandler;
}
/**
* @memberOf ReactSDK
* @type {Component}
* @description The Cloudinary video component.
* @prop {CloudinaryVideo} transformation Generated by @cloudinary/url-gen
* @prop {Plugins} plugins Advanced image component plugins lazyload()
* @prop videoAttributes Optional attributes include controls, loop, muted, poster, preload, autoplay
* @prop videoEvents Optional video events include play, loadstart, playing, error, ended
* @prop {VideoSources} sources Optional sources to generate
* @example
*
* Using custom defined resources.
*
* const vid = new CloudinaryVideo('dog', {cloudName: 'demo'});
* const videoEl = useRef();
* const sources = [
* {
* type: 'mp4',
* codecs: ['vp8', 'vorbis'],
* transcode: videoCodec(auto())
* },
* {
* type: 'webm',
* codecs: ['avc1.4D401E', 'mp4a.40.2'],
* videoCodec: videoCodec(auto())
* }];
*
* return
*/
declare class AdvancedVideo extends Component {
videoRef: MutableRefObject;
htmlVideoLayerInstance: HtmlVideoLayer;
constructor(props: VideoProps);
/**
* On mount, creates a new HTMLVideoLayer instance and initializes with ref to video element,
* user generated cloudinaryVideo and the plugins to be used.
*/
componentDidMount(): void;
/**
* On update, we cancel running plugins and update the video instance if the src
* was changed.
*/
componentDidUpdate(): void;
/**
* On unmount, we cancel the currently running plugins.
*/
componentWillUnmount(): void;
/**
* Returns video attributes.
*/
getVideoAttributes(): {};
/**
* Attach both this.videoRef and props.innerRef as ref to the given element.
* @param element - the element to attach a ref to
*/
attachRef(element: HTMLVideoElement): void;
render(): React.JSX.Element;
}
export { AdvancedVideo };