onedrive/components/previews/VideoPreview.tsx

27 lines
774 B
TypeScript
Raw Normal View History

2021-06-24 13:54:59 +00:00
import { FunctionComponent } from 'react'
import ReactPlayer from 'react-player'
2021-06-25 14:15:00 +00:00
import DownloadBtn from '../DownloadBtn'
2021-06-24 13:54:59 +00:00
export const VideoPreview: FunctionComponent<{ file: any }> = ({ file }) => {
return (
2021-06-25 14:15:00 +00:00
<>
<div className="bg-white rounded shadow p-3">
<div className="relative" style={{ paddingTop: '56.25%' }}>
<ReactPlayer
className="absolute top-0 left-0 w-full h-full"
url={file['@microsoft.graph.downloadUrl']}
controls
width="100%"
height="100%"
config={{ file: { forceVideo: true } }}
/>
</div>
</div>
<div className="mt-4">
<DownloadBtn downloadUrl={file['@microsoft.graph.downloadUrl']} />
2021-06-24 13:54:59 +00:00
</div>
2021-06-25 14:15:00 +00:00
</>
2021-06-24 13:54:59 +00:00
)
}