PluginProbe
Extendify / 2.2.0
Extendify v2.2.0
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / PageCreator / components / content / VideoPlayer.jsx

VideoPlayer.jsx in Extendify 2.2.0, at src/PageCreator/components/content/VideoPlayer.jsx

31 lines 768 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { useRef, useState } from 'react';
2
3 export const VideoPlayer = ({ path, poster, className = null }) => {
4 const videoRef = useRef();
5 const [playing, setPlaying] = useState(false);
6 return (
7 <div
8 className={`relative ${className}`}
9 style={{
10 backgroundImage: !playing ? `url(${poster})` : 'none',
11 backgroundSize: 'contain',
12 backgroundPosition: 'center',
13 backgroundRepeat: 'no-repeat',
14 }}>
15 <video
16 ref={videoRef}
17 id="video-player"
18 className="h-auto max-h-[min(50vh,400px)] w-full object-contain"
19 playsInline
20 muted
21 autoPlay
22 poster={poster}
23 loop
24 onPlay={() => setPlaying(true)}>
25 <source src={path} type="video/webm" />
26 Your browser does not support the video tag.
27 </video>
28 </div>
29 );
30 };
31