@harshit-wander/component-lib 1.0.1 → 1.1.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/dist/index.cjs +44 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +44 -27
- package/dist/index.js.map +1 -1
- package/package.json +98 -97
package/dist/index.js
CHANGED
|
@@ -276,33 +276,50 @@ EventBanner.displayName = "EventBanner";
|
|
|
276
276
|
var frameClass2 = "block w-full h-[300px] overflow-hidden rounded-md no-underline text-inherit focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2";
|
|
277
277
|
var videoClass = "block w-full h-full object-cover";
|
|
278
278
|
var EventVideoBanner = forwardRef(
|
|
279
|
-
({ posterUrl, videoUrl, alt, href, className, ...rest }, ref) =>
|
|
280
|
-
|
|
281
|
-
{
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
"
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
279
|
+
({ posterUrl, videoUrl, alt, href, className, ...rest }, ref) => {
|
|
280
|
+
const videoRef = useRef(null);
|
|
281
|
+
useEffect(() => {
|
|
282
|
+
const video = videoRef.current;
|
|
283
|
+
if (!video || !videoUrl) return;
|
|
284
|
+
if (!videoUrl.includes(".m3u8")) {
|
|
285
|
+
video.src = videoUrl;
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
if (video.canPlayType("application/vnd.apple.mpegurl")) {
|
|
289
|
+
video.src = videoUrl;
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
let cancelled = false;
|
|
293
|
+
import('hls.js').then(({ default: Hls }) => {
|
|
294
|
+
if (cancelled || !Hls.isSupported()) return;
|
|
295
|
+
const hls = new Hls({ autoStartLoad: true, startLevel: -1 });
|
|
296
|
+
hls.loadSource(videoUrl);
|
|
297
|
+
hls.attachMedia(video);
|
|
298
|
+
video._hls = hls;
|
|
299
|
+
});
|
|
300
|
+
return () => {
|
|
301
|
+
cancelled = true;
|
|
302
|
+
const stored = video._hls;
|
|
303
|
+
stored?.destroy();
|
|
304
|
+
};
|
|
305
|
+
}, [videoUrl]);
|
|
306
|
+
const videoEl = /* @__PURE__ */ jsx(
|
|
307
|
+
"video",
|
|
308
|
+
{
|
|
309
|
+
ref: videoRef,
|
|
310
|
+
src: videoUrl?.includes(".m3u8") ? void 0 : videoUrl,
|
|
311
|
+
poster: posterUrl,
|
|
312
|
+
"aria-label": alt,
|
|
313
|
+
muted: true,
|
|
314
|
+
autoPlay: true,
|
|
315
|
+
loop: true,
|
|
316
|
+
playsInline: true,
|
|
317
|
+
preload: "metadata",
|
|
318
|
+
className: videoClass
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cn("shrink-0 w-full snap-start", className), ...rest, children: href ? /* @__PURE__ */ jsx("a", { href, className: frameClass2, children: videoEl }) : /* @__PURE__ */ jsx("div", { className: frameClass2, children: videoEl }) });
|
|
322
|
+
}
|
|
306
323
|
);
|
|
307
324
|
EventVideoBanner.displayName = "EventVideoBanner";
|
|
308
325
|
var ExpandableValueCard = forwardRef(
|