@clipmux/player 0.1.0 → 0.1.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/README.md +126 -116
- package/dist/index.cjs +36 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -13
- package/dist/index.js.map +1 -1
- package/package.json +49 -49
package/dist/index.js
CHANGED
|
@@ -7578,6 +7578,9 @@ function sortVideoQualities(qualities, desc) {
|
|
|
7578
7578
|
function compareVideoQualityAsc(a, b) {
|
|
7579
7579
|
return a.height === b.height ? (a.bitrate ?? 0) - (b.bitrate ?? 0) : a.height - b.height;
|
|
7580
7580
|
}
|
|
7581
|
+
function isHLSProvider(provider2) {
|
|
7582
|
+
return provider2?.$$PROVIDER_TYPE === "HLS";
|
|
7583
|
+
}
|
|
7581
7584
|
function isHTMLAudioElement(element) {
|
|
7582
7585
|
return !IS_SERVER3 && element instanceof HTMLAudioElement;
|
|
7583
7586
|
}
|
|
@@ -11987,8 +11990,8 @@ var init_vidstack_D5Pzx_k5 = __esm({
|
|
|
11987
11990
|
canGoogleCast.set(supported);
|
|
11988
11991
|
}
|
|
11989
11992
|
#watchFullscreenSupport() {
|
|
11990
|
-
const { canFullscreen } = this.$state, supported = this.#fullscreen.supported || !!this.#$provider()?.fullscreen?.supported;
|
|
11991
|
-
|
|
11993
|
+
const { canFullscreen: canFullscreen2 } = this.$state, supported = this.#fullscreen.supported || !!this.#$provider()?.fullscreen?.supported;
|
|
11994
|
+
canFullscreen2.set(supported);
|
|
11992
11995
|
}
|
|
11993
11996
|
#watchPiPSupport() {
|
|
11994
11997
|
const { canPictureInPicture } = this.$state, supported = !!this.#$provider()?.pictureInPicture?.supported;
|
|
@@ -14766,8 +14769,8 @@ var init_vidstack_D5Pzx_k5 = __esm({
|
|
|
14766
14769
|
return fullscreen();
|
|
14767
14770
|
}
|
|
14768
14771
|
#isSupported() {
|
|
14769
|
-
const { canFullscreen } = this.#media.$state;
|
|
14770
|
-
return
|
|
14772
|
+
const { canFullscreen: canFullscreen2 } = this.#media.$state;
|
|
14773
|
+
return canFullscreen2();
|
|
14771
14774
|
}
|
|
14772
14775
|
};
|
|
14773
14776
|
MuteButton = class extends Component {
|
|
@@ -18140,6 +18143,7 @@ var init_vidstack_D5Pzx_k5 = __esm({
|
|
|
18140
18143
|
|
|
18141
18144
|
// node_modules/.pnpm/@vidstack+react@1.12.13_@types+react@19.2.14_react@19.2.4/node_modules/@vidstack/react/prod/vidstack.js
|
|
18142
18145
|
init_vidstack_D5Pzx_k5();
|
|
18146
|
+
init_vidstack_D5Pzx_k5();
|
|
18143
18147
|
init_vidstack_CZgUA94N();
|
|
18144
18148
|
|
|
18145
18149
|
// node_modules/.pnpm/@vidstack+react@1.12.13_@types+react@19.2.14_react@19.2.4/node_modules/@vidstack/react/prod/chunks/vidstack-DqtDbuaC.js
|
|
@@ -20864,12 +20868,14 @@ styleInject('[data-media-player] {\n width: 100%;\n display: inline-flex;\n a
|
|
|
20864
20868
|
styleInject(".clipmux-player[data-view-type=video] {\n aspect-ratio: 16 / 9;\n}\n.clipmux-player .vds-video-layout {\n --video-brand: hsl(0, 0%, 96%);\n}\n");
|
|
20865
20869
|
var DEFAULT_ANALYTICS_URL = "https://api.clipmux.com/api/playback/journal";
|
|
20866
20870
|
var CDN_BASE = "https://delivery.clipmux.com/videos";
|
|
20871
|
+
function withToken(url, token) {
|
|
20872
|
+
if (!token || /(?:\?|&)token=/.test(url) || url.startsWith("data:") || url.startsWith("blob:")) return url;
|
|
20873
|
+
const separator = url.includes("?") ? "&" : "?";
|
|
20874
|
+
return `${url}${separator}token=${encodeURIComponent(token)}`;
|
|
20875
|
+
}
|
|
20867
20876
|
function resolveSourceUrl(props) {
|
|
20868
|
-
|
|
20869
|
-
|
|
20870
|
-
url += `${url.includes("?") ? "&" : "?"}token=${props.token}`;
|
|
20871
|
-
}
|
|
20872
|
-
return url;
|
|
20877
|
+
const url = props.src || `${CDN_BASE}/${props.playbackId}/playlist.m3u8`;
|
|
20878
|
+
return withToken(url, props.token);
|
|
20873
20879
|
}
|
|
20874
20880
|
function chaptersToVttUrl(chapters) {
|
|
20875
20881
|
let vtt = "WEBVTT\n\n";
|
|
@@ -21080,6 +21086,14 @@ function ClipMuxPlayer({
|
|
|
21080
21086
|
if (!chapters || chapters.length === 0) return null;
|
|
21081
21087
|
return chaptersToVttUrl(chapters);
|
|
21082
21088
|
}, [chapters]);
|
|
21089
|
+
const posterSrc = React8.useMemo(() => {
|
|
21090
|
+
if (!poster) return void 0;
|
|
21091
|
+
return withToken(poster, token);
|
|
21092
|
+
}, [poster, token]);
|
|
21093
|
+
const subtitlesSrc = React8.useMemo(() => {
|
|
21094
|
+
if (!subtitles) return void 0;
|
|
21095
|
+
return withToken(subtitles, token);
|
|
21096
|
+
}, [subtitles, token]);
|
|
21083
21097
|
const mergedStyle = React8.useMemo(() => {
|
|
21084
21098
|
const vars = {};
|
|
21085
21099
|
if (theme?.primaryColor) vars["--video-brand"] = theme.primaryColor;
|
|
@@ -21109,6 +21123,15 @@ function ClipMuxPlayer({
|
|
|
21109
21123
|
analytics.onError(e2?.message || "unknown");
|
|
21110
21124
|
onError?.(new Error(e2?.message || "Playback error"));
|
|
21111
21125
|
},
|
|
21126
|
+
onProviderChange: (provider2) => {
|
|
21127
|
+
if (isHLSProvider(provider2)) {
|
|
21128
|
+
provider2.config = {
|
|
21129
|
+
...provider2.config,
|
|
21130
|
+
maxBufferLength: 30,
|
|
21131
|
+
maxMaxBufferLength: 30
|
|
21132
|
+
};
|
|
21133
|
+
}
|
|
21134
|
+
},
|
|
21112
21135
|
onTimeUpdate: (detail) => {
|
|
21113
21136
|
if (playerStateRef.current) {
|
|
21114
21137
|
playerStateRef.current.currentTime = detail.currentTime;
|
|
@@ -21129,14 +21152,14 @@ function ClipMuxPlayer({
|
|
|
21129
21152
|
Poster2,
|
|
21130
21153
|
{
|
|
21131
21154
|
className: "vds-poster absolute inset-0 block h-full w-full object-cover opacity-0 transition-opacity data-[visible]:opacity-100",
|
|
21132
|
-
src:
|
|
21155
|
+
src: posterSrc,
|
|
21133
21156
|
alt: title || "Video poster"
|
|
21134
21157
|
}
|
|
21135
21158
|
),
|
|
21136
|
-
|
|
21159
|
+
subtitlesSrc && /* @__PURE__ */ jsx(
|
|
21137
21160
|
Track3,
|
|
21138
21161
|
{
|
|
21139
|
-
src:
|
|
21162
|
+
src: subtitlesSrc,
|
|
21140
21163
|
kind: "subtitles",
|
|
21141
21164
|
label: "English",
|
|
21142
21165
|
lang: "en",
|
|
@@ -21157,7 +21180,7 @@ function ClipMuxPlayer({
|
|
|
21157
21180
|
/* @__PURE__ */ jsx(
|
|
21158
21181
|
DefaultVideoLayout,
|
|
21159
21182
|
{
|
|
21160
|
-
thumbnails:
|
|
21183
|
+
thumbnails: posterSrc,
|
|
21161
21184
|
icons: defaultLayoutIcons,
|
|
21162
21185
|
menuGroup: "bottom",
|
|
21163
21186
|
smallLayoutWhen: ({ width }) => width < 520
|