import ReactPlayer from "react-player"; import React, { Ref } from "react"; import styled from "styled-components"; import { createMessage, ENTER_VIDEO_URL } from "constants/messages"; export interface VideoComponentProps { url?: string; autoplay?: boolean; controls?: boolean; onStart?: () => void; onPlay?: () => void; onPause?: () => void; onEnded?: () => void; onReady?: () => void; onProgress?: () => void; onSeek?: () => void; onError?: () => void; player?: Ref; } const ErrorContainer = styled.div` display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; `; const Error = styled.span``; export default function VideoComponent(props: VideoComponentProps) { const { autoplay, controls, onEnded, onError, onPause, onPlay, onProgress, onReady, onSeek, onStart, player, url, } = props; return url ? ( ) : ( {createMessage(ENTER_VIDEO_URL)} ); }