react-create-html-video 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,64 @@
1
+ ![component-preview-compressed](https://github.com/user-attachments/assets/2f791123-8aa4-4118-b031-a087fcd70ebf)
2
+ ## React Create HTML Video
3
+ A lightweight React component that programmatically generates and plays an HTML `<video>` element with a clean, reusable API. This library does not rely on CSS-in-JS, with styles are intentionally kept minimal. Created with Typescript support.
4
+
5
+ ### ๐Ÿ“ฆ Installation
6
+ ```console
7
+ npm install react-create-html-video
8
+ ```
9
+
10
+ ### ๐ŸŽฒ Features
11
+ 1. Built for modern React with support for Typescript
12
+ 2. A lightweight API surface that is easy to understand
13
+ 3. Helps render a native HTML `<video>` element on the browser
14
+ 4. Provides support for MP4 and Webm based Video displays
15
+ 5. No manual CSS import is required โ€” styles are bundled with the package.
16
+
17
+ ### ๐Ÿ“„ API Type Signature
18
+ ```javascript
19
+ export type TReactCreateHTMLVideo = {
20
+ mp4: string;
21
+ webm: string;
22
+ };
23
+ ```
24
+ ### ๐Ÿค Peer Dependencies
25
+ ```javascript
26
+ "peerDependencies": {
27
+ "react": ">=17",
28
+ "react-dom": ">=17"
29
+ }
30
+ ```
31
+ ### ๐Ÿงช How This Works
32
+ 1. Detects browser support using ```HTMLVideoElement.canPlayType```
33
+ 2. Prefers MP4 if supported
34
+ 3. Falls back to WebM if MP4 is unavailable
35
+ 4. Disables video rendering on Internet Explorer
36
+ 5. Returns ```null``` when no supported format is available
37
+
38
+ ### ๐Ÿ”ค Example Usage
39
+ ```javascript
40
+ /* node modules */
41
+ import { ReactCreateHTMLVideo } from "react-create-html-video";
42
+
43
+ /* module */
44
+ function UIComponent() {
45
+ return (
46
+ {/* make sure your parent container is positioned: relative, imagine here min-height of 100vh */}
47
+ <div className="heroSection positionRelative">
48
+ <ReactCreateHTMLVideo
49
+ mp4="/path/to/mp4/video.mp4"
50
+ webm="/path/to/webm/video.webm"
51
+ />
52
+ </div>
53
+ )
54
+ }
55
+
56
+ /* exports */
57
+ export default UIComponent;
58
+ ```
59
+ ### ๐Ÿ“˜ Contributing
60
+ Contributions, suggestions, and improvements are welcome.<br/>
61
+ Feel free to open issues or pull requests.
62
+
63
+ ### โค๏ธ Support
64
+ Like this project? Support it with a github star, it would mean a lot to me! Cheers and Happy Coding.