2020-06-22 13:46:19 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import ReactPlayer from "react-player";
|
|
|
|
|
import {
|
|
|
|
|
Popover,
|
|
|
|
|
PopoverInteractionKind,
|
|
|
|
|
PopoverPosition,
|
|
|
|
|
} from "@blueprintjs/core";
|
|
|
|
|
import { ControlIcons } from "icons/ControlIcons";
|
|
|
|
|
import styled, { AnyStyledComponent } from "styled-components";
|
|
|
|
|
import { Colors } from "constants/Colors";
|
|
|
|
|
|
|
|
|
|
const PlayerWrapper = styled.div`
|
|
|
|
|
width: 600px;
|
|
|
|
|
height: 400px;
|
|
|
|
|
`;
|
|
|
|
|
|
2020-07-03 07:12:28 +00:00
|
|
|
const PlayIcon = styled(ControlIcons.PLAY_VIDEO as AnyStyledComponent)`
|
2020-06-22 13:46:19 +00:00
|
|
|
position: relative;
|
|
|
|
|
top: 10px;
|
|
|
|
|
&:hover {
|
|
|
|
|
svg {
|
|
|
|
|
path {
|
|
|
|
|
fill: ${Colors.POMEGRANATE};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
interface VideoComponentProps {
|
|
|
|
|
url: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const VideoComponent = (props: VideoComponentProps) => {
|
|
|
|
|
return (
|
|
|
|
|
<div onClick={e => e.stopPropagation()}>
|
|
|
|
|
<Popover
|
|
|
|
|
position={PopoverPosition.AUTO}
|
|
|
|
|
interactionKind={PopoverInteractionKind.CLICK}
|
|
|
|
|
minimal
|
|
|
|
|
usePortal
|
|
|
|
|
enforceFocus={false}
|
|
|
|
|
lazy={true}
|
|
|
|
|
modifiers={{
|
|
|
|
|
flip: {
|
|
|
|
|
behavior: ["right", "left", "bottom", "top"],
|
|
|
|
|
},
|
|
|
|
|
keepTogether: {
|
|
|
|
|
enabled: false,
|
|
|
|
|
},
|
|
|
|
|
arrow: {
|
|
|
|
|
enabled: false,
|
|
|
|
|
},
|
|
|
|
|
preventOverflow: {
|
|
|
|
|
enabled: true,
|
|
|
|
|
boundariesElement: "viewport",
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
>
|
2020-07-03 07:12:28 +00:00
|
|
|
<PlayIcon width="80" height="52" color="black" />
|
2020-06-22 13:46:19 +00:00
|
|
|
<PlayerWrapper>
|
|
|
|
|
<ReactPlayer
|
|
|
|
|
playing={true}
|
|
|
|
|
url={props.url}
|
|
|
|
|
width="100%"
|
|
|
|
|
height="100%"
|
|
|
|
|
/>
|
|
|
|
|
</PlayerWrapper>
|
|
|
|
|
</Popover>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default VideoComponent;
|