@rudra-studio/rudra-media 1.0.1 → 1.0.2
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/components/CameraTest/index.d.ts +1 -0
- package/components/CameraTest/index.js +67 -0
- package/components/Image/index.d.ts +11 -0
- package/components/Image/index.js +27 -0
- package/components/StreamPlayer/index.d.ts +9 -0
- package/components/StreamPlayer/index.js +45 -0
- package/components/VideoPlayer/index.d.ts +3 -1
- package/components/VideoPlayer/index.js +49 -45
- package/hooks/useMedia.d.ts +6 -0
- package/hooks/useMedia.js +23 -0
- package/index.d.ts +13 -0
- package/index.js +11 -3
- package/package.json +2 -2
- package/utils/checkPermission.d.ts +2 -0
- package/utils/checkPermission.js +13 -0
- package/utils/createRecorder.d.ts +6 -0
- package/utils/createRecorder.js +11 -0
- package/utils/requestStream.d.ts +5 -0
- package/utils/requestStream.js +4 -0
- package/utils/stopRecorder.d.ts +5 -0
- package/utils/stopRecorder.js +6 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function CameraTest(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import e from "../StreamPlayer/index.js";
|
|
2
|
+
import t from "../../hooks/useMedia.js";
|
|
3
|
+
import { useCallback as n, useEffect as r, useState as i } from "react";
|
|
4
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/CameraTest/index.tsx
|
|
6
|
+
function s() {
|
|
7
|
+
let [s, c] = i(null), [l, u] = i("idle"), [d, f] = i(null), { start: p, stop: m, isRecording: h, recordedVideo: g } = t(s), _ = async () => {
|
|
8
|
+
u("connecting"), f(null);
|
|
9
|
+
try {
|
|
10
|
+
c(await navigator.mediaDevices.getUserMedia({
|
|
11
|
+
video: !0,
|
|
12
|
+
audio: !0
|
|
13
|
+
})), u("live");
|
|
14
|
+
} catch {
|
|
15
|
+
f("Could not access camera"), u("error");
|
|
16
|
+
}
|
|
17
|
+
}, v = n(() => {
|
|
18
|
+
s && (h && m(), s.getTracks().forEach((e) => e.stop()), c(null), u("idle"));
|
|
19
|
+
}, [
|
|
20
|
+
s,
|
|
21
|
+
h,
|
|
22
|
+
m
|
|
23
|
+
]);
|
|
24
|
+
return r(() => () => v(), [v]), /* @__PURE__ */ o("div", {
|
|
25
|
+
className: "max-w-2xl mx-auto p-4 space-y-4",
|
|
26
|
+
children: [/* @__PURE__ */ a(e, {
|
|
27
|
+
stream: s,
|
|
28
|
+
status: l,
|
|
29
|
+
overlay: /* @__PURE__ */ o("div", {
|
|
30
|
+
className: "text-white text-center p-6",
|
|
31
|
+
children: [/* @__PURE__ */ a("p", {
|
|
32
|
+
className: "font-bold",
|
|
33
|
+
children: d || "Camera is off"
|
|
34
|
+
}), l === "idle" && /* @__PURE__ */ a("button", {
|
|
35
|
+
onClick: _,
|
|
36
|
+
className: "mt-4 px-4 py-2 bg-blue-600 hover:bg-blue-700 rounded-lg text-sm font-semibold transition-colors",
|
|
37
|
+
children: "Enable Camera"
|
|
38
|
+
})]
|
|
39
|
+
}),
|
|
40
|
+
controls: l === "live" && /* @__PURE__ */ o("div", {
|
|
41
|
+
className: "flex gap-2",
|
|
42
|
+
children: [/* @__PURE__ */ a("button", {
|
|
43
|
+
onClick: h ? m : p,
|
|
44
|
+
className: `px-6 py-2 rounded-full font-bold shadow-lg transition-transform hover:scale-105 ${h ? "bg-red-500 animate-pulse" : "bg-blue-600"}`,
|
|
45
|
+
children: h ? "Stop Recording" : "Record Video"
|
|
46
|
+
}), /* @__PURE__ */ a("button", {
|
|
47
|
+
onClick: v,
|
|
48
|
+
className: "px-6 py-2 bg-slate-700 hover:bg-slate-800 text-white rounded-full font-bold shadow-lg transition-transform hover:scale-105",
|
|
49
|
+
children: "Stop Camera"
|
|
50
|
+
})]
|
|
51
|
+
})
|
|
52
|
+
}), g && /* @__PURE__ */ o("div", {
|
|
53
|
+
className: "bg-slate-800 p-4 rounded-xl text-center",
|
|
54
|
+
children: [/* @__PURE__ */ a("p", {
|
|
55
|
+
className: "text-white mb-2",
|
|
56
|
+
children: "Recording Ready:"
|
|
57
|
+
}), /* @__PURE__ */ a("a", {
|
|
58
|
+
href: g,
|
|
59
|
+
download: "video.webm",
|
|
60
|
+
className: "text-blue-400 underline",
|
|
61
|
+
children: "Download File"
|
|
62
|
+
})]
|
|
63
|
+
})]
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { s as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface OptimizedImageProps {
|
|
2
|
+
src: string;
|
|
3
|
+
alt: string;
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
aspectRatio?: 'video' | 'square' | 'portrait' | 'auto';
|
|
7
|
+
radius?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full';
|
|
8
|
+
blurPlaceholder?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export default function OptimizedImage({ src, alt, width, height, aspectRatio, radius, blurPlaceholder, className }: OptimizedImageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useState as e } from "react";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/Image/index.tsx
|
|
4
|
+
function r({ src: r, alt: i, width: a, height: o, aspectRatio: s = "auto", radius: c = "xl", blurPlaceholder: l, className: u = "" }) {
|
|
5
|
+
let [d, f] = e(!1), [p, m] = e(!1);
|
|
6
|
+
return /* @__PURE__ */ n("div", {
|
|
7
|
+
className: `relative overflow-hidden bg-slate-200 shadow-lg ${c === "none" ? "rounded-none" : `rounded-${c}`} ${s === "video" ? "aspect-video" : s === "square" ? "aspect-square" : s === "portrait" ? "aspect-[3/4]" : "aspect-auto"} ${u}`,
|
|
8
|
+
style: {
|
|
9
|
+
width: a ? `${a}px` : "100%",
|
|
10
|
+
height: o ? `${o}px` : void 0
|
|
11
|
+
},
|
|
12
|
+
children: [l && !d && /* @__PURE__ */ t("img", {
|
|
13
|
+
src: l,
|
|
14
|
+
alt: "",
|
|
15
|
+
className: "absolute inset-0 w-full h-full object-cover blur-lg scale-110"
|
|
16
|
+
}), /* @__PURE__ */ t("img", {
|
|
17
|
+
src: p ? "https://placehold.co/400x400?text=Error" : r,
|
|
18
|
+
alt: i,
|
|
19
|
+
loading: "lazy",
|
|
20
|
+
onLoad: () => f(!0),
|
|
21
|
+
onError: () => m(!0),
|
|
22
|
+
className: `w-full h-full object-cover transition-opacity duration-700 ease-in-out ${d ? "opacity-100" : "opacity-0"}`
|
|
23
|
+
})]
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { r as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface StreamPlayerProps {
|
|
3
|
+
stream: MediaStream | null;
|
|
4
|
+
status: 'idle' | 'connecting' | 'live' | 'error';
|
|
5
|
+
controls?: React.ReactNode;
|
|
6
|
+
overlay?: React.ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export default function StreamPlayer({ stream, status, controls, overlay, className }: StreamPlayerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useEffect as e, useRef as t } from "react";
|
|
2
|
+
import { AnimatePresence as n, motion as r } from "motion/react";
|
|
3
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/StreamPlayer/index.tsx
|
|
5
|
+
function o({ stream: o, status: s, controls: c, overlay: l, className: u = "" }) {
|
|
6
|
+
let d = t(null);
|
|
7
|
+
return e(() => {
|
|
8
|
+
d.current && o && (d.current.srcObject = o);
|
|
9
|
+
}, [o]), /* @__PURE__ */ a("div", {
|
|
10
|
+
className: `relative w-full aspect-video bg-slate-950 rounded-2xl overflow-hidden shadow-2xl ${u}`,
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ i("video", {
|
|
13
|
+
ref: d,
|
|
14
|
+
autoPlay: !0,
|
|
15
|
+
playsInline: !0,
|
|
16
|
+
muted: !0,
|
|
17
|
+
className: "w-full h-full object-cover"
|
|
18
|
+
}),
|
|
19
|
+
/* @__PURE__ */ i(n, {
|
|
20
|
+
mode: "wait",
|
|
21
|
+
children: s !== "live" && /* @__PURE__ */ a(r.div, {
|
|
22
|
+
initial: { opacity: 0 },
|
|
23
|
+
animate: { opacity: 1 },
|
|
24
|
+
exit: { opacity: 0 },
|
|
25
|
+
className: "absolute inset-0 flex items-center justify-center bg-slate-950/80 backdrop-blur-sm z-10",
|
|
26
|
+
children: [s === "connecting" && /* @__PURE__ */ i(r.div, {
|
|
27
|
+
animate: { rotate: 360 },
|
|
28
|
+
transition: {
|
|
29
|
+
repeat: Infinity,
|
|
30
|
+
duration: 1,
|
|
31
|
+
ease: "linear"
|
|
32
|
+
},
|
|
33
|
+
className: "w-12 h-12 border-4 border-white/20 border-t-blue-500 rounded-full"
|
|
34
|
+
}), l]
|
|
35
|
+
}, s)
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ i("div", {
|
|
38
|
+
className: "absolute bottom-4 left-0 right-0 z-20 flex justify-center px-4",
|
|
39
|
+
children: c
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { o as default };
|
|
@@ -4,7 +4,9 @@ export interface VideoPlayerProps {
|
|
|
4
4
|
autoPlay?: boolean;
|
|
5
5
|
loop?: boolean;
|
|
6
6
|
muted?: boolean;
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
7
9
|
aspectRatio?: 'video' | 'square' | 'auto';
|
|
8
10
|
radius?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full';
|
|
9
11
|
}
|
|
10
|
-
export default function VideoPlayer({ url, controls, autoPlay, loop, muted, aspectRatio, radius }: VideoPlayerProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default function VideoPlayer({ url, controls, autoPlay, loop, muted, aspectRatio, radius, width, height }: VideoPlayerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,56 +1,60 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import { jsx as e } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/VideoPlayer/index.tsx
|
|
4
|
-
function t({ url: t = "https://www.youtube.com/watch?v=dQw4w9WgXcQ", controls: n = !0, autoPlay: r = !1, loop: i = !1, muted: a = !1, aspectRatio: o = "video", radius: s = "xl" }) {
|
|
5
|
-
let
|
|
4
|
+
function t({ url: t = "https://www.youtube.com/watch?v=dQw4w9WgXcQ", controls: n = !0, autoPlay: r = !1, loop: i = !1, muted: a = !1, aspectRatio: o = "video", radius: s = "xl", width: c, height: l }) {
|
|
5
|
+
let u = s === "none" ? "rounded-none" : `rounded-${s}`, d = o === "video" ? "aspect-video" : o === "square" ? "aspect-square" : "aspect-auto", f = (e) => {
|
|
6
6
|
let t = e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);
|
|
7
7
|
return t && t[2].length === 11 ? t[2] : null;
|
|
8
|
-
},
|
|
8
|
+
}, p = (e) => {
|
|
9
9
|
let t = e.match(/vimeo\.com\/(?:.*#|.*\/videos\/)?([0-9]+)/);
|
|
10
10
|
return t ? t[1] : null;
|
|
11
|
-
},
|
|
11
|
+
}, m = f(t), h = m ? null : p(t);
|
|
12
12
|
return /* @__PURE__ */ e("div", {
|
|
13
|
-
className: `relative
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
13
|
+
className: `relative overflow-hidden bg-slate-900 shadow-lg flex items-center justify-center
|
|
14
|
+
${u} ${d}
|
|
15
|
+
${c ? "" : "min-w-[320px]"} w-full`,
|
|
16
|
+
style: {
|
|
17
|
+
width: c ? `${c}px` : void 0,
|
|
18
|
+
height: l ? `${l}px` : void 0
|
|
19
|
+
},
|
|
20
|
+
children: m ? /* @__PURE__ */ e("iframe", {
|
|
21
|
+
src: `https://www.youtube.com/embed/${m}?${new URLSearchParams({
|
|
22
|
+
controls: n ? "1" : "0",
|
|
23
|
+
autoplay: r ? "1" : "0",
|
|
24
|
+
mute: a || r ? "1" : "0",
|
|
25
|
+
playsinline: "1",
|
|
26
|
+
...i && {
|
|
27
|
+
loop: "1",
|
|
28
|
+
playlist: m
|
|
29
|
+
}
|
|
30
|
+
}).toString()}`,
|
|
31
|
+
title: "YouTube video player",
|
|
32
|
+
frameBorder: "0",
|
|
33
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
34
|
+
allowFullScreen: !0,
|
|
35
|
+
className: "absolute inset-0 w-full h-full"
|
|
36
|
+
}) : h ? /* @__PURE__ */ e("iframe", {
|
|
37
|
+
src: `https://player.vimeo.com/video/${h}?${new URLSearchParams({
|
|
38
|
+
autoplay: r ? "1" : "0",
|
|
39
|
+
loop: i ? "1" : "0",
|
|
40
|
+
muted: a || r ? "1" : "0",
|
|
41
|
+
controls: n ? "1" : "0",
|
|
42
|
+
dnt: "1"
|
|
43
|
+
}).toString()}`,
|
|
44
|
+
title: "Vimeo video player",
|
|
45
|
+
frameBorder: "0",
|
|
46
|
+
allow: "autoplay; fullscreen; picture-in-picture",
|
|
47
|
+
allowFullScreen: !0,
|
|
48
|
+
className: "absolute inset-0 w-full h-full"
|
|
49
|
+
}) : /* @__PURE__ */ e("video", {
|
|
50
|
+
src: t,
|
|
51
|
+
controls: n,
|
|
52
|
+
autoPlay: r,
|
|
53
|
+
loop: i,
|
|
54
|
+
muted: a || r,
|
|
55
|
+
playsInline: !0,
|
|
56
|
+
className: "absolute inset-0 w-full h-full object-cover bg-black"
|
|
57
|
+
})
|
|
54
58
|
});
|
|
55
59
|
}
|
|
56
60
|
//#endregion
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import e from "../utils/createRecorder.js";
|
|
2
|
+
import t from "../utils/stopRecorder.js";
|
|
3
|
+
import { useState as n } from "react";
|
|
4
|
+
//#region src/hooks/useMedia.ts
|
|
5
|
+
var r = (r) => {
|
|
6
|
+
let [i, a] = n(null);
|
|
7
|
+
return {
|
|
8
|
+
start: (t) => {
|
|
9
|
+
if (!r) return;
|
|
10
|
+
let n = e({
|
|
11
|
+
stream: r,
|
|
12
|
+
onComplete: t
|
|
13
|
+
});
|
|
14
|
+
n.start(), a(n);
|
|
15
|
+
},
|
|
16
|
+
stop: () => {
|
|
17
|
+
i && t({ recorder: i });
|
|
18
|
+
},
|
|
19
|
+
isRecording: !!i
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { r as default };
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
export { default as CameraTest } from './components/CameraTest';
|
|
2
|
+
export type { OptimizedImageProps } from './components/Image';
|
|
3
|
+
export { default as OptimizedImage } from './components/Image';
|
|
4
|
+
export type { StreamPlayerProps } from './components/StreamPlayer';
|
|
5
|
+
export { default as StreamPlayer } from './components/StreamPlayer';
|
|
1
6
|
export type { VideoPlayerProps } from './components/VideoPlayer';
|
|
2
7
|
export { default as VideoPlayer } from './components/VideoPlayer';
|
|
8
|
+
export { default as useMediaRecorder } from './hooks/useMedia';
|
|
9
|
+
export { default as checkPermissions } from './utils/checkPermission';
|
|
10
|
+
export type { createRecorderProps } from './utils/createRecorder';
|
|
11
|
+
export { default as createRecorder } from './utils/createRecorder';
|
|
12
|
+
export type { requestStreamProps } from './utils/requestStream';
|
|
13
|
+
export { default as requestStream } from './utils/requestStream';
|
|
14
|
+
export type { stopRecorderProps } from './utils/stopRecorder';
|
|
15
|
+
export { default as stopRecorder } from './utils/stopRecorder';
|
package/index.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
-
import e from "./components/
|
|
3
|
-
|
|
2
|
+
import e from "./components/StreamPlayer/index.js";
|
|
3
|
+
import t from "./utils/createRecorder.js";
|
|
4
|
+
import n from "./utils/stopRecorder.js";
|
|
5
|
+
import r from "./hooks/useMedia.js";
|
|
6
|
+
import i from "./components/CameraTest/index.js";
|
|
7
|
+
import a from "./components/Image/index.js";
|
|
8
|
+
import o from "./components/VideoPlayer/index.js";
|
|
9
|
+
import s from "./utils/checkPermission.js";
|
|
10
|
+
import c from "./utils/requestStream.js";
|
|
11
|
+
export { i as CameraTest, a as OptimizedImage, e as StreamPlayer, o as VideoPlayer, s as checkPermissions, t as createRecorder, c as requestStream, n as stopRecorder, r as useMediaRecorder };
|
|
4
12
|
|
|
5
|
-
try{if(typeof document!=="undefined"){const e=document.createElement("style");e.textContent="*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content:\"\"}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.absolute{position:absolute}.relative{position:relative}.left-0{left:0}.
|
|
13
|
+
try{if(typeof document!=="undefined"){const e=document.createElement("style");e.textContent="*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content:\"\"}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.bottom-4{bottom:1rem}.left-0{left:0}.right-0{right:0}.z-10{z-index:10}.z-20{z-index:20}.mx-auto{margin-left:auto;margin-right:auto}.mb-2{margin-bottom:.5rem}.mt-4{margin-top:1rem}.flex{display:flex}.aspect-\\[3\\/4\\]{aspect-ratio:3/4}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1}.aspect-video{aspect-ratio:16/9}.h-12{height:3rem}.h-full{height:100%}.w-12{width:3rem}.w-full{width:100%}.min-w-\\[320px\\]{min-width:320px}.max-w-2xl{max-width:42rem}.scale-110{--tw-scale-x:1.1;--tw-scale-y:1.1;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:2s cubic-bezier(.4,0,.6,1) infinite pulse}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:.5rem}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-none{border-radius:0}.rounded-xl{border-radius:.75rem}.border-4{border-width:4px}.border-white\\/20{border-color:#fff3}.border-t-blue-500{--tw-border-opacity:1;border-top-color:rgb(59 130 246/var(--tw-border-opacity))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.bg-slate-200{--tw-bg-opacity:1;background-color:rgb(226 232 240/var(--tw-bg-opacity))}.bg-slate-700{--tw-bg-opacity:1;background-color:rgb(51 65 85/var(--tw-bg-opacity))}.bg-slate-800{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity))}.bg-slate-900{--tw-bg-opacity:1;background-color:rgb(15 23 42/var(--tw-bg-opacity))}.bg-slate-950{--tw-bg-opacity:1;background-color:rgb(2 6 23/var(--tw-bg-opacity))}.bg-slate-950\\/80{background-color:#020617cc}.object-cover{-o-object-fit:cover;object-fit:cover}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.text-center{text-align:center}.text-sm{font-size:.875rem;line-height:1.25rem}.font-bold{font-weight:700}.font-semibold{font-weight:600}.text-blue-400{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow-2xl{--tw-shadow:0 25px 50px -12px #00000040;--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.blur-lg{--tw-blur:blur(16px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-property:transform;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-700{transition-duration:.7s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\\:scale-105:hover{--tw-scale-x:1.05;--tw-scale-y:1.05;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity))}.hover\\:bg-slate-800:hover{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity))}";const target = window.__RUDRA_SHADOW_ROOT__ || document.head; target.appendChild(e);}}catch(err){}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
3
|
"@react-three/fiber": "9.6.1",
|
|
4
|
-
"gsap": "3.12.
|
|
4
|
+
"gsap": "3.12.5",
|
|
5
5
|
"lucide-react": "^1.8.0",
|
|
6
6
|
"motion": "12.0.0",
|
|
7
7
|
"react-player": "latest",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
},
|
|
43
43
|
"types": "./index.d.ts",
|
|
44
44
|
"unpkg": "./index.umd.js",
|
|
45
|
-
"version": "1.0.
|
|
45
|
+
"version": "1.0.2"
|
|
46
46
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/utils/checkPermission.ts
|
|
2
|
+
var e = async () => {
|
|
3
|
+
try {
|
|
4
|
+
return (await navigator.mediaDevices.getUserMedia({
|
|
5
|
+
video: !0,
|
|
6
|
+
audio: !0
|
|
7
|
+
})).getTracks().forEach((e) => e.stop()), !0;
|
|
8
|
+
} catch {
|
|
9
|
+
return !1;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/utils/createRecorder.ts
|
|
2
|
+
var e = (e, t) => {
|
|
3
|
+
let n = [], r = new MediaRecorder(e, { mimeType: "video/webm" });
|
|
4
|
+
return r.ondataavailable = (e) => {
|
|
5
|
+
e.data.size > 0 && n.push(e.data);
|
|
6
|
+
}, r.onstop = () => {
|
|
7
|
+
t(new Blob(n, { type: "video/webm" }));
|
|
8
|
+
}, r;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { e as default };
|