remotion 4.0.481 → 4.0.483
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/cjs/CompositionManager.d.ts +1 -0
- package/dist/cjs/HtmlInCanvas.d.ts +74 -0
- package/dist/cjs/HtmlInCanvas.js +68 -26
- package/dist/cjs/Img.d.ts +7 -0
- package/dist/cjs/Img.js +5 -5
- package/dist/cjs/Interactive.d.ts +86 -1
- package/dist/cjs/Interactive.js +4 -2
- package/dist/cjs/Sequence.d.ts +1 -0
- package/dist/cjs/Sequence.js +25 -6
- package/dist/cjs/audio/AudioForPreview.js +3 -3
- package/dist/cjs/audio/html5-audio.js +6 -2
- package/dist/cjs/canvas-image/CanvasImage.d.ts +7 -0
- package/dist/cjs/canvas-image/CanvasImage.js +2 -2
- package/dist/cjs/easing.d.ts +5 -2
- package/dist/cjs/easing.js +19 -3
- package/dist/cjs/effects/Solid.d.ts +95 -0
- package/dist/cjs/effects/Solid.js +14 -5
- package/dist/cjs/effects/use-memoized-effects.js +1 -0
- package/dist/cjs/get-effective-visual-mode-value.js +2 -0
- package/dist/cjs/interactivity-schema.d.ts +116 -1
- package/dist/cjs/interactivity-schema.js +81 -1
- package/dist/cjs/internals.d.ts +88 -2
- package/dist/cjs/internals.js +2 -1
- package/dist/cjs/interpolate-keyframed-status.d.ts +2 -1
- package/dist/cjs/interpolate-keyframed-status.js +14 -11
- package/dist/cjs/interpolate.d.ts +3 -1
- package/dist/cjs/interpolate.js +56 -12
- package/dist/cjs/no-react.d.ts +7 -0
- package/dist/cjs/prefetch.js +15 -10
- package/dist/cjs/use-media-in-timeline.js +1 -0
- package/dist/cjs/use-schema.d.ts +2 -0
- package/dist/cjs/use-schema.js +20 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/VideoForPreview.js +2 -2
- package/dist/cjs/volume-position-state.d.ts +4 -4
- package/dist/cjs/volume-position-state.js +9 -9
- package/dist/esm/index.mjs +351 -79
- package/dist/esm/no-react.mjs +70 -11
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
package/dist/cjs/internals.js
CHANGED
|
@@ -146,6 +146,7 @@ exports.Internals = {
|
|
|
146
146
|
sequenceStyleSchema: interactivity_schema_js_1.sequenceStyleSchema,
|
|
147
147
|
sequenceVisualStyleSchema: interactivity_schema_js_1.sequenceVisualStyleSchema,
|
|
148
148
|
sequencePremountSchema: interactivity_schema_js_1.sequencePremountSchema,
|
|
149
|
+
textSchema: interactivity_schema_js_1.textSchema,
|
|
149
150
|
transformSchema: interactivity_schema_js_1.transformSchema,
|
|
150
151
|
premountSchema: interactivity_schema_js_1.premountSchema,
|
|
151
152
|
flattenActiveSchema: flatten_schema_js_1.flattenActiveSchema,
|
|
@@ -155,7 +156,7 @@ exports.Internals = {
|
|
|
155
156
|
useVideo: use_video_js_1.useVideo,
|
|
156
157
|
getRoot: register_root_js_1.getRoot,
|
|
157
158
|
useMediaVolumeState: volume_position_state_js_1.useMediaVolumeState,
|
|
158
|
-
|
|
159
|
+
usePlayerMutedState: volume_position_state_js_1.usePlayerMutedState,
|
|
159
160
|
useMediaInTimeline: use_media_in_timeline_js_1.useMediaInTimeline,
|
|
160
161
|
useLazyComponent: use_lazy_component_js_1.useLazyComponent,
|
|
161
162
|
truthy: truthy_js_1.truthy,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { CanUpdateSequencePropStatusKeyframed } from './use-schema.js';
|
|
2
2
|
type InterpolateKeyframedStatusResult = number | string | readonly number[] | null;
|
|
3
|
-
export declare const interpolateKeyframedStatus: ({ frame, status, }: {
|
|
3
|
+
export declare const interpolateKeyframedStatus: ({ frame, forceSpringAllowTail, status, }: {
|
|
4
4
|
frame: number;
|
|
5
|
+
forceSpringAllowTail: boolean | null;
|
|
5
6
|
status: CanUpdateSequencePropStatusKeyframed;
|
|
6
7
|
}) => InterpolateKeyframedStatusResult;
|
|
7
8
|
export {};
|
|
@@ -5,24 +5,27 @@ const bezier_js_1 = require("./bezier.js");
|
|
|
5
5
|
const easing_js_1 = require("./easing.js");
|
|
6
6
|
const interpolate_colors_js_1 = require("./interpolate-colors.js");
|
|
7
7
|
const interpolate_js_1 = require("./interpolate.js");
|
|
8
|
-
const easingToFn = (
|
|
9
|
-
|
|
8
|
+
const easingToFn = ({ easing, forceSpringAllowTail, }) => {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
switch (easing.type) {
|
|
10
11
|
case 'linear':
|
|
11
12
|
return easing_js_1.Easing.linear;
|
|
12
13
|
case 'spring':
|
|
13
14
|
return easing_js_1.Easing.spring({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
allowTail: (_a = forceSpringAllowTail !== null && forceSpringAllowTail !== void 0 ? forceSpringAllowTail : easing.allowTail) !== null && _a !== void 0 ? _a : undefined,
|
|
16
|
+
damping: easing.damping,
|
|
17
|
+
durationRestThreshold: (_b = easing.durationRestThreshold) !== null && _b !== void 0 ? _b : undefined,
|
|
18
|
+
mass: easing.mass,
|
|
19
|
+
overshootClamping: easing.overshootClamping,
|
|
20
|
+
stiffness: easing.stiffness,
|
|
18
21
|
});
|
|
19
22
|
case 'bezier':
|
|
20
|
-
return (0, bezier_js_1.bezier)(
|
|
23
|
+
return (0, bezier_js_1.bezier)(easing.x1, easing.y1, easing.x2, easing.y2);
|
|
21
24
|
default:
|
|
22
|
-
throw new TypeError(`Unsupported easing: ${JSON.stringify(
|
|
25
|
+
throw new TypeError(`Unsupported easing: ${JSON.stringify(easing)}`);
|
|
23
26
|
}
|
|
24
27
|
};
|
|
25
|
-
const interpolateKeyframedStatus = ({ frame, status, }) => {
|
|
28
|
+
const interpolateKeyframedStatus = ({ frame, forceSpringAllowTail, status, }) => {
|
|
26
29
|
const { keyframes, easing, clamping, interpolationFunction } = status;
|
|
27
30
|
if (keyframes.length === 0) {
|
|
28
31
|
return null;
|
|
@@ -39,7 +42,7 @@ const interpolateKeyframedStatus = ({ frame, status, }) => {
|
|
|
39
42
|
}
|
|
40
43
|
try {
|
|
41
44
|
return (0, interpolate_colors_js_1.interpolateColors)(frame, inputRange, outputs, {
|
|
42
|
-
easing: easing.map(easingToFn),
|
|
45
|
+
easing: easing.map((e) => easingToFn({ easing: e, forceSpringAllowTail })),
|
|
43
46
|
posterize: status.posterize,
|
|
44
47
|
});
|
|
45
48
|
}
|
|
@@ -52,7 +55,7 @@ const interpolateKeyframedStatus = ({ frame, status, }) => {
|
|
|
52
55
|
}
|
|
53
56
|
try {
|
|
54
57
|
return (0, interpolate_js_1.interpolate)(frame, inputRange, outputs, {
|
|
55
|
-
easing: easing.map(easingToFn),
|
|
58
|
+
easing: easing.map((e) => easingToFn({ easing: e, forceSpringAllowTail })),
|
|
56
59
|
extrapolateLeft: clamping.left,
|
|
57
60
|
extrapolateRight: clamping.right,
|
|
58
61
|
posterize: status.posterize,
|
|
@@ -3,7 +3,9 @@ export type ExtrapolateType = 'extend' | 'identity' | 'clamp' | 'wrap';
|
|
|
3
3
|
* @description This function allows you to map a range of values to another with a concise syntax
|
|
4
4
|
* @see [Documentation](https://www.remotion.dev/docs/interpolate)
|
|
5
5
|
*/
|
|
6
|
-
export type EasingFunction = (input: number) => number
|
|
6
|
+
export type EasingFunction = ((input: number) => number) & {
|
|
7
|
+
readonly remotionShouldExtendRight?: boolean;
|
|
8
|
+
};
|
|
7
9
|
export type InterpolateOptions = Partial<{
|
|
8
10
|
easing: EasingFunction | readonly EasingFunction[];
|
|
9
11
|
extrapolateLeft: ExtrapolateType;
|
package/dist/cjs/interpolate.js
CHANGED
|
@@ -325,21 +325,35 @@ function findRange(input, inputRange) {
|
|
|
325
325
|
return i - 1;
|
|
326
326
|
}
|
|
327
327
|
const defaultEasing = (num) => num;
|
|
328
|
+
const shouldExtendRightForEasing = (easing) => {
|
|
329
|
+
return easing.remotionShouldExtendRight === true;
|
|
330
|
+
};
|
|
331
|
+
const resolveEasingForSegment = ({ easing, segmentIndex, }) => {
|
|
332
|
+
if (easing === undefined) {
|
|
333
|
+
return defaultEasing;
|
|
334
|
+
}
|
|
335
|
+
if (typeof easing === 'function') {
|
|
336
|
+
return easing;
|
|
337
|
+
}
|
|
338
|
+
// `segmentIndex` is in [0, inputRange.length - 2]; array length was validated above.
|
|
339
|
+
return easing[segmentIndex];
|
|
340
|
+
};
|
|
341
|
+
const interpolateSegment = ({ input, inputRange, outputRange, easing, extrapolateLeft, extrapolateRight, }) => {
|
|
342
|
+
return interpolateFunction(input, inputRange, outputRange, {
|
|
343
|
+
easing,
|
|
344
|
+
extrapolateLeft,
|
|
345
|
+
extrapolateRight: input > inputRange[1] &&
|
|
346
|
+
extrapolateRight === 'clamp' &&
|
|
347
|
+
shouldExtendRightForEasing(easing)
|
|
348
|
+
? 'extend'
|
|
349
|
+
: extrapolateRight,
|
|
350
|
+
});
|
|
351
|
+
};
|
|
328
352
|
const interpolateNumber = ({ input, inputRange, outputRange, options, }) => {
|
|
329
353
|
if (inputRange.length === 1) {
|
|
330
354
|
return outputRange[0];
|
|
331
355
|
}
|
|
332
356
|
const easingOption = options === null || options === void 0 ? void 0 : options.easing;
|
|
333
|
-
const resolveEasingForSegment = (segmentIndex) => {
|
|
334
|
-
if (easingOption === undefined) {
|
|
335
|
-
return defaultEasing;
|
|
336
|
-
}
|
|
337
|
-
if (typeof easingOption === 'function') {
|
|
338
|
-
return easingOption;
|
|
339
|
-
}
|
|
340
|
-
// `segmentIndex` is in [0, inputRange.length - 2]; array length was validated above.
|
|
341
|
-
return easingOption[segmentIndex];
|
|
342
|
-
};
|
|
343
357
|
let extrapolateLeft = 'extend';
|
|
344
358
|
if ((options === null || options === void 0 ? void 0 : options.extrapolateLeft) !== undefined) {
|
|
345
359
|
extrapolateLeft = options.extrapolateLeft;
|
|
@@ -352,11 +366,41 @@ const interpolateNumber = ({ input, inputRange, outputRange, options, }) => {
|
|
|
352
366
|
? input
|
|
353
367
|
: Math.floor(input / options.posterize) * options.posterize;
|
|
354
368
|
const range = findRange(posterizedInput, inputRange);
|
|
355
|
-
|
|
356
|
-
easing:
|
|
369
|
+
const easing = resolveEasingForSegment({
|
|
370
|
+
easing: easingOption,
|
|
371
|
+
segmentIndex: range,
|
|
372
|
+
});
|
|
373
|
+
let result = interpolateSegment({
|
|
374
|
+
input: posterizedInput,
|
|
375
|
+
inputRange: [inputRange[range], inputRange[range + 1]],
|
|
376
|
+
outputRange: [outputRange[range], outputRange[range + 1]],
|
|
377
|
+
easing,
|
|
357
378
|
extrapolateLeft,
|
|
358
379
|
extrapolateRight,
|
|
359
380
|
});
|
|
381
|
+
for (let segmentIndex = 0; segmentIndex < range; segmentIndex++) {
|
|
382
|
+
const previousEasing = resolveEasingForSegment({
|
|
383
|
+
easing: easingOption,
|
|
384
|
+
segmentIndex,
|
|
385
|
+
});
|
|
386
|
+
if (!shouldExtendRightForEasing(previousEasing)) {
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
const previousSegmentEnd = inputRange[segmentIndex + 1];
|
|
390
|
+
if (posterizedInput <= previousSegmentEnd) {
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
const continuedSegmentValue = interpolateSegment({
|
|
394
|
+
input: posterizedInput,
|
|
395
|
+
inputRange: [inputRange[segmentIndex], previousSegmentEnd],
|
|
396
|
+
outputRange: [outputRange[segmentIndex], outputRange[segmentIndex + 1]],
|
|
397
|
+
easing: previousEasing,
|
|
398
|
+
extrapolateLeft,
|
|
399
|
+
extrapolateRight: 'extend',
|
|
400
|
+
});
|
|
401
|
+
result += continuedSegmentValue - outputRange[segmentIndex + 1];
|
|
402
|
+
}
|
|
403
|
+
return result;
|
|
360
404
|
};
|
|
361
405
|
const interpolateString = ({ input, inputRange, outputRange, options, }) => {
|
|
362
406
|
var _a;
|
package/dist/cjs/no-react.d.ts
CHANGED
|
@@ -75,6 +75,13 @@ export declare const NoReactInternals: {
|
|
|
75
75
|
readonly step: 1;
|
|
76
76
|
readonly hiddenFromList: true;
|
|
77
77
|
};
|
|
78
|
+
readonly trimBefore: {
|
|
79
|
+
readonly type: "number";
|
|
80
|
+
readonly default: 0;
|
|
81
|
+
readonly min: 0;
|
|
82
|
+
readonly step: 1;
|
|
83
|
+
readonly hiddenFromList: true;
|
|
84
|
+
};
|
|
78
85
|
readonly freeze: {
|
|
79
86
|
readonly type: "number";
|
|
80
87
|
readonly default: null;
|
package/dist/cjs/prefetch.js
CHANGED
|
@@ -96,15 +96,15 @@ const prefetch = (src, options) => {
|
|
|
96
96
|
resolve = res;
|
|
97
97
|
reject = rej;
|
|
98
98
|
});
|
|
99
|
+
waitUntilDone.catch(() => undefined);
|
|
99
100
|
const controller = new AbortController();
|
|
100
|
-
let
|
|
101
|
+
let reader = null;
|
|
101
102
|
fetch(srcWithoutHash, {
|
|
102
103
|
signal: controller.signal,
|
|
103
104
|
credentials: (_c = options === null || options === void 0 ? void 0 : options.credentials) !== null && _c !== void 0 ? _c : undefined,
|
|
104
105
|
})
|
|
105
106
|
.then((res) => {
|
|
106
107
|
var _a, _b, _c;
|
|
107
|
-
canBeAborted = false;
|
|
108
108
|
if (canceled) {
|
|
109
109
|
return null;
|
|
110
110
|
}
|
|
@@ -124,9 +124,10 @@ const prefetch = (src, options) => {
|
|
|
124
124
|
if (!res.body) {
|
|
125
125
|
throw new Error(`HTTP response of ${srcWithoutHash} has no body`);
|
|
126
126
|
}
|
|
127
|
-
const
|
|
127
|
+
const responseReader = res.body.getReader();
|
|
128
|
+
reader = responseReader;
|
|
128
129
|
return getBlobFromReader({
|
|
129
|
-
reader,
|
|
130
|
+
reader: responseReader,
|
|
130
131
|
contentType: (_c = (_b = options === null || options === void 0 ? void 0 : options.contentType) !== null && _b !== void 0 ? _b : headerContentType) !== null && _c !== void 0 ? _c : null,
|
|
131
132
|
contentLength: res.headers.get('Content-Length')
|
|
132
133
|
? parseInt(res.headers.get('Content-Length'), 10)
|
|
@@ -135,7 +136,7 @@ const prefetch = (src, options) => {
|
|
|
135
136
|
});
|
|
136
137
|
})
|
|
137
138
|
.then((buf) => {
|
|
138
|
-
if (!buf) {
|
|
139
|
+
if (!buf || canceled) {
|
|
139
140
|
return;
|
|
140
141
|
}
|
|
141
142
|
const actualBlob = (options === null || options === void 0 ? void 0 : options.contentType)
|
|
@@ -188,13 +189,17 @@ const prefetch = (src, options) => {
|
|
|
188
189
|
});
|
|
189
190
|
}
|
|
190
191
|
else {
|
|
192
|
+
if (canceled) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
191
195
|
canceled = true;
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
catch (_a) { }
|
|
196
|
+
const cancellationError = new Error('free() called');
|
|
197
|
+
reject(cancellationError);
|
|
198
|
+
try {
|
|
199
|
+
controller.abort(cancellationError);
|
|
197
200
|
}
|
|
201
|
+
catch (_a) { }
|
|
202
|
+
reader === null || reader === void 0 ? void 0 : reader.cancel(cancellationError).catch(() => undefined);
|
|
198
203
|
}
|
|
199
204
|
},
|
|
200
205
|
waitUntilDone: () => {
|
|
@@ -124,6 +124,7 @@ const useMediaInTimeline = ({ volume, mediaVolume, src, mediaType, playbackRate,
|
|
|
124
124
|
id,
|
|
125
125
|
duration,
|
|
126
126
|
from: 0,
|
|
127
|
+
trimBefore: null,
|
|
127
128
|
parent: (_c = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.id) !== null && _c !== void 0 ? _c : null,
|
|
128
129
|
displayName: finalDisplayName,
|
|
129
130
|
documentationLink,
|
package/dist/cjs/use-schema.d.ts
CHANGED
|
@@ -21,10 +21,12 @@ export type CanUpdateSequencePropStatusBezierEasing = {
|
|
|
21
21
|
};
|
|
22
22
|
export type CanUpdateSequencePropStatusSpringEasing = {
|
|
23
23
|
type: 'spring';
|
|
24
|
+
allowTail: boolean | null;
|
|
24
25
|
damping: number;
|
|
25
26
|
mass: number;
|
|
26
27
|
stiffness: number;
|
|
27
28
|
overshootClamping: boolean;
|
|
29
|
+
durationRestThreshold: number | null;
|
|
28
30
|
};
|
|
29
31
|
export type CanUpdateSequencePropStatusEasing = CanUpdateSequencePropStatusLinearEasing | CanUpdateSequencePropStatusBezierEasing | CanUpdateSequencePropStatusSpringEasing;
|
|
30
32
|
export declare const DEFAULT_LINEAR_EASING: CanUpdateSequencePropStatusLinearEasing;
|
package/dist/cjs/use-schema.js
CHANGED
|
@@ -7,6 +7,13 @@ const interpolate_keyframed_status_js_1 = require("./interpolate-keyframed-statu
|
|
|
7
7
|
exports.DEFAULT_LINEAR_EASING = {
|
|
8
8
|
type: 'linear',
|
|
9
9
|
};
|
|
10
|
+
const getEasingIndexToDuplicate = ({ insertedKeyframeIndex, easingLength, keyframeCount, }) => {
|
|
11
|
+
const isSplittingExistingSegment = insertedKeyframeIndex > 0 && insertedKeyframeIndex < keyframeCount - 1;
|
|
12
|
+
if (!isSplittingExistingSegment || easingLength === 0) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return Math.min(insertedKeyframeIndex - 1, easingLength - 1);
|
|
16
|
+
};
|
|
10
17
|
const makeStaticDragOverride = (value) => {
|
|
11
18
|
return { type: 'static', value };
|
|
12
19
|
};
|
|
@@ -17,6 +24,18 @@ const makeKeyframedDragOverride = ({ status, frame, value, }) => {
|
|
|
17
24
|
? [...status.keyframes, { frame, value }].sort((first, second) => first.frame - second.frame)
|
|
18
25
|
: status.keyframes.map((keyframe, index) => index === existingIndex ? { frame, value } : keyframe);
|
|
19
26
|
const easing = [...status.easing];
|
|
27
|
+
if (existingIndex === -1) {
|
|
28
|
+
const insertedKeyframeIndex = keyframes.findIndex((keyframe) => keyframe.frame === frame);
|
|
29
|
+
const easingIndexToDuplicate = getEasingIndexToDuplicate({
|
|
30
|
+
insertedKeyframeIndex,
|
|
31
|
+
easingLength: easing.length,
|
|
32
|
+
keyframeCount: keyframes.length,
|
|
33
|
+
});
|
|
34
|
+
const easingToDuplicate = easingIndexToDuplicate === null
|
|
35
|
+
? exports.DEFAULT_LINEAR_EASING
|
|
36
|
+
: easing[easingIndexToDuplicate];
|
|
37
|
+
easing.splice(insertedKeyframeIndex, 0, easingToDuplicate);
|
|
38
|
+
}
|
|
20
39
|
while (easing.length < keyframes.length - 1) {
|
|
21
40
|
easing.push(exports.DEFAULT_LINEAR_EASING);
|
|
22
41
|
}
|
|
@@ -90,6 +109,7 @@ const computeEffectiveSchemaValuesDotNotation = ({ schema, currentValue, overrid
|
|
|
90
109
|
}
|
|
91
110
|
else if (frame !== null) {
|
|
92
111
|
const interpolated = (0, interpolate_keyframed_status_js_1.interpolateKeyframedStatus)({
|
|
112
|
+
forceSpringAllowTail: null,
|
|
93
113
|
frame,
|
|
94
114
|
status,
|
|
95
115
|
});
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -108,7 +108,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
108
108
|
throw new Error('acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.');
|
|
109
109
|
}
|
|
110
110
|
const [mediaVolume] = (0, volume_position_state_js_1.useMediaVolumeState)();
|
|
111
|
-
const [
|
|
111
|
+
const [playerMuted] = (0, volume_position_state_js_1.usePlayerMutedState)();
|
|
112
112
|
const userPreferredVolume = (0, volume_prop_js_1.evaluateVolume)({
|
|
113
113
|
frame: volumePropFrame,
|
|
114
114
|
volume,
|
|
@@ -280,6 +280,6 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
280
280
|
requestsVideoFrame: Boolean(onVideoFrame),
|
|
281
281
|
isClientSideRendering: false,
|
|
282
282
|
});
|
|
283
|
-
return (jsx_runtime_1.jsx("video", { ...nativeProps, ref: videoRef, muted: muted ||
|
|
283
|
+
return (jsx_runtime_1.jsx("video", { ...nativeProps, ref: videoRef, muted: muted || playerMuted || userPreferredVolume <= 0, playsInline: true, src: actualSrc, loop: _remotionInternalNativeLoopPassed, style: actualStyle, disableRemotePlayback: true, crossOrigin: crossOriginValue, controls: false }));
|
|
284
284
|
};
|
|
285
285
|
exports.VideoForPreview = (0, react_1.forwardRef)(VideoForDevelopmentRefForwardingFunction);
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export type MediaVolumeContextValue = {
|
|
2
|
-
|
|
2
|
+
playerMuted: boolean;
|
|
3
3
|
mediaVolume: number;
|
|
4
4
|
};
|
|
5
5
|
export type SetMediaVolumeContextValue = {
|
|
6
|
-
|
|
6
|
+
setPlayerMuted: (u: React.SetStateAction<boolean>) => void;
|
|
7
7
|
setMediaVolume: (u: number) => void;
|
|
8
8
|
};
|
|
9
9
|
export declare const MediaVolumeContext: import("react").Context<MediaVolumeContextValue>;
|
|
10
10
|
export declare const SetMediaVolumeContext: import("react").Context<SetMediaVolumeContextValue>;
|
|
11
11
|
type MediaVolumeReturnType = readonly [number, (u: number) => void];
|
|
12
12
|
export declare const useMediaVolumeState: () => MediaVolumeReturnType;
|
|
13
|
-
type
|
|
13
|
+
type PlayerMutedReturnType = readonly [
|
|
14
14
|
boolean,
|
|
15
15
|
(u: React.SetStateAction<boolean>) => void
|
|
16
16
|
];
|
|
17
|
-
export declare const
|
|
17
|
+
export declare const usePlayerMutedState: () => PlayerMutedReturnType;
|
|
18
18
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.usePlayerMutedState = exports.useMediaVolumeState = exports.SetMediaVolumeContext = exports.MediaVolumeContext = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
exports.MediaVolumeContext = (0, react_1.createContext)({
|
|
6
|
-
|
|
6
|
+
playerMuted: false,
|
|
7
7
|
mediaVolume: 1,
|
|
8
8
|
});
|
|
9
9
|
exports.SetMediaVolumeContext = (0, react_1.createContext)({
|
|
10
|
-
|
|
10
|
+
setPlayerMuted: () => {
|
|
11
11
|
throw new Error('default');
|
|
12
12
|
},
|
|
13
13
|
setMediaVolume: () => {
|
|
@@ -22,11 +22,11 @@ const useMediaVolumeState = () => {
|
|
|
22
22
|
}, [mediaVolume, setMediaVolume]);
|
|
23
23
|
};
|
|
24
24
|
exports.useMediaVolumeState = useMediaVolumeState;
|
|
25
|
-
const
|
|
26
|
-
const {
|
|
27
|
-
const {
|
|
25
|
+
const usePlayerMutedState = () => {
|
|
26
|
+
const { playerMuted } = (0, react_1.useContext)(exports.MediaVolumeContext);
|
|
27
|
+
const { setPlayerMuted } = (0, react_1.useContext)(exports.SetMediaVolumeContext);
|
|
28
28
|
return (0, react_1.useMemo)(() => {
|
|
29
|
-
return [
|
|
30
|
-
}, [
|
|
29
|
+
return [playerMuted, setPlayerMuted];
|
|
30
|
+
}, [playerMuted, setPlayerMuted]);
|
|
31
31
|
};
|
|
32
|
-
exports.
|
|
32
|
+
exports.usePlayerMutedState = usePlayerMutedState;
|