react-create-html-video 1.1.0 โ†’ 1.3.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sricharan Krishnan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,13 +1,20 @@
1
1
  ![component-preview-compressed](https://github.com/user-attachments/assets/2f791123-8aa4-4118-b031-a087fcd70ebf)
2
+ ![npm](https://img.shields.io/npm/v/react-create-html-video)
3
+ ![downloads](https://img.shields.io/npm/dw/react-create-html-video)
4
+ ![license](https://img.shields.io/npm/l/react-create-html-video)
5
+
2
6
  ## React Create HTML Video
7
+
3
8
  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
9
 
5
10
  ### ๐Ÿ“ฆ Installation
11
+
6
12
  ```console
7
13
  npm install react-create-html-video
8
14
  ```
9
15
 
10
16
  ### ๐ŸŽฒ Features
17
+
11
18
  1. Built for modern React with support for Typescript
12
19
  2. A lightweight API surface that is easy to understand
13
20
  3. Helps render a native HTML `<video>` element on the browser
@@ -15,27 +22,33 @@ npm install react-create-html-video
15
22
  5. No manual CSS import is required โ€” styles are bundled with the package.
16
23
 
17
24
  ### ๐Ÿ“„ API Type Signature
25
+
18
26
  ```javascript
19
27
  export type TReactCreateHTMLVideo = {
20
28
  mp4: string;
21
29
  webm: string;
22
30
  };
23
31
  ```
32
+
24
33
  ### ๐Ÿค Peer Dependencies
34
+
25
35
  ```javascript
26
36
  "peerDependencies": {
27
37
  "react": ">=17",
28
38
  "react-dom": ">=17"
29
39
  }
30
40
  ```
41
+
31
42
  ### ๐Ÿงช How This Works
32
- 1. Detects browser support using ```HTMLVideoElement.canPlayType```
43
+
44
+ 1. Detects browser support using `HTMLVideoElement.canPlayType`
33
45
  2. Prefers MP4 if supported
34
46
  3. Falls back to WebM if MP4 is unavailable
35
47
  4. Disables video rendering on Internet Explorer
36
- 5. Returns ```null``` when no supported format is available
48
+ 5. Returns `null` when no supported format is available
37
49
 
38
50
  ### ๐Ÿ”ค Example Usage
51
+
39
52
  ```javascript
40
53
  /* node modules */
41
54
  import { ReactCreateHTMLVideo } from "react-create-html-video";
@@ -56,9 +69,38 @@ function UIComponent() {
56
69
  /* exports */
57
70
  export default UIComponent;
58
71
  ```
72
+
73
+ ### ๐Ÿ“— Test Coverage
74
+
75
+ ```
76
+ PASS src/video-component/test/index.test.tsx
77
+ RCHV Test Suite:
78
+ โœ“ renders null when videoSource is null
79
+ โœ“ renders video container when videoSource is provided
80
+ โœ“ renders video element with correct attributes
81
+ โœ“ sets video src to the videoSource from useVideo hook
82
+ โœ“ passes correct props to useVideo hook
83
+ โœ“ memoizes component and does not re-render with same props
84
+ โœ“ renders video element inside parent container
85
+ โœ“ updates when videoSource changes
86
+ โœ“ returns null when videoSource is falsy
87
+ โœ“ renders only one video element
88
+ ```
89
+
90
+ ```
91
+ -----------|---------|----------|---------|---------|-------------------
92
+ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
93
+ -----------|---------|----------|---------|---------|-------------------
94
+ All files | 100 | 100 | 100 | 100 |
95
+ index.tsx | 100 | 100 | 100 | 100 |
96
+ -----------|---------|----------|---------|---------|-------------------
97
+ ```
98
+
59
99
  ### ๐Ÿ“˜ Contributing
100
+
60
101
  Contributions, suggestions, and improvements are welcome.<br/>
61
102
  Feel free to open issues or pull requests.
62
103
 
63
104
  ### โค๏ธ Support
105
+
64
106
  Like this project? Support it with a github star, it would mean a lot to me! Cheers and Happy Coding.