@hanifhan1f/vidstack-react 1.12.24 → 1.12.25
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/dev/chunks/vidstack-BNwnoM-l.js +84 -0
- package/dev/chunks/vidstack-BOPSNTgH.js +668 -0
- package/dev/chunks/vidstack-BSZY6sbC.js +180 -0
- package/dev/chunks/vidstack-BVVxkUlq.js +288 -0
- package/dev/chunks/vidstack-BXgKy_7V.js +11693 -0
- package/dev/chunks/vidstack-BrqDQG-r.js +643 -0
- package/dev/chunks/vidstack-C3QPOZNd.js +476 -0
- package/dev/chunks/vidstack-C7BwfK5c.js +1537 -0
- package/dev/chunks/vidstack-CEUjDh4x.js +34 -0
- package/dev/chunks/vidstack-CQSHFVu7.js +401 -0
- package/dev/chunks/vidstack-Csfg08VS.js +551 -0
- package/dev/chunks/vidstack-DTow20pt.js +189 -0
- package/dev/chunks/vidstack-L5mw2iPb.js +375 -0
- package/dev/chunks/vidstack-iRuTLfhk.js +61 -0
- package/dev/player/vidstack-default-components.js +5 -5
- package/dev/player/vidstack-default-layout.js +5 -5
- package/dev/player/vidstack-plyr-layout.js +4 -4
- package/dev/player/vidstack-remotion.js +3 -3
- package/dev/vidstack.js +7 -7
- package/package.json +1 -1
- package/prod/chunks/vidstack-58ZavMvv.js +159 -0
- package/prod/chunks/vidstack-BS445j5D.js +84 -0
- package/prod/chunks/vidstack-B_9VGrZQ.js +504 -0
- package/prod/chunks/vidstack-Bm2UemPE.js +470 -0
- package/prod/chunks/vidstack-Bp_hAwzI.js +61 -0
- package/prod/chunks/vidstack-CQll06Hv.js +34 -0
- package/prod/chunks/vidstack-D3cSYtez.js +663 -0
- package/prod/chunks/vidstack-D_ijTIbV.js +11198 -0
- package/prod/chunks/vidstack-DgGDsAKh.js +375 -0
- package/prod/chunks/vidstack-DrEorv9m.js +189 -0
- package/prod/chunks/vidstack-ehqxnvc9.js +1537 -0
- package/prod/chunks/vidstack-lc8NHly9.js +288 -0
- package/prod/chunks/vidstack-rKV98aQH.js +545 -0
- package/prod/chunks/vidstack-uA7h-Bsq.js +386 -0
- package/prod/player/vidstack-default-components.js +5 -5
- package/prod/player/vidstack-default-layout.js +5 -5
- package/prod/player/vidstack-plyr-layout.js +4 -4
- package/prod/player/vidstack-remotion.js +3 -3
- package/prod/vidstack.js +7 -7
- package/server/chunks/vidstack-B3AXUfgF.js +189 -0
- package/server/chunks/vidstack-BJCx78pm.js +386 -0
- package/server/chunks/vidstack-BtitkRvR.js +11198 -0
- package/server/chunks/vidstack-BweZhuNd.js +1537 -0
- package/server/chunks/vidstack-CSiPajWY.js +470 -0
- package/server/chunks/vidstack-CgXa6YO3.js +61 -0
- package/server/chunks/vidstack-DH6N0AoF.js +375 -0
- package/server/chunks/vidstack-DKr7br9D.js +34 -0
- package/server/chunks/vidstack-Dbs_rXUT.js +663 -0
- package/server/chunks/vidstack-E7eUOyFt.js +288 -0
- package/server/chunks/vidstack-JkJEYEQM.js +159 -0
- package/server/chunks/vidstack-KhtuR229.js +504 -0
- package/server/chunks/vidstack-X1Hex9PH.js +84 -0
- package/server/chunks/vidstack-yf18YVAb.js +545 -0
- package/server/player/vidstack-default-components.js +5 -5
- package/server/player/vidstack-default-layout.js +5 -5
- package/server/player/vidstack-plyr-layout.js +4 -4
- package/server/player/vidstack-remotion.js +3 -3
- package/server/vidstack.js +7 -7
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { RadioGroupController, useMediaContext, menuContext, MediaRemoteControl, MediaPlayerInstance, sortVideoQualities } from './vidstack-BXgKy_7V.js';
|
|
5
|
+
import { useMediaContext as useMediaContext$1 } from './vidstack-BOPSNTgH.js';
|
|
6
|
+
import { prop, method, Component, hasProvidedContext, useContext, effect, useSignal, isString } from './vidstack-D_bWd66h.js';
|
|
7
|
+
|
|
8
|
+
const DEFAULT_PLAYBACK_RATES = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
|
|
9
|
+
class SpeedRadioGroup extends Component {
|
|
10
|
+
static props = {
|
|
11
|
+
normalLabel: "Normal",
|
|
12
|
+
rates: DEFAULT_PLAYBACK_RATES
|
|
13
|
+
};
|
|
14
|
+
#media;
|
|
15
|
+
#menu;
|
|
16
|
+
#controller;
|
|
17
|
+
get value() {
|
|
18
|
+
return this.#controller.value;
|
|
19
|
+
}
|
|
20
|
+
get disabled() {
|
|
21
|
+
const { rates } = this.$props, { canSetPlaybackRate } = this.#media.$state;
|
|
22
|
+
return !canSetPlaybackRate() || rates().length === 0;
|
|
23
|
+
}
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
this.#controller = new RadioGroupController();
|
|
27
|
+
this.#controller.onValueChange = this.#onValueChange.bind(this);
|
|
28
|
+
}
|
|
29
|
+
onSetup() {
|
|
30
|
+
this.#media = useMediaContext();
|
|
31
|
+
if (hasProvidedContext(menuContext)) {
|
|
32
|
+
this.#menu = useContext(menuContext);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
onConnect(el) {
|
|
36
|
+
effect(this.#watchValue.bind(this));
|
|
37
|
+
effect(this.#watchHintText.bind(this));
|
|
38
|
+
effect(this.#watchControllerDisabled.bind(this));
|
|
39
|
+
}
|
|
40
|
+
getOptions() {
|
|
41
|
+
const { rates, normalLabel } = this.$props;
|
|
42
|
+
return rates().map((rate) => ({
|
|
43
|
+
label: rate === 1 ? normalLabel : rate + "\xD7",
|
|
44
|
+
value: rate.toString()
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
#watchValue() {
|
|
48
|
+
this.#controller.value = this.#getValue();
|
|
49
|
+
}
|
|
50
|
+
#watchHintText() {
|
|
51
|
+
const { normalLabel } = this.$props, { playbackRate } = this.#media.$state, rate = playbackRate();
|
|
52
|
+
this.#menu?.hint.set(rate === 1 ? normalLabel() : rate + "\xD7");
|
|
53
|
+
}
|
|
54
|
+
#watchControllerDisabled() {
|
|
55
|
+
this.#menu?.disable(this.disabled);
|
|
56
|
+
}
|
|
57
|
+
#getValue() {
|
|
58
|
+
const { playbackRate } = this.#media.$state;
|
|
59
|
+
return playbackRate().toString();
|
|
60
|
+
}
|
|
61
|
+
#onValueChange(value, trigger) {
|
|
62
|
+
if (this.disabled) return;
|
|
63
|
+
const rate = +value;
|
|
64
|
+
this.#media.remote.changePlaybackRate(rate, trigger);
|
|
65
|
+
this.dispatch("change", { detail: rate, trigger });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const speedradiogroup__proto = SpeedRadioGroup.prototype;
|
|
69
|
+
prop(speedradiogroup__proto, "value");
|
|
70
|
+
prop(speedradiogroup__proto, "disabled");
|
|
71
|
+
method(speedradiogroup__proto, "getOptions");
|
|
72
|
+
|
|
73
|
+
function useMediaRemote(target) {
|
|
74
|
+
const media = useMediaContext$1(), remote = React.useRef(null);
|
|
75
|
+
if (!remote.current) {
|
|
76
|
+
remote.current = new MediaRemoteControl();
|
|
77
|
+
}
|
|
78
|
+
React.useEffect(() => {
|
|
79
|
+
const ref = target && "current" in target ? target.current : target, isPlayerRef = ref instanceof MediaPlayerInstance, player = isPlayerRef ? ref : media?.player;
|
|
80
|
+
remote.current.setPlayer(player ?? null);
|
|
81
|
+
remote.current.setTarget(ref ?? null);
|
|
82
|
+
}, [media, target && "current" in target ? target.current : target]);
|
|
83
|
+
return remote.current;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function useVideoQualityOptions({
|
|
87
|
+
auto = true,
|
|
88
|
+
sort = "descending"
|
|
89
|
+
} = {}) {
|
|
90
|
+
const media = useMediaContext$1(), { qualities, quality, autoQuality, canSetQuality } = media.$state, $qualities = useSignal(qualities);
|
|
91
|
+
useSignal(quality);
|
|
92
|
+
useSignal(autoQuality);
|
|
93
|
+
useSignal(canSetQuality);
|
|
94
|
+
return React.useMemo(() => {
|
|
95
|
+
const sortedQualities = sortVideoQualities($qualities, sort === "descending"), options = sortedQualities.map((q) => {
|
|
96
|
+
return {
|
|
97
|
+
quality: q,
|
|
98
|
+
label: q.height + "p",
|
|
99
|
+
value: getQualityValue(q),
|
|
100
|
+
bitrateText: q.bitrate && q.bitrate > 0 ? `${(q.bitrate / 1e6).toFixed(2)} Mbps` : null,
|
|
101
|
+
get selected() {
|
|
102
|
+
return q === quality();
|
|
103
|
+
},
|
|
104
|
+
get autoSelected() {
|
|
105
|
+
return autoQuality();
|
|
106
|
+
},
|
|
107
|
+
select(trigger) {
|
|
108
|
+
const index = qualities().indexOf(q);
|
|
109
|
+
if (index >= 0) media.remote.changeQuality(index, trigger);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
if (auto) {
|
|
114
|
+
options.unshift({
|
|
115
|
+
quality: null,
|
|
116
|
+
label: isString(auto) ? auto : "Auto",
|
|
117
|
+
value: "auto",
|
|
118
|
+
bitrateText: null,
|
|
119
|
+
get selected() {
|
|
120
|
+
return autoQuality();
|
|
121
|
+
},
|
|
122
|
+
get autoSelected() {
|
|
123
|
+
return autoQuality();
|
|
124
|
+
},
|
|
125
|
+
select(trigger) {
|
|
126
|
+
media.remote.requestAutoQuality(trigger);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
Object.defineProperty(options, "disabled", {
|
|
131
|
+
get() {
|
|
132
|
+
return !canSetQuality() || $qualities.length <= 1;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
Object.defineProperty(options, "selectedQuality", {
|
|
136
|
+
get() {
|
|
137
|
+
return quality();
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
Object.defineProperty(options, "selectedValue", {
|
|
141
|
+
get() {
|
|
142
|
+
const $quality = quality();
|
|
143
|
+
return !autoQuality() && $quality ? getQualityValue($quality) : "auto";
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
return options;
|
|
147
|
+
}, [$qualities, sort]);
|
|
148
|
+
}
|
|
149
|
+
function getQualityValue(quality) {
|
|
150
|
+
return quality.height + "_" + quality.bitrate;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function usePlaybackRateOptions({
|
|
154
|
+
rates = DEFAULT_PLAYBACK_RATES,
|
|
155
|
+
normalLabel = "Normal"
|
|
156
|
+
} = {}) {
|
|
157
|
+
const media = useMediaContext$1(), { playbackRate, canSetPlaybackRate } = media.$state;
|
|
158
|
+
useSignal(playbackRate);
|
|
159
|
+
useSignal(canSetPlaybackRate);
|
|
160
|
+
return React.useMemo(() => {
|
|
161
|
+
const options = rates.map((opt) => {
|
|
162
|
+
const label = typeof opt === "number" ? opt === 1 && normalLabel ? normalLabel : opt + "x" : opt.label, rate = typeof opt === "number" ? opt : opt.rate;
|
|
163
|
+
return {
|
|
164
|
+
label,
|
|
165
|
+
value: rate.toString(),
|
|
166
|
+
rate,
|
|
167
|
+
get selected() {
|
|
168
|
+
return playbackRate() === rate;
|
|
169
|
+
},
|
|
170
|
+
select(trigger) {
|
|
171
|
+
media.remote.changePlaybackRate(rate, trigger);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
});
|
|
175
|
+
Object.defineProperty(options, "disabled", {
|
|
176
|
+
get() {
|
|
177
|
+
return !canSetPlaybackRate() || !options.length;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
Object.defineProperty(options, "selectedValue", {
|
|
181
|
+
get() {
|
|
182
|
+
return playbackRate().toString();
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
return options;
|
|
186
|
+
}, [rates]);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export { DEFAULT_PLAYBACK_RATES, useMediaRemote, usePlaybackRateOptions, useVideoQualityOptions };
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { createReactComponent, composeRefs, listenEvent, useReactScope, scoped, computed, signal, effect, EventsController, useSignal } from './vidstack-D_bWd66h.js';
|
|
5
|
+
import { MediaAnnouncerInstance, Primitive, ControlsInstance, ControlsGroupInstance, TooltipInstance, TooltipTriggerInstance, TooltipContentInstance, GoogleCastButtonInstance, QualitySliderInstance, AudioGainSliderInstance, SpeedSliderInstance, useMediaState, watchActiveTextTrack, CaptionsInstance, formatSpokenTime, formatTime } from './vidstack-BXgKy_7V.js';
|
|
6
|
+
import { sliderCallbacks, Preview, Steps, Thumb, Track as Track$1, TrackFill as TrackFill$1, Value, useMediaContext } from './vidstack-BOPSNTgH.js';
|
|
7
|
+
|
|
8
|
+
const MediaAnnouncerBridge = createReactComponent(MediaAnnouncerInstance, {
|
|
9
|
+
events: ["onChange"]
|
|
10
|
+
});
|
|
11
|
+
const MediaAnnouncer = React.forwardRef(
|
|
12
|
+
({ style, children, ...props }, forwardRef) => {
|
|
13
|
+
return /* @__PURE__ */ React.createElement(MediaAnnouncerBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
|
|
14
|
+
Primitive.div,
|
|
15
|
+
{
|
|
16
|
+
...props2,
|
|
17
|
+
style: { display: "contents", ...style },
|
|
18
|
+
ref: composeRefs(props2.ref, forwardRef)
|
|
19
|
+
},
|
|
20
|
+
children
|
|
21
|
+
));
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
MediaAnnouncer.displayName = "MediaAnnouncer";
|
|
25
|
+
|
|
26
|
+
const ControlsBridge = createReactComponent(ControlsInstance);
|
|
27
|
+
const Root$5 = React.forwardRef(({ children, ...props }, forwardRef) => {
|
|
28
|
+
return /* @__PURE__ */ React.createElement(ControlsBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
|
|
29
|
+
Primitive.div,
|
|
30
|
+
{
|
|
31
|
+
...props2,
|
|
32
|
+
ref: composeRefs(props2.ref, forwardRef)
|
|
33
|
+
},
|
|
34
|
+
children
|
|
35
|
+
));
|
|
36
|
+
});
|
|
37
|
+
Root$5.displayName = "Controls";
|
|
38
|
+
const ControlsGroupBridge = createReactComponent(ControlsGroupInstance);
|
|
39
|
+
const Group = React.forwardRef(({ children, ...props }, forwardRef) => {
|
|
40
|
+
return /* @__PURE__ */ React.createElement(ControlsGroupBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
|
|
41
|
+
Primitive.div,
|
|
42
|
+
{
|
|
43
|
+
...props2,
|
|
44
|
+
ref: composeRefs(props2.ref, forwardRef)
|
|
45
|
+
},
|
|
46
|
+
children
|
|
47
|
+
));
|
|
48
|
+
});
|
|
49
|
+
Group.displayName = "ControlsGroup";
|
|
50
|
+
|
|
51
|
+
var controls = /*#__PURE__*/Object.freeze({
|
|
52
|
+
__proto__: null,
|
|
53
|
+
Group: Group,
|
|
54
|
+
Root: Root$5
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const TooltipBridge = createReactComponent(TooltipInstance);
|
|
58
|
+
function Root$4({ children, ...props }) {
|
|
59
|
+
return /* @__PURE__ */ React.createElement(TooltipBridge, { ...props }, children);
|
|
60
|
+
}
|
|
61
|
+
Root$4.displayName = "Tooltip";
|
|
62
|
+
const TriggerBridge = createReactComponent(TooltipTriggerInstance);
|
|
63
|
+
const Trigger = React.forwardRef(
|
|
64
|
+
({ children, ...props }, forwardRef) => {
|
|
65
|
+
return /* @__PURE__ */ React.createElement(TriggerBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
|
|
66
|
+
Primitive.button,
|
|
67
|
+
{
|
|
68
|
+
...props2,
|
|
69
|
+
ref: composeRefs(props2.ref, forwardRef)
|
|
70
|
+
},
|
|
71
|
+
children
|
|
72
|
+
));
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
Trigger.displayName = "TooltipTrigger";
|
|
76
|
+
const ContentBridge = createReactComponent(TooltipContentInstance);
|
|
77
|
+
const Content = React.forwardRef(
|
|
78
|
+
({ children, ...props }, forwardRef) => {
|
|
79
|
+
return /* @__PURE__ */ React.createElement(ContentBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
|
|
80
|
+
Primitive.div,
|
|
81
|
+
{
|
|
82
|
+
...props2,
|
|
83
|
+
ref: composeRefs(props2.ref, forwardRef)
|
|
84
|
+
},
|
|
85
|
+
children
|
|
86
|
+
));
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
Content.displayName = "TooltipContent";
|
|
90
|
+
|
|
91
|
+
var tooltip = /*#__PURE__*/Object.freeze({
|
|
92
|
+
__proto__: null,
|
|
93
|
+
Content: Content,
|
|
94
|
+
Root: Root$4,
|
|
95
|
+
Trigger: Trigger
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const GoogleCastButtonBridge = createReactComponent(GoogleCastButtonInstance, {
|
|
99
|
+
domEventsRegex: /^onMedia/
|
|
100
|
+
});
|
|
101
|
+
const GoogleCastButton = React.forwardRef(
|
|
102
|
+
({ children, ...props }, forwardRef) => {
|
|
103
|
+
return /* @__PURE__ */ React.createElement(GoogleCastButtonBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
|
|
104
|
+
Primitive.button,
|
|
105
|
+
{
|
|
106
|
+
...props2,
|
|
107
|
+
ref: composeRefs(props2.ref, forwardRef)
|
|
108
|
+
},
|
|
109
|
+
children
|
|
110
|
+
));
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
GoogleCastButton.displayName = "GoogleCastButton";
|
|
114
|
+
|
|
115
|
+
const QualitySliderBridge = createReactComponent(QualitySliderInstance, {
|
|
116
|
+
events: sliderCallbacks,
|
|
117
|
+
domEventsRegex: /^onMedia/
|
|
118
|
+
});
|
|
119
|
+
const Root$3 = React.forwardRef(
|
|
120
|
+
({ children, ...props }, forwardRef) => {
|
|
121
|
+
return /* @__PURE__ */ React.createElement(QualitySliderBridge, { ...props, ref: forwardRef }, (props2) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props2 }, children));
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
Root$3.displayName = "QualitySlider";
|
|
125
|
+
|
|
126
|
+
var qualitySlider = /*#__PURE__*/Object.freeze({
|
|
127
|
+
__proto__: null,
|
|
128
|
+
Preview: Preview,
|
|
129
|
+
Root: Root$3,
|
|
130
|
+
Steps: Steps,
|
|
131
|
+
Thumb: Thumb,
|
|
132
|
+
Track: Track$1,
|
|
133
|
+
TrackFill: TrackFill$1,
|
|
134
|
+
Value: Value
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const AudioGainSliderBridge = createReactComponent(AudioGainSliderInstance, {
|
|
138
|
+
events: sliderCallbacks,
|
|
139
|
+
domEventsRegex: /^onMedia/
|
|
140
|
+
});
|
|
141
|
+
const Root$2 = React.forwardRef(
|
|
142
|
+
({ children, ...props }, forwardRef) => {
|
|
143
|
+
return /* @__PURE__ */ React.createElement(AudioGainSliderBridge, { ...props, ref: forwardRef }, (props2) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props2 }, children));
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
Root$2.displayName = "AudioGainSlider";
|
|
147
|
+
|
|
148
|
+
var audioGainSlider = /*#__PURE__*/Object.freeze({
|
|
149
|
+
__proto__: null,
|
|
150
|
+
Preview: Preview,
|
|
151
|
+
Root: Root$2,
|
|
152
|
+
Steps: Steps,
|
|
153
|
+
Thumb: Thumb,
|
|
154
|
+
Track: Track$1,
|
|
155
|
+
TrackFill: TrackFill$1,
|
|
156
|
+
Value: Value
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
const SpeedSliderBridge = createReactComponent(SpeedSliderInstance, {
|
|
160
|
+
events: sliderCallbacks,
|
|
161
|
+
domEventsRegex: /^onMedia/
|
|
162
|
+
});
|
|
163
|
+
const Root$1 = React.forwardRef(
|
|
164
|
+
({ children, ...props }, forwardRef) => {
|
|
165
|
+
return /* @__PURE__ */ React.createElement(SpeedSliderBridge, { ...props, ref: forwardRef }, (props2) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props2 }, children));
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
Root$1.displayName = "SpeedSlider";
|
|
169
|
+
|
|
170
|
+
var speedSlider = /*#__PURE__*/Object.freeze({
|
|
171
|
+
__proto__: null,
|
|
172
|
+
Preview: Preview,
|
|
173
|
+
Root: Root$1,
|
|
174
|
+
Steps: Steps,
|
|
175
|
+
Thumb: Thumb,
|
|
176
|
+
Track: Track$1,
|
|
177
|
+
TrackFill: TrackFill$1,
|
|
178
|
+
Value: Value
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const Title = React.forwardRef(({ children, ...props }, forwardRef) => {
|
|
182
|
+
const $title = useMediaState("title");
|
|
183
|
+
return /* @__PURE__ */ React.createElement(Primitive.span, { ...props, ref: forwardRef }, $title, children);
|
|
184
|
+
});
|
|
185
|
+
Title.displayName = "Title";
|
|
186
|
+
|
|
187
|
+
function useActiveTextCues(track) {
|
|
188
|
+
const [activeCues, setActiveCues] = React.useState([]);
|
|
189
|
+
React.useEffect(() => {
|
|
190
|
+
if (!track) {
|
|
191
|
+
setActiveCues([]);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
function onCuesChange() {
|
|
195
|
+
if (track) setActiveCues(track.activeCues);
|
|
196
|
+
}
|
|
197
|
+
onCuesChange();
|
|
198
|
+
return listenEvent(track, "cue-change", onCuesChange);
|
|
199
|
+
}, [track]);
|
|
200
|
+
return activeCues;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function useActiveTextTrack(kind) {
|
|
204
|
+
const media = useMediaContext(), [track, setTrack] = React.useState(null);
|
|
205
|
+
React.useEffect(() => {
|
|
206
|
+
return watchActiveTextTrack(media.textTracks, kind, setTrack);
|
|
207
|
+
}, [kind]);
|
|
208
|
+
return track;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function useChapterTitle() {
|
|
212
|
+
const $track = useActiveTextTrack("chapters"), $cues = useActiveTextCues($track);
|
|
213
|
+
return $cues[0]?.text || "";
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const ChapterTitle = React.forwardRef(
|
|
217
|
+
({ defaultText = "", children, ...props }, forwardRef) => {
|
|
218
|
+
const $chapterTitle = useChapterTitle();
|
|
219
|
+
return /* @__PURE__ */ React.createElement(Primitive.span, { ...props, ref: forwardRef }, $chapterTitle || defaultText, children);
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
ChapterTitle.displayName = "ChapterTitle";
|
|
223
|
+
|
|
224
|
+
const CaptionsBridge = createReactComponent(CaptionsInstance);
|
|
225
|
+
const Captions = React.forwardRef(
|
|
226
|
+
({ children, ...props }, forwardRef) => {
|
|
227
|
+
return /* @__PURE__ */ React.createElement(CaptionsBridge, { ...props, ref: forwardRef }, (props2) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props2 }, children));
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
Captions.displayName = "Captions";
|
|
231
|
+
|
|
232
|
+
const Root = React.forwardRef(
|
|
233
|
+
({ size = 96, children, ...props }, forwardRef) => {
|
|
234
|
+
return /* @__PURE__ */ React.createElement(
|
|
235
|
+
"svg",
|
|
236
|
+
{
|
|
237
|
+
width: size,
|
|
238
|
+
height: size,
|
|
239
|
+
fill: "none",
|
|
240
|
+
viewBox: "0 0 120 120",
|
|
241
|
+
"aria-hidden": "true",
|
|
242
|
+
"data-part": "root",
|
|
243
|
+
...props,
|
|
244
|
+
ref: forwardRef
|
|
245
|
+
},
|
|
246
|
+
children
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
const Track = React.forwardRef(
|
|
251
|
+
({ width = 8, children, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
252
|
+
"circle",
|
|
253
|
+
{
|
|
254
|
+
cx: "60",
|
|
255
|
+
cy: "60",
|
|
256
|
+
r: "54",
|
|
257
|
+
stroke: "currentColor",
|
|
258
|
+
strokeWidth: width,
|
|
259
|
+
"data-part": "track",
|
|
260
|
+
...props,
|
|
261
|
+
ref
|
|
262
|
+
},
|
|
263
|
+
children
|
|
264
|
+
)
|
|
265
|
+
);
|
|
266
|
+
const TrackFill = React.forwardRef(
|
|
267
|
+
({ width = 8, fillPercent = 50, children, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
268
|
+
"circle",
|
|
269
|
+
{
|
|
270
|
+
cx: "60",
|
|
271
|
+
cy: "60",
|
|
272
|
+
r: "54",
|
|
273
|
+
stroke: "currentColor",
|
|
274
|
+
pathLength: "100",
|
|
275
|
+
strokeWidth: width,
|
|
276
|
+
strokeDasharray: 100,
|
|
277
|
+
strokeDashoffset: 100 - fillPercent,
|
|
278
|
+
"data-part": "track-fill",
|
|
279
|
+
...props,
|
|
280
|
+
ref
|
|
281
|
+
},
|
|
282
|
+
children
|
|
283
|
+
)
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
var spinner = /*#__PURE__*/Object.freeze({
|
|
287
|
+
__proto__: null,
|
|
288
|
+
Root: Root,
|
|
289
|
+
Track: Track,
|
|
290
|
+
TrackFill: TrackFill
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
function createSignal(initialValue, deps = []) {
|
|
294
|
+
const scope = useReactScope();
|
|
295
|
+
return React.useMemo(() => scoped(() => signal(initialValue), scope), [scope, ...deps]);
|
|
296
|
+
}
|
|
297
|
+
function createComputed(compute, deps = []) {
|
|
298
|
+
const scope = useReactScope();
|
|
299
|
+
return React.useMemo(() => scoped(() => computed(compute), scope), [scope, ...deps]);
|
|
300
|
+
}
|
|
301
|
+
function createEffect(compute, deps = []) {
|
|
302
|
+
const scope = useReactScope();
|
|
303
|
+
React.useEffect(() => scoped(() => effect(compute), scope), [scope, ...deps]);
|
|
304
|
+
}
|
|
305
|
+
function useScoped(compute) {
|
|
306
|
+
const scope = useReactScope();
|
|
307
|
+
return React.useMemo(() => scoped(compute, scope), [scope]);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function useTextCues(track) {
|
|
311
|
+
const [cues, setCues] = React.useState([]);
|
|
312
|
+
React.useEffect(() => {
|
|
313
|
+
if (!track) return;
|
|
314
|
+
function onCuesChange() {
|
|
315
|
+
if (track) setCues([...track.cues]);
|
|
316
|
+
}
|
|
317
|
+
const events = new EventsController(track).add("add-cue", onCuesChange).add("remove-cue", onCuesChange);
|
|
318
|
+
onCuesChange();
|
|
319
|
+
return () => {
|
|
320
|
+
setCues([]);
|
|
321
|
+
events.abort();
|
|
322
|
+
};
|
|
323
|
+
}, [track]);
|
|
324
|
+
return cues;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function useChapterOptions() {
|
|
328
|
+
const media = useMediaContext(), track = useActiveTextTrack("chapters"), cues = useTextCues(track), $startTime = useSignal(media.$state.seekableStart), $endTime = useSignal(media.$state.seekableEnd);
|
|
329
|
+
useActiveTextCues(track);
|
|
330
|
+
return React.useMemo(() => {
|
|
331
|
+
const options = track ? cues.filter((cue) => cue.startTime <= $endTime && cue.endTime >= $startTime).map((cue, i) => {
|
|
332
|
+
let currentRef = null, stopProgressEffect;
|
|
333
|
+
return {
|
|
334
|
+
cue,
|
|
335
|
+
label: cue.text,
|
|
336
|
+
value: i.toString(),
|
|
337
|
+
startTimeText: formatTime(Math.max(0, cue.startTime - $startTime)),
|
|
338
|
+
durationText: formatSpokenTime(
|
|
339
|
+
Math.min($endTime, cue.endTime) - Math.max($startTime, cue.startTime)
|
|
340
|
+
),
|
|
341
|
+
get selected() {
|
|
342
|
+
return cue === track.activeCues[0];
|
|
343
|
+
},
|
|
344
|
+
setProgressVar(ref) {
|
|
345
|
+
if (!ref || cue !== track.activeCues[0]) {
|
|
346
|
+
stopProgressEffect?.();
|
|
347
|
+
stopProgressEffect = void 0;
|
|
348
|
+
ref?.style.setProperty("--progress", "0%");
|
|
349
|
+
currentRef = null;
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
if (currentRef === ref) return;
|
|
353
|
+
currentRef = ref;
|
|
354
|
+
stopProgressEffect?.();
|
|
355
|
+
stopProgressEffect = effect(() => {
|
|
356
|
+
const { realCurrentTime } = media.$state, time = realCurrentTime(), cueStartTime = Math.max($startTime, cue.startTime), duration = Math.min($endTime, cue.endTime) - cueStartTime, progress = Math.max(0, time - cueStartTime) / duration * 100;
|
|
357
|
+
ref.style.setProperty("--progress", progress.toFixed(3) + "%");
|
|
358
|
+
});
|
|
359
|
+
},
|
|
360
|
+
select(trigger) {
|
|
361
|
+
media.remote.seek(cue.startTime - $startTime, trigger);
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
}) : [];
|
|
365
|
+
Object.defineProperty(options, "selectedValue", {
|
|
366
|
+
get() {
|
|
367
|
+
const index = options.findIndex((option) => option.selected);
|
|
368
|
+
return (index >= 0 ? index : 0).toString();
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
return options;
|
|
372
|
+
}, [cues, $startTime, $endTime]);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export { Captions, ChapterTitle, Content, GoogleCastButton, Group, MediaAnnouncer, Root$4 as Root, Root$2 as Root$1, Root$1 as Root$2, Root$3, Root$5 as Root$4, Root as Root$5, Title, Track, TrackFill, Trigger, audioGainSlider, controls, createComputed, createEffect, createSignal, qualitySlider, speedSlider, spinner, tooltip, useActiveTextCues, useActiveTextTrack, useChapterOptions, useChapterTitle, useScoped, useTextCues };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { appendParamsToURL, IS_SERVER } from './vidstack-BXgKy_7V.js';
|
|
4
|
+
import { signal, listenEvent, effect, peek, isString } from './vidstack-D_bWd66h.js';
|
|
5
|
+
|
|
6
|
+
class EmbedProvider {
|
|
7
|
+
#iframe;
|
|
8
|
+
src = signal("");
|
|
9
|
+
/**
|
|
10
|
+
* Defines which referrer is sent when fetching the resource.
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy}
|
|
13
|
+
*/
|
|
14
|
+
referrerPolicy = null;
|
|
15
|
+
get iframe() {
|
|
16
|
+
return this.#iframe;
|
|
17
|
+
}
|
|
18
|
+
constructor(iframe) {
|
|
19
|
+
this.#iframe = iframe;
|
|
20
|
+
iframe.setAttribute("frameBorder", "0");
|
|
21
|
+
iframe.setAttribute("aria-hidden", "true");
|
|
22
|
+
iframe.setAttribute(
|
|
23
|
+
"allow",
|
|
24
|
+
"autoplay; fullscreen; encrypted-media; picture-in-picture; accelerometer; gyroscope"
|
|
25
|
+
);
|
|
26
|
+
if (this.referrerPolicy !== null) {
|
|
27
|
+
iframe.setAttribute("referrerpolicy", this.referrerPolicy);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
setup() {
|
|
31
|
+
listenEvent(window, "message", this.#onWindowMessage.bind(this));
|
|
32
|
+
listenEvent(this.#iframe, "load", this.onLoad.bind(this));
|
|
33
|
+
effect(this.#watchSrc.bind(this));
|
|
34
|
+
}
|
|
35
|
+
#watchSrc() {
|
|
36
|
+
const src = this.src();
|
|
37
|
+
if (!src.length) {
|
|
38
|
+
this.#iframe.setAttribute("src", "");
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const params = peek(() => this.buildParams());
|
|
42
|
+
this.#iframe.setAttribute("src", appendParamsToURL(src, params));
|
|
43
|
+
}
|
|
44
|
+
postMessage(message, target) {
|
|
45
|
+
if (IS_SERVER) return;
|
|
46
|
+
this.#iframe.contentWindow?.postMessage(JSON.stringify(message), target ?? "*");
|
|
47
|
+
}
|
|
48
|
+
#onWindowMessage(event) {
|
|
49
|
+
const origin = this.getOrigin(), isOriginMatch = (event.source === null || event.source === this.#iframe?.contentWindow) && (!isString(origin) || origin === event.origin);
|
|
50
|
+
if (!isOriginMatch) return;
|
|
51
|
+
try {
|
|
52
|
+
const message = JSON.parse(event.data);
|
|
53
|
+
if (message) this.onMessage(message, event);
|
|
54
|
+
return;
|
|
55
|
+
} catch (e) {
|
|
56
|
+
}
|
|
57
|
+
if (event.data) this.onMessage(event.data, event);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { EmbedProvider };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
-
export { DefaultAudioLayout, DefaultBufferingIndicator, DefaultKeyboardDisplay, DefaultMenuButton, DefaultMenuCheckbox, DefaultMenuItem, DefaultMenuRadioGroup, DefaultMenuSection, DefaultMenuSliderItem, DefaultSliderParts, DefaultSliderSteps, DefaultTooltip, DefaultVideoGestures, DefaultVideoLargeLayout, DefaultVideoLayout, DefaultVideoSmallLayout, createRadioOptions } from '../chunks/vidstack-
|
|
3
|
+
export { DefaultAudioLayout, DefaultBufferingIndicator, DefaultKeyboardDisplay, DefaultMenuButton, DefaultMenuCheckbox, DefaultMenuItem, DefaultMenuRadioGroup, DefaultMenuSection, DefaultMenuSliderItem, DefaultSliderParts, DefaultSliderSteps, DefaultTooltip, DefaultVideoGestures, DefaultVideoLargeLayout, DefaultVideoLayout, DefaultVideoSmallLayout, createRadioOptions } from '../chunks/vidstack-C7BwfK5c.js';
|
|
4
4
|
export { defaultLayoutIcons } from './vidstack-default-icons.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '../chunks/vidstack-D_bWd66h.js';
|
|
7
|
-
import '../chunks/vidstack-
|
|
8
|
-
import '../chunks/vidstack-
|
|
7
|
+
import '../chunks/vidstack-L5mw2iPb.js';
|
|
8
|
+
import '../chunks/vidstack-BXgKy_7V.js';
|
|
9
9
|
import '@floating-ui/dom';
|
|
10
|
-
import '../chunks/vidstack-
|
|
10
|
+
import '../chunks/vidstack-BOPSNTgH.js';
|
|
11
11
|
import 'react-dom';
|
|
12
|
-
import '../chunks/vidstack-
|
|
12
|
+
import '../chunks/vidstack-BNwnoM-l.js';
|
|
13
13
|
import '../chunks/vidstack-D-hQD1eE.js';
|
|
14
14
|
import '../chunks/vidstack-CBF7iUqu.js';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
-
export { DefaultAudioLayout, DefaultBufferingIndicator, DefaultKeyboardDisplay, DefaultLayoutContext, DefaultMenuButton, DefaultMenuCheckbox, DefaultMenuItem, DefaultMenuRadioGroup, DefaultMenuSection, DefaultMenuSliderItem, DefaultSliderParts, DefaultSliderSteps, DefaultTooltip, DefaultVideoGestures, DefaultVideoLargeLayout, DefaultVideoLayout, DefaultVideoSmallLayout, createRadioOptions, i18n, useDefaultLayoutContext, useDefaultLayoutWord } from '../chunks/vidstack-
|
|
3
|
+
export { DefaultAudioLayout, DefaultBufferingIndicator, DefaultKeyboardDisplay, DefaultLayoutContext, DefaultMenuButton, DefaultMenuCheckbox, DefaultMenuItem, DefaultMenuRadioGroup, DefaultMenuSection, DefaultMenuSliderItem, DefaultSliderParts, DefaultSliderSteps, DefaultTooltip, DefaultVideoGestures, DefaultVideoLargeLayout, DefaultVideoLayout, DefaultVideoSmallLayout, createRadioOptions, i18n, useDefaultLayoutContext, useDefaultLayoutWord } from '../chunks/vidstack-C7BwfK5c.js';
|
|
4
4
|
export { defaultLayoutIcons } from './vidstack-default-icons.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '../chunks/vidstack-D_bWd66h.js';
|
|
7
|
-
import '../chunks/vidstack-
|
|
8
|
-
import '../chunks/vidstack-
|
|
7
|
+
import '../chunks/vidstack-L5mw2iPb.js';
|
|
8
|
+
import '../chunks/vidstack-BXgKy_7V.js';
|
|
9
9
|
import '@floating-ui/dom';
|
|
10
|
-
import '../chunks/vidstack-
|
|
10
|
+
import '../chunks/vidstack-BOPSNTgH.js';
|
|
11
11
|
import 'react-dom';
|
|
12
|
-
import '../chunks/vidstack-
|
|
12
|
+
import '../chunks/vidstack-BNwnoM-l.js';
|
|
13
13
|
import '../chunks/vidstack-D-hQD1eE.js';
|
|
14
14
|
import '../chunks/vidstack-CBF7iUqu.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
-
import { useMediaState, Primitive, IS_SERVER, isRemotionSrc, getDownloadFile } from '../chunks/vidstack-
|
|
3
|
+
import { useMediaState, Primitive, IS_SERVER, isRemotionSrc, getDownloadFile } from '../chunks/vidstack-BXgKy_7V.js';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { effect, createDisposalBin, uppercaseFirstChar, isUndefined, signal, composeRefs, useSignal, isNumber, listenEvent, isString, isKeyboardEvent, isKeyboardClick } from '../chunks/vidstack-D_bWd66h.js';
|
|
6
|
-
import { useMediaContext, PlayButton, Root, Img, Gesture, AirPlayButton, CaptionButton, FullscreenButton, PIPButton, SeekButton, Root$1, Value, Preview, Thumbnail, LiveButton, Time, appendParamsToURL, Root$2, Button, Items, useAudioOptions, Root$3, Item, useCaptionOptions, MuteButton, Root$4 } from '../chunks/vidstack-
|
|
7
|
-
import { useMediaRemote, useVideoQualityOptions, usePlaybackRateOptions } from '../chunks/vidstack-
|
|
8
|
-
import { useLayoutName, useClassName } from '../chunks/vidstack-
|
|
6
|
+
import { useMediaContext, PlayButton, Root, Img, Gesture, AirPlayButton, CaptionButton, FullscreenButton, PIPButton, SeekButton, Root$1, Value, Preview, Thumbnail, LiveButton, Time, appendParamsToURL, Root$2, Button, Items, useAudioOptions, Root$3, Item, useCaptionOptions, MuteButton, Root$4 } from '../chunks/vidstack-BOPSNTgH.js';
|
|
7
|
+
import { useMediaRemote, useVideoQualityOptions, usePlaybackRateOptions } from '../chunks/vidstack-DTow20pt.js';
|
|
8
|
+
import { useLayoutName, useClassName } from '../chunks/vidstack-BNwnoM-l.js';
|
|
9
9
|
import { RemotionThumbnail, RemotionPoster, RemotionSliderThumbnail } from '../chunks/vidstack-D-hQD1eE.js';
|
|
10
10
|
export { plyrLayoutIcons } from './vidstack-plyr-icons.js';
|
|
11
11
|
import '@floating-ui/dom';
|