Buckets:
| import React, { useEffect, useRef } from "react"; | |
| import classes from "./index.module.scss"; | |
| import { Props } from ".."; | |
| export const Video: React.FC<Props> = (props) => { | |
| const { videoClassName, resource, onClick } = props; | |
| const videoRef = useRef<HTMLVideoElement>(null); | |
| useEffect(() => { | |
| const { current: video } = videoRef; | |
| if (video) { | |
| video.addEventListener("suspend", () => { | |
| // setShowFallback(true); | |
| // console.warn('Video was suspended, rendering fallback image.') | |
| }); | |
| } | |
| }, []); | |
| if (resource && typeof resource !== "string") { | |
| const { filename } = resource; | |
| return ( | |
| <video | |
| playsInline | |
| autoPlay | |
| muted | |
| loop | |
| controls={false} | |
| className={[classes.video, videoClassName].filter(Boolean).join(" ")} | |
| onClick={onClick} | |
| ref={videoRef} | |
| > | |
| <source src={`${process.env.NEXT_PUBLIC_API_URL}/media/${filename}`} /> | |
| </video> | |
| ); | |
| } | |
| return null; | |
| }; | |
Xet Storage Details
- Size:
- 1 kB
- Xet hash:
- 753e7c338b3ce0c705f6ddfb98a33f7d6d79fa9927303e3b6ffd942d6167a0fa
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.