```tsx "use client"; import { useRef } from "react"; import { Cloudinary } from "@cloudinary/url-gen"; import { AdvancedVideo, AdvancedImage, lazyload, accessibility, } from "@cloudinary/react"; import { crop } from "@cloudinary/url-gen/actions/resize"; interface props { publicId: string; poster: string; height?: number | string; width?: number | string; controls: boolean; loop?: boolean; autoplay: boolean; muted: boolean; playsInline?: boolean; alt?: string; } const cld = new Cloudinary({ cloud: { cloudName: "your-cloudinary-cloudname" }, }); export default function MediaComponent({ publicId, poster, controls, loop, autoplay, muted, width, height, playsInline, alt, }: props) { const playerRef = useRef(); let shouldPlayVideo; const videoLoaded = function () { shouldPlayVideo = true; if (shouldPlayVideo) { playerRef.current.videoRef.current?.play(); } }; const pauseVideo = function () { playerRef.current.videoRef.current?.pause(); playerRef.current.videoRef.current?.load(); }; return (
); } ``` ## Example Usage ```tsx const reels: CloudinaryType[] = await getMedia("reels"); ```