cafe-video-player 2.0.36 → 2.0.37

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 CHANGED
@@ -33,7 +33,7 @@ export default function HomePage() {
33
33
  {lang: "en", title: "انگلیسی", url: "https://hamrahi.cloud/subtitles/216-282790-6770242c63370b58ecce680d-sub_en.srt"},
34
34
  ]
35
35
  */
36
-
36
+
37
37
  };
38
38
 
39
39
  return (
@@ -148,3 +148,70 @@ images: {
148
148
  },
149
149
 
150
150
  ```
151
+ # Video HighLighter Integration Guide
152
+
153
+ This document explains how to integrate and use the **Video HighLighter** feature in a Next.js project.
154
+
155
+ ## Overview
156
+
157
+ The Video HighLighter enhances the video player with additional UI and state indicators during the download and preparation of video content. To enable it, several props must be passed to the player component.
158
+
159
+ ## Props
160
+
161
+ ### `vhl_status`
162
+ Indicates the current state of the Video HighLighter process. Accepted values:
163
+
164
+ - `Skeleton`: Shows the skeleton loading state.
165
+ - `Waiting`: Indicates the waiting period before video download begins.
166
+ - `download_start`: The download process has started.
167
+ - `download_error`: An error occurred during the download.
168
+ - `undefined`: Default value. Hides all Video HighLighter-related sections.
169
+
170
+ ### `vhl_progress`
171
+ A numeric value representing the percentage of the download progress.
172
+
173
+ ### `vhl_duration`
174
+ Total duration of the video in seconds (numeric value).
175
+
176
+ ### `vhl_statusText`
177
+ Text displayed under the progress bar while downloading the video.
178
+ For greater flexibility (e.g., multiline messages), this prop should be passed as a JSX element.
179
+
180
+ ### `vhl_onRetry`
181
+ A callback function executed if a download error occurs.
182
+
183
+ ### `banner`
184
+ An image used as the banner for the video.
185
+
186
+ ## Important Notes
187
+
188
+ After the video has been successfully downloaded, make sure to:
189
+
190
+ 1. Set the `vhl_status` to `undefined`.
191
+ 2. Pass the video `id` using the `id` prop to the player to start playback and load video details.
192
+
193
+ ---
194
+
195
+ ## 🧪 Example Usage in a Next.js Component
196
+
197
+ ```tsx
198
+ import { VideoPlayerLibrary } from "cafe-video-player";
199
+
200
+ export default function HomePage() {
201
+ const params = {
202
+ vhl_status="download_start"
203
+ vhl_progress={42}
204
+ vhl_duration={300}
205
+ vhl_statusText={<p>Downloading highlights...<br />Please wait.</p>}
206
+ vhl_onRetry={handleRetry}
207
+ banner="/images/video-banner.jpg"
208
+ id="abc123"
209
+ };
210
+
211
+ return (
212
+ <div>
213
+ <VideoPlayerLibrary params={params} />
214
+ </div>
215
+ );
216
+ }
217
+ ```
package/index.d.mts CHANGED
@@ -21,7 +21,7 @@ interface IParams {
21
21
  vhl_duration?: number;
22
22
  vhl_progress?: number;
23
23
  vhl_status?: "skeleton" | "waiting" | "download_start" | "download_complete" | "download_error";
24
- vhl_statusText?: string;
24
+ vhl_statusText?: JSX.Element;
25
25
  vhl_onRetry?: Function;
26
26
  }
27
27
  interface ISubtitle {
package/index.d.ts CHANGED
@@ -21,7 +21,7 @@ interface IParams {
21
21
  vhl_duration?: number;
22
22
  vhl_progress?: number;
23
23
  vhl_status?: "skeleton" | "waiting" | "download_start" | "download_complete" | "download_error";
24
- vhl_statusText?: string;
24
+ vhl_statusText?: JSX.Element;
25
25
  vhl_onRetry?: Function;
26
26
  }
27
27
  interface ISubtitle {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cafe-video-player",
3
- "version": "2.0.36",
3
+ "version": "2.0.37",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.cjs",