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