remotion 4.0.536 → 4.0.538
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/AbsoluteFill.d.ts +62 -62
- package/dist/cjs/AbsoluteFill.js +3 -3
- package/dist/cjs/AbsoluteFillElement.d.ts +1 -1
- package/dist/cjs/AbsoluteFillElement.js +36 -3
- package/dist/cjs/CanUseRemotionHooks.js +1 -1
- package/dist/cjs/Composition.js +5 -11
- package/dist/cjs/CompositionErrorBoundary.js +5 -2
- package/dist/cjs/CompositionManager.d.ts +1 -0
- package/dist/cjs/CompositionManagerContext.d.ts +3 -0
- package/dist/cjs/CompositionManagerContext.js +5 -3
- package/dist/cjs/CompositionManagerProvider.d.ts +1 -1
- package/dist/cjs/CompositionManagerProvider.js +3 -1
- package/dist/cjs/CompositionRegistryProvider.d.ts +1 -1
- package/dist/cjs/CompositionRegistryProvider.js +1 -1
- package/dist/cjs/EditorProps.d.ts +2 -2
- package/dist/cjs/EditorProps.js +1 -1
- package/dist/cjs/Folder.js +1 -1
- package/dist/cjs/HtmlInCanvas.d.ts +58 -67
- package/dist/cjs/HtmlInCanvas.js +84 -20
- package/dist/cjs/HtmlInCanvasFallback.d.ts +6 -0
- package/dist/cjs/HtmlInCanvasFallback.js +39 -0
- package/dist/cjs/IFrame.d.ts +2 -2
- package/dist/cjs/IFrame.js +1 -1
- package/dist/cjs/Img.d.ts +62 -62
- package/dist/cjs/Img.js +160 -132
- package/dist/cjs/Interactive.d.ts +147 -145
- package/dist/cjs/Interactive.js +2 -2
- package/dist/cjs/RemotionRoot.js +1 -1
- package/dist/cjs/RenderAssetManager.js +1 -1
- package/dist/cjs/Sequence.js +37 -27
- package/dist/cjs/SequenceActivityBoundary.js +1 -1
- package/dist/cjs/SequenceActivityBudget.js +1 -1
- package/dist/cjs/SequenceActivitySuspensionProvider.js +1 -1
- package/dist/cjs/SequenceManager.d.ts +6 -0
- package/dist/cjs/SequenceManager.js +71 -27
- package/dist/cjs/SequenceRegistryProvider.js +16 -3
- package/dist/cjs/TimelineContext.js +1 -1
- package/dist/cjs/Track.js +2 -2
- package/dist/cjs/animated-image/AnimatedImage.d.ts +69 -69
- package/dist/cjs/animated-image/AnimatedImage.js +17 -12
- package/dist/cjs/animated-image/canvas.d.ts +6 -5
- package/dist/cjs/animated-image/canvas.js +1 -1
- package/dist/cjs/animated-image/create-image-decoder.d.ts +1 -1
- package/dist/cjs/animated-image/decode-image.d.ts +1 -1
- package/dist/cjs/animated-image/get-duration-in-seconds.d.ts +1 -1
- package/dist/cjs/animated-image/index.js +1 -1
- package/dist/cjs/audio/AudioForPreview.js +5 -28
- package/dist/cjs/audio/AudioForRendering.d.ts +5 -20
- package/dist/cjs/audio/AudioForRendering.js +44 -5
- package/dist/cjs/audio/html5-audio.d.ts +36 -36
- package/dist/cjs/audio/html5-audio.js +8 -10
- package/dist/cjs/audio/index.js +1 -1
- package/dist/cjs/audio/shared-audio-tags.js +10 -16
- package/dist/cjs/audio/shared-element-source-node.d.ts +1 -1
- package/dist/cjs/audio/use-audio-context.d.ts +2 -1
- package/dist/cjs/audio/wait-until-actually-resumed.d.ts +2 -1
- package/dist/cjs/buffer-until-first-frame.d.ts +4 -3
- package/dist/cjs/buffering.js +1 -1
- package/dist/cjs/cancel-render.js +3 -0
- package/dist/cjs/canvas-image/CanvasImage.d.ts +71 -71
- package/dist/cjs/canvas-image/CanvasImage.js +27 -24
- package/dist/cjs/canvas-image/index.js +1 -1
- package/dist/cjs/codec.d.ts +1 -1
- package/dist/cjs/committed-metadata.d.ts +4 -2
- package/dist/cjs/composition-registry-fallback.d.ts +4 -2
- package/dist/cjs/composition-registry-fallback.js +12 -10
- package/dist/cjs/create-element-source-proxy.js +46 -6
- package/dist/cjs/default-css.d.ts +1 -1
- package/dist/cjs/delay-render.d.ts +2 -1
- package/dist/cjs/delay-render.js +4 -2
- package/dist/cjs/easing.js +3 -1
- package/dist/cjs/effects/Solid.d.ts +60 -60
- package/dist/cjs/effects/Solid.js +2 -2
- package/dist/cjs/effects/canvas-pool.js +6 -9
- package/dist/cjs/effects/index.js +1 -1
- package/dist/cjs/effects/use-memoized-effects.d.ts +2 -1
- package/dist/cjs/effects/use-memoized-effects.js +107 -54
- package/dist/cjs/freeze.js +2 -2
- package/dist/cjs/get-cross-origin-value.d.ts +1 -1
- package/dist/cjs/get-effective-visual-mode-value.d.ts +2 -2
- package/dist/cjs/index.d.ts +3 -1
- package/dist/cjs/index.js +32 -32
- package/dist/cjs/interactivity-schema.d.ts +286 -286
- package/dist/cjs/internals.d.ts +411 -595
- package/dist/cjs/internals.js +8 -0
- package/dist/cjs/interpolate-colors.d.ts +1 -1
- package/dist/cjs/interpolate-colors.js +17 -16
- package/dist/cjs/interpolate.d.ts +2 -9
- package/dist/cjs/is-player.js +1 -1
- package/dist/cjs/loading-indicator.js +2 -6
- package/dist/cjs/log-level-context.d.ts +1 -1
- package/dist/cjs/log.d.ts +12 -7
- package/dist/cjs/loop/index.js +1 -1
- package/dist/cjs/media-resource-manager.d.ts +1 -1
- package/dist/cjs/media-tag-current-time-timestamp.d.ts +1 -1
- package/dist/cjs/no-react.d.ts +85 -91
- package/dist/cjs/no-react.js +2 -2
- package/dist/cjs/play-and-handle-not-allowed-error.d.ts +5 -4
- package/dist/cjs/playback-logging.d.ts +2 -1
- package/dist/cjs/playback-pitch-context.d.ts +1 -0
- package/dist/cjs/playback-pitch-context.js +5 -0
- package/dist/cjs/prefetch-state.js +1 -1
- package/dist/cjs/prefetch.d.ts +7 -6
- package/dist/cjs/props-if-has-props.d.ts +2 -1
- package/dist/cjs/prores-profile.d.ts +1 -1
- package/dist/cjs/register-root.d.ts +2 -2
- package/dist/cjs/render-resource-manager.d.ts +1 -1
- package/dist/cjs/render-types.d.ts +2 -2
- package/dist/cjs/resolve-video-config.d.ts +8 -8
- package/dist/cjs/runtime-value-store.d.ts +1 -1
- package/dist/cjs/scale-value.d.ts +1 -1
- package/dist/cjs/seek.d.ts +3 -2
- package/dist/cjs/sequence-activity-context.js +1 -1
- package/dist/cjs/sequence-crop.js +1 -4
- package/dist/cjs/series/flatten-children.d.ts +3 -1
- package/dist/cjs/series/index.js +4 -5
- package/dist/cjs/series/is-inside-series.js +2 -2
- package/dist/cjs/spring/index.d.ts +1 -1
- package/dist/cjs/spring/index.js +1 -1
- package/dist/cjs/spring/measure-spring.d.ts +1 -1
- package/dist/cjs/spring/spring-utils.d.ts +1 -1
- package/dist/cjs/spring/spring-utils.js +11 -5
- package/dist/cjs/timeline-position-state.d.ts +2 -1
- package/dist/cjs/timeline-position-state.js +23 -3
- package/dist/cjs/use-amplification.d.ts +4 -7
- package/dist/cjs/use-current-frame.d.ts +1 -0
- package/dist/cjs/use-current-frame.js +14 -7
- package/dist/cjs/use-current-scale.d.ts +2 -2
- package/dist/cjs/use-delay-render.d.ts +2 -1
- package/dist/cjs/use-lazy-component.d.ts +1 -1
- package/dist/cjs/use-lazy-component.js +15 -5
- package/dist/cjs/use-media-buffering.d.ts +3 -2
- package/dist/cjs/use-media-duration.d.ts +4 -0
- package/dist/cjs/use-media-duration.js +36 -0
- package/dist/cjs/use-media-enabled.d.ts +1 -1
- package/dist/cjs/use-media-enabled.js +1 -1
- package/dist/cjs/use-media-in-timeline.d.ts +1 -1
- package/dist/cjs/use-media-playback.d.ts +3 -3
- package/dist/cjs/use-media-tag.d.ts +2 -2
- package/dist/cjs/use-pixel-density.d.ts +1 -1
- package/dist/cjs/use-premounting.d.ts +1 -1
- package/dist/cjs/use-premounting.js +6 -2
- package/dist/cjs/use-request-video-callback-time.d.ts +3 -3
- package/dist/cjs/use-schema.d.ts +4 -4
- package/dist/cjs/use-video.js +1 -1
- package/dist/cjs/validate-media-props.d.ts +1 -1
- package/dist/cjs/validation/validate-default-props.d.ts +1 -1
- package/dist/cjs/validation/validate-duration-in-frames.js +3 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/MediaPlaybackError.js +0 -1
- package/dist/cjs/video/OffthreadVideo.js +5 -5
- package/dist/cjs/video/OffthreadVideoForRendering.js +9 -7
- package/dist/cjs/video/VideoForPreview.js +6 -28
- package/dist/cjs/video/VideoForRendering.d.ts +5 -3
- package/dist/cjs/video/VideoForRendering.js +4 -2
- package/dist/cjs/video/duration-state.d.ts +1 -0
- package/dist/cjs/video/duration-state.js +8 -2
- package/dist/cjs/video/emit-video-frame.d.ts +1 -1
- package/dist/cjs/video/html5-video.d.ts +36 -36
- package/dist/cjs/video/html5-video.js +8 -10
- package/dist/cjs/video/index.js +2 -2
- package/dist/cjs/video/seek-until-right.d.ts +3 -2
- package/dist/cjs/warn-about-non-seekable-media.d.ts +1 -1
- package/dist/cjs/with-interactivity-schema.d.ts +1 -1
- package/dist/cjs/with-interactivity-schema.js +15 -18
- package/dist/cjs/wrap-remotion-context.d.ts +4 -4
- package/dist/cjs/wrap-remotion-context.js +2 -2
- package/dist/esm/index.mjs +1060 -728
- package/dist/esm/no-react.mjs +30 -25
- package/dist/esm/version.mjs +1 -1
- package/package.json +4 -4
package/dist/cjs/prefetch.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LogLevel } from './log.js';
|
|
1
2
|
export declare const removeAndGetHashFragment: (src: string) => number | null;
|
|
2
3
|
export declare const getSrcWithoutHash: (src: string) => string;
|
|
3
4
|
export declare const usePreload: (src: string) => string;
|
|
@@ -10,10 +11,10 @@ export type PrefetchOnProgress = (options: {
|
|
|
10
11
|
loadedBytes: number;
|
|
11
12
|
}) => void;
|
|
12
13
|
export declare const prefetch: (src: string, options?: {
|
|
13
|
-
method?:
|
|
14
|
-
contentType?: string
|
|
15
|
-
onProgress?: PrefetchOnProgress
|
|
16
|
-
credentials?: RequestCredentials
|
|
17
|
-
logLevel?:
|
|
18
|
-
}
|
|
14
|
+
method?: 'blob-url' | 'base64';
|
|
15
|
+
contentType?: string;
|
|
16
|
+
onProgress?: PrefetchOnProgress;
|
|
17
|
+
credentials?: RequestCredentials;
|
|
18
|
+
logLevel?: LogLevel;
|
|
19
|
+
}) => FetchAndPreload;
|
|
19
20
|
export {};
|
|
@@ -17,5 +17,6 @@ export type PropsIfHasProps<Schema extends AnyZodObject, Props extends Record<st
|
|
|
17
17
|
} : {
|
|
18
18
|
defaultProps: InferProps<Schema, Props>;
|
|
19
19
|
};
|
|
20
|
-
export type InferProps<Schema extends AnyZodObject, Props extends Record<string, unknown>> = AnyZodObject extends Schema ? {} extends Props ? Record<string, unknown> : Props : {} extends Props ? InferZodInput<Schema> :
|
|
20
|
+
export type InferProps<Schema extends AnyZodObject, Props extends Record<string, unknown>> = AnyZodObject extends Schema ? {} extends Props ? Record<string, unknown> : Props : {} extends Props ? InferZodInput<Schema> : // Props and schema specified
|
|
21
|
+
InferZodInput<Schema> & Props;
|
|
21
22
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const proResProfileOptions: readonly [
|
|
1
|
+
export declare const proResProfileOptions: readonly ['4444-xq', '4444', 'hq', 'standard', 'light', 'proxy'];
|
|
2
2
|
export type ProResProfile = (typeof proResProfileOptions)[number];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
export declare const registerRoot: (comp: React.FC
|
|
2
|
+
export declare const registerRoot: (comp: React.FC) => void;
|
|
3
3
|
export declare const getRoot: () => React.FC<{}> | null;
|
|
4
|
-
export declare const waitForRoot: (fn: (comp: React.FC
|
|
4
|
+
export declare const waitForRoot: (fn: (comp: React.FC) => void) => (() => void);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const validVideoImageFormats: readonly [
|
|
1
|
+
export declare const validVideoImageFormats: readonly ['png', 'jpeg', 'none'];
|
|
2
2
|
export type VideoImageFormat = (typeof validVideoImageFormats)[number];
|
|
3
|
-
export declare const validPixelFormats: readonly [
|
|
3
|
+
export declare const validPixelFormats: readonly ['yuv420p', 'yuva420p', 'yuv422p', 'yuv444p', 'yuv420p10le', 'yuv422p10le', 'yuv444p10le', 'yuva444p10le'];
|
|
4
4
|
export type PixelFormat = (typeof validPixelFormats)[number];
|
|
@@ -23,20 +23,20 @@ export type VideoConfigWithMetadata = {
|
|
|
23
23
|
readonly metadataSource: VideoConfigMetadataSource;
|
|
24
24
|
readonly videoConfig: VideoConfig;
|
|
25
25
|
};
|
|
26
|
-
export declare const resolveVideoConfigWithMetadata: ({ calculateMetadata, signal, defaultProps, inputProps: originalProps, compositionId, compositionDurationInFrames, compositionFps, compositionHeight, compositionWidth, }: ResolveVideoConfigParams) =>
|
|
27
|
-
export declare const resolveVideoConfig: (params: ResolveVideoConfigParams) =>
|
|
26
|
+
export declare const resolveVideoConfigWithMetadata: ({ calculateMetadata, signal, defaultProps, inputProps: originalProps, compositionId, compositionDurationInFrames, compositionFps, compositionHeight, compositionWidth, }: ResolveVideoConfigParams) => VideoConfigWithMetadata | Promise<VideoConfigWithMetadata>;
|
|
27
|
+
export declare const resolveVideoConfig: (params: ResolveVideoConfigParams) => VideoConfig | Promise<VideoConfig>;
|
|
28
28
|
export declare const resolveVideoConfigWithMetadataOrCatch: (params: ResolveVideoConfigParams) => {
|
|
29
|
-
type:
|
|
30
|
-
result:
|
|
29
|
+
type: 'success';
|
|
30
|
+
result: VideoConfigWithMetadata | Promise<VideoConfigWithMetadata>;
|
|
31
31
|
} | {
|
|
32
|
-
type:
|
|
32
|
+
type: 'error';
|
|
33
33
|
error: Error;
|
|
34
34
|
};
|
|
35
35
|
export declare const resolveVideoConfigOrCatch: (params: ResolveVideoConfigParams) => {
|
|
36
|
-
type:
|
|
37
|
-
result:
|
|
36
|
+
type: 'success';
|
|
37
|
+
result: VideoConfig | Promise<VideoConfig>;
|
|
38
38
|
} | {
|
|
39
|
-
type:
|
|
39
|
+
type: 'error';
|
|
40
40
|
error: Error;
|
|
41
41
|
};
|
|
42
42
|
export {};
|
|
@@ -7,4 +7,4 @@ export type RuntimeValueStoreController<TSnapshot extends RuntimeValueSnapshot =
|
|
|
7
7
|
store: RuntimeValueStore<TSnapshot>;
|
|
8
8
|
setSnapshot: (newSnapshot: TSnapshot) => void;
|
|
9
9
|
};
|
|
10
|
-
export declare const createRuntimeValueStore: <TSnapshot extends
|
|
10
|
+
export declare const createRuntimeValueStore: <TSnapshot extends RuntimeValueSnapshot>(initialSnapshot: TSnapshot) => RuntimeValueStoreController<TSnapshot>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type ScaleValue = readonly [number, number, number];
|
|
2
2
|
export declare const parseValidScaleValue: (value: unknown) => ScaleValue | null;
|
|
3
3
|
export declare const parseScaleValue: (value: unknown) => ScaleValue;
|
|
4
|
-
export declare const serializeScaleValue: ([x, y, z]: ScaleValue) =>
|
|
4
|
+
export declare const serializeScaleValue: ([x, y, z]: ScaleValue) => number | string;
|
package/dist/cjs/seek.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { LogLevel } from './log';
|
|
1
2
|
export declare const seek: ({ mediaRef, time, logLevel, why, mountTime, }: {
|
|
2
|
-
mediaRef:
|
|
3
|
+
mediaRef: HTMLVideoElement | HTMLAudioElement;
|
|
3
4
|
time: number;
|
|
4
|
-
logLevel:
|
|
5
|
+
logLevel: LogLevel;
|
|
5
6
|
why: string;
|
|
6
7
|
mountTime: number;
|
|
7
8
|
}) => number;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SequenceContent = exports.SequenceActivityAbsoluteTimeContext = exports.SequenceActivityTimelineContext = exports.SequenceActivitySettingsContext = exports.SequenceActivitySuspensionContext = exports.SequenceActivityDormantContext = exports.SequenceActivityContext = exports.DEFAULT_SEQUENCE_ACTIVITY_LIMIT = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
|
|
5
|
+
var sequence_activity_defaults_js_1 = require("./sequence-activity-defaults.js");
|
|
6
6
|
Object.defineProperty(exports, "DEFAULT_SEQUENCE_ACTIVITY_LIMIT", { enumerable: true, get: function () { return sequence_activity_defaults_js_1.DEFAULT_SEQUENCE_ACTIVITY_LIMIT; } });
|
|
7
7
|
// Hidden Activity trees register on commit, so Sequence Activity is disabled
|
|
8
8
|
// when the sequence manager falls back to effects.
|
|
@@ -32,10 +32,7 @@ const getSequenceCropClipPath = ({ left, right, top, bottom, style, }) => {
|
|
|
32
32
|
];
|
|
33
33
|
const serializedBorderRadius = shorthand ||
|
|
34
34
|
(longhands.some((radius) => radius !== undefined)
|
|
35
|
-
? longhands.map((radius) => {
|
|
36
|
-
var _a;
|
|
37
|
-
return (_a = serializeRadius(radius)) !== null && _a !== void 0 ? _a : '0px';
|
|
38
|
-
}).join(' ')
|
|
35
|
+
? longhands.map((radius) => { var _a; return (_a = serializeRadius(radius)) !== null && _a !== void 0 ? _a : '0px'; }).join(' ')
|
|
39
36
|
: undefined);
|
|
40
37
|
const rounded = serializedBorderRadius
|
|
41
38
|
? ` round ${serializedBorderRadius}`
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
type ReactChildArray = ReturnType<typeof React.Children.toArray>;
|
|
3
|
+
export declare const flattenChildren: (children: React.ReactNode) => ReactChildArray;
|
|
4
|
+
export {};
|
package/dist/cjs/series/index.js
CHANGED
|
@@ -61,7 +61,7 @@ const SeriesSequenceInner = (0, react_1.forwardRef)(({ offset = 0, className = '
|
|
|
61
61
|
if (_remotionInternalRender) {
|
|
62
62
|
return _remotionInternalRender({ ...props, offset, className: className || undefined }, ref);
|
|
63
63
|
}
|
|
64
|
-
return (jsx_runtime_1.jsx(is_inside_series_js_1.IsNotInsideSeriesProvider, { children: props.children }));
|
|
64
|
+
return ((0, jsx_runtime_1.jsx)(is_inside_series_js_1.IsNotInsideSeriesProvider, { children: props.children }));
|
|
65
65
|
});
|
|
66
66
|
const SeriesSequence = Interactive_js_1.Interactive.withSchema({
|
|
67
67
|
Component: SeriesSequenceInner,
|
|
@@ -136,17 +136,16 @@ const SeriesInner = (props) => {
|
|
|
136
136
|
});
|
|
137
137
|
const currentStartFrame = startFrame + offset;
|
|
138
138
|
const nextStartFrame = startFrame + timelineDurationInFrames + offset;
|
|
139
|
-
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
140
|
-
jsx_runtime_1.jsx(SequenceWithoutSchemaWithRef, { ref: ref, name: name || '<Series.Sequence>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/series", controls: controls !== null && controls !== void 0 ? controls : undefined, from: currentStartFrame, durationInFrames: durationInFramesProp, ...passedProps, _remotionInternalTimelineTrack: {
|
|
139
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SequenceWithoutSchemaWithRef, { ref: ref, name: name || '<Series.Sequence>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/series", controls: controls !== null && controls !== void 0 ? controls : undefined, from: currentStartFrame, durationInFrames: durationInFramesProp, ...passedProps, _remotionInternalTimelineTrack: {
|
|
141
140
|
role: 'clip',
|
|
142
141
|
seriesOffset: offset,
|
|
143
|
-
}, children: jsx_runtime_1.jsx(is_inside_series_js_1.IsNotInsideSeriesProvider, { children: sequenceChildren }) }), renderChildren(i + 1, nextStartFrame)] }));
|
|
142
|
+
}, children: (0, jsx_runtime_1.jsx)(is_inside_series_js_1.IsNotInsideSeriesProvider, { children: sequenceChildren }) }), renderChildren(i + 1, nextStartFrame)] }));
|
|
144
143
|
},
|
|
145
144
|
});
|
|
146
145
|
};
|
|
147
146
|
return renderChildren(0, 0);
|
|
148
147
|
}, [props.children, pendingDeletions]);
|
|
149
|
-
return (jsx_runtime_1.jsx(Track_js_1.TrackWithoutSchema, { layout: "none", _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/series", ...props, name: (_a = props.name) !== null && _a !== void 0 ? _a : '<Series>', children: jsx_runtime_1.jsx(is_inside_series_js_1.IsInsideSeriesContainer, { children: childrenValue }) }));
|
|
148
|
+
return ((0, jsx_runtime_1.jsx)(Track_js_1.TrackWithoutSchema, { layout: "none", _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/series", ...props, name: (_a = props.name) !== null && _a !== void 0 ? _a : '<Series>', children: (0, jsx_runtime_1.jsx)(is_inside_series_js_1.IsInsideSeriesContainer, { children: childrenValue }) }));
|
|
150
149
|
};
|
|
151
150
|
/**
|
|
152
151
|
* @description with this component, you can easily stitch together scenes that should play sequentially after another.
|
|
@@ -38,11 +38,11 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
39
|
exports.IsInsideSeriesContext = (0, react_1.createContext)(false);
|
|
40
40
|
const IsInsideSeriesContainer = ({ children }) => {
|
|
41
|
-
return (jsx_runtime_1.jsx(exports.IsInsideSeriesContext.Provider, { value: true, children: children }));
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)(exports.IsInsideSeriesContext.Provider, { value: true, children: children }));
|
|
42
42
|
};
|
|
43
43
|
exports.IsInsideSeriesContainer = IsInsideSeriesContainer;
|
|
44
44
|
const IsNotInsideSeriesProvider = ({ children }) => {
|
|
45
|
-
return (jsx_runtime_1.jsx(exports.IsInsideSeriesContext.Provider, { value: false, children: children }));
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(exports.IsInsideSeriesContext.Provider, { value: false, children: children }));
|
|
46
46
|
};
|
|
47
47
|
exports.IsNotInsideSeriesProvider = IsNotInsideSeriesProvider;
|
|
48
48
|
const useRequireToBeInsideSeries = () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SpringConfig } from './spring-utils';
|
|
2
|
-
export declare function spring({ frame: passedFrame, fps, config, from, to, durationInFrames: passedDurationInFrames, durationRestThreshold, delay, reverse }: {
|
|
2
|
+
export declare function spring({ frame: passedFrame, fps, config, from, to, durationInFrames: passedDurationInFrames, durationRestThreshold, delay, reverse, }: {
|
|
3
3
|
frame: number;
|
|
4
4
|
fps: number;
|
|
5
5
|
config?: Partial<SpringConfig>;
|
package/dist/cjs/spring/index.js
CHANGED
|
@@ -60,5 +60,5 @@ function spring({ frame: passedFrame, fps, config = {}, from = 0, to = 1, durati
|
|
|
60
60
|
const interpolated = from === 0 && to === 1 ? inner : (0, interpolate_js_1.interpolate)(inner, [0, 1], [from, to]);
|
|
61
61
|
return interpolated;
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
var measure_spring_js_2 = require("./measure-spring.js");
|
|
64
64
|
Object.defineProperty(exports, "measureSpring", { enumerable: true, get: function () { return measure_spring_js_2.measureSpring; } });
|
|
@@ -9,5 +9,5 @@ type MeasureSpringProps = {
|
|
|
9
9
|
config?: Partial<SpringConfig>;
|
|
10
10
|
threshold?: number;
|
|
11
11
|
} & (false extends typeof ENABLE_V5_BREAKING_CHANGES ? V4Props : {});
|
|
12
|
-
export declare function measureSpring({ fps, config, threshold }: MeasureSpringProps): number;
|
|
12
|
+
export declare function measureSpring({ fps, config, threshold, }: MeasureSpringProps): number;
|
|
13
13
|
export {};
|
|
@@ -11,7 +11,7 @@ export type SpringConfig = {
|
|
|
11
11
|
stiffness: number;
|
|
12
12
|
overshootClamping: boolean;
|
|
13
13
|
};
|
|
14
|
-
export declare function springCalculation({ frame, fps, config }: {
|
|
14
|
+
export declare function springCalculation({ frame, fps, config, }: {
|
|
15
15
|
frame: number;
|
|
16
16
|
fps: number;
|
|
17
17
|
config?: Partial<SpringConfig>;
|
|
@@ -75,27 +75,33 @@ function springCalculation({ frame, fps, config = {}, }) {
|
|
|
75
75
|
stiffness: (_c = config.stiffness) !== null && _c !== void 0 ? _c : defaultSpringConfig.stiffness,
|
|
76
76
|
overshootClamping: (_d = config.overshootClamping) !== null && _d !== void 0 ? _d : defaultSpringConfig.overshootClamping,
|
|
77
77
|
};
|
|
78
|
-
const
|
|
79
|
-
frame,
|
|
78
|
+
const configKey = [
|
|
80
79
|
fps,
|
|
81
80
|
resolvedConfig.damping,
|
|
82
81
|
resolvedConfig.mass,
|
|
83
82
|
resolvedConfig.overshootClamping,
|
|
84
83
|
resolvedConfig.stiffness,
|
|
85
84
|
].join('-');
|
|
85
|
+
const cacheKey = `${frame}-${configKey}`;
|
|
86
86
|
if (calculationCache[cacheKey]) {
|
|
87
87
|
return calculationCache[cacheKey];
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
const frameClamped = Math.max(0, frame);
|
|
90
|
+
// Only resume from an integer frame: fractional steps change the simulation.
|
|
91
|
+
const previousFrame = Math.ceil(frameClamped) - 1;
|
|
92
|
+
const previousAnimation = previousFrame >= 0
|
|
93
|
+
? calculationCache[`${previousFrame}-${configKey}`]
|
|
94
|
+
: undefined;
|
|
95
|
+
let animation = previousAnimation !== null && previousAnimation !== void 0 ? previousAnimation : {
|
|
90
96
|
lastTimestamp: 0,
|
|
91
97
|
current: from,
|
|
92
98
|
toValue: to,
|
|
93
99
|
velocity: 0,
|
|
94
100
|
prevPosition: 0,
|
|
95
101
|
};
|
|
96
|
-
const frameClamped = Math.max(0, frame);
|
|
97
102
|
const unevenRest = frameClamped % 1;
|
|
98
|
-
|
|
103
|
+
const startFrame = previousAnimation ? previousFrame + 1 : 0;
|
|
104
|
+
for (let f = startFrame; f <= Math.floor(frameClamped); f++) {
|
|
99
105
|
const time = (f / fps) * 1000;
|
|
100
106
|
animation = advance({
|
|
101
107
|
animation,
|
|
@@ -11,9 +11,10 @@ export declare const clampFrameToCompositionRange: (frame: number, durationInFra
|
|
|
11
11
|
export declare const useTimelineContext: () => TimelineContextValue;
|
|
12
12
|
export declare const usePlaybackRate: () => PlaybackRateContextValue;
|
|
13
13
|
export declare const useTimelinePosition: () => number;
|
|
14
|
+
export declare const useTimelinePositionWithOptionalSubscription: (subscribe: boolean) => number;
|
|
14
15
|
export declare const useIsInsideFreeze: () => boolean;
|
|
15
16
|
export declare const useAbsoluteTimelinePosition: () => number;
|
|
16
|
-
export declare const useTimelineSetFrameWithoutSeek: () => (u:
|
|
17
|
+
export declare const useTimelineSetFrameWithoutSeek: () => ((u: React.SetStateAction<Record<string, number>>) => void);
|
|
17
18
|
export declare const useTimelineSeekFrame: () => (frame: import("react").SetStateAction<Record<string, number>>) => void;
|
|
18
19
|
export { usePlaying } from './use-playing.js';
|
|
19
20
|
export { useBuffering } from './use-buffering.js';
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useBuffering = exports.usePlaying = exports.useTimelineSeekFrame = exports.useTimelineSetFrameWithoutSeek = exports.useAbsoluteTimelinePosition = exports.useIsInsideFreeze = exports.useTimelinePosition = exports.usePlaybackRate = exports.useTimelineContext = exports.clampFrameToCompositionRange = exports.getFrameForComposition = exports.getInitialFrameState = exports.persistCurrentFrame = void 0;
|
|
3
|
+
exports.useBuffering = exports.usePlaying = exports.useTimelineSeekFrame = exports.useTimelineSetFrameWithoutSeek = exports.useAbsoluteTimelinePosition = exports.useIsInsideFreeze = exports.useTimelinePositionWithOptionalSubscription = exports.useTimelinePosition = exports.usePlaybackRate = exports.useTimelineContext = exports.clampFrameToCompositionRange = exports.getFrameForComposition = exports.getInitialFrameState = exports.persistCurrentFrame = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const sequence_activity_context_js_1 = require("./sequence-activity-context.js");
|
|
6
6
|
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
7
7
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
8
8
|
const use_video_js_1 = require("./use-video.js");
|
|
9
|
+
// Reading TimelineContext and ignoring its value would still schedule frame
|
|
10
|
+
// updates. Inactive subscribers must read a separate, never-changing context.
|
|
11
|
+
const UnsubscribedTimelineContext = (0, react_1.createContext)(null);
|
|
9
12
|
const makeKey = () => {
|
|
10
13
|
return `remotion.time-all`;
|
|
11
14
|
};
|
|
@@ -42,6 +45,9 @@ const useTimelinePositionFromContext = (state) => {
|
|
|
42
45
|
const videoConfig = (0, use_video_js_1.useVideo)();
|
|
43
46
|
const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
44
47
|
const dormant = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivityDormantContext);
|
|
48
|
+
if (state === null) {
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
45
51
|
if (!videoConfig) {
|
|
46
52
|
return typeof window === 'undefined'
|
|
47
53
|
? 0
|
|
@@ -76,6 +82,20 @@ const useTimelinePosition = () => {
|
|
|
76
82
|
return useTimelinePositionFromContext(state);
|
|
77
83
|
};
|
|
78
84
|
exports.useTimelinePosition = useTimelinePosition;
|
|
85
|
+
const useTimelinePositionWithOptionalSubscription = (subscribe) => {
|
|
86
|
+
const dormant = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivityDormantContext);
|
|
87
|
+
const state = (0, react_1.useContext)(subscribe
|
|
88
|
+
? dormant
|
|
89
|
+
? sequence_activity_context_js_1.SequenceActivityTimelineContext
|
|
90
|
+
: TimelineContext_js_1.TimelineContext
|
|
91
|
+
: UnsubscribedTimelineContext);
|
|
92
|
+
const frame = useTimelinePositionFromContext(state);
|
|
93
|
+
if (subscribe && state === null) {
|
|
94
|
+
throw new Error('TimelineContext is not available. This hook must be used inside a <Player> or the Remotion Studio.');
|
|
95
|
+
}
|
|
96
|
+
return frame;
|
|
97
|
+
};
|
|
98
|
+
exports.useTimelinePositionWithOptionalSubscription = useTimelinePositionWithOptionalSubscription;
|
|
79
99
|
const useIsInsideFreeze = () => {
|
|
80
100
|
return (0, exports.useTimelineContext)().isInsideFreeze;
|
|
81
101
|
};
|
|
@@ -102,7 +122,7 @@ const useTimelineSeekFrame = () => {
|
|
|
102
122
|
return (_a = seek === null || seek === void 0 ? void 0 : seek.seekFrame) !== null && _a !== void 0 ? _a : setFrameWithoutSeek;
|
|
103
123
|
};
|
|
104
124
|
exports.useTimelineSeekFrame = useTimelineSeekFrame;
|
|
105
|
-
|
|
125
|
+
var use_playing_js_1 = require("./use-playing.js");
|
|
106
126
|
Object.defineProperty(exports, "usePlaying", { enumerable: true, get: function () { return use_playing_js_1.usePlaying; } });
|
|
107
|
-
|
|
127
|
+
var use_buffering_js_1 = require("./use-buffering.js");
|
|
108
128
|
Object.defineProperty(exports, "useBuffering", { enumerable: true, get: function () { return use_buffering_js_1.useBuffering; } });
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type RefObject } from 'react';
|
|
2
|
+
import type { SharedElementSourceNode } from './audio/shared-element-source-node';
|
|
3
|
+
import type { LogLevel } from './log';
|
|
2
4
|
type AudioItems = {
|
|
3
5
|
gainNode: GainNode;
|
|
4
6
|
};
|
|
@@ -8,14 +10,9 @@ type AudioItems = {
|
|
|
8
10
|
*/
|
|
9
11
|
export declare const useVolume: ({ mediaRef, volume, logLevel, source, shouldUseWebAudioApi, }: {
|
|
10
12
|
mediaRef: RefObject<HTMLAudioElement | HTMLVideoElement | null>;
|
|
11
|
-
source:
|
|
12
|
-
setAudioContext: (newAudioContext: AudioContext | null) => void;
|
|
13
|
-
attemptToConnect: () => void;
|
|
14
|
-
get: () => MediaElementAudioSourceNode;
|
|
15
|
-
cleanup: () => void;
|
|
16
|
-
} | null;
|
|
13
|
+
source: SharedElementSourceNode | null;
|
|
17
14
|
volume: number;
|
|
18
|
-
logLevel:
|
|
15
|
+
logLevel: LogLevel;
|
|
19
16
|
shouldUseWebAudioApi: boolean;
|
|
20
17
|
}) => RefObject<AudioItems | null>;
|
|
21
18
|
export {};
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useCurrentFrame = void 0;
|
|
3
|
+
exports.useCurrentFrame = exports.useCurrentFrameWithOptionalSubscription = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const CanUseRemotionHooks_js_1 = require("./CanUseRemotionHooks.js");
|
|
6
6
|
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
7
7
|
const timeline_position_state_js_1 = require("./timeline-position-state.js");
|
|
8
8
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
9
|
-
|
|
10
|
-
* @description Retrieves the current frame of the video within a component. Frames are 0-indexed, and if the component is wrapped in a `<Sequence>`, it returns the frame relative to when the Sequence starts.
|
|
11
|
-
* @see [Documentation](https://www.remotion.dev/docs/use-current-frame)
|
|
12
|
-
*/
|
|
13
|
-
const useCurrentFrame = () => {
|
|
9
|
+
const useCurrentFrameWithOptionalSubscription = (subscribe) => {
|
|
14
10
|
var _a;
|
|
15
11
|
const canUseRemotionHooks = (0, react_1.useContext)(CanUseRemotionHooks_js_1.CanUseRemotionHooks);
|
|
16
12
|
const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
@@ -20,11 +16,22 @@ const useCurrentFrame = () => {
|
|
|
20
16
|
}
|
|
21
17
|
throw new Error(`useCurrentFrame() can only be called inside a component that was registered as a composition. See https://www.remotion.dev/docs/the-fundamentals#defining-compositions`);
|
|
22
18
|
}
|
|
23
|
-
const frame = (0, timeline_position_state_js_1.
|
|
19
|
+
const frame = (0, timeline_position_state_js_1.useTimelinePositionWithOptionalSubscription)(subscribe);
|
|
24
20
|
const context = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
|
|
21
|
+
if (!subscribe) {
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
25
24
|
const contextOffset = context
|
|
26
25
|
? context.cumulatedFrom + context.relativeFrom
|
|
27
26
|
: 0;
|
|
28
27
|
return (frame - contextOffset) * ((_a = context === null || context === void 0 ? void 0 : context.playbackRate) !== null && _a !== void 0 ? _a : 1);
|
|
29
28
|
};
|
|
29
|
+
exports.useCurrentFrameWithOptionalSubscription = useCurrentFrameWithOptionalSubscription;
|
|
30
|
+
/*
|
|
31
|
+
* @description Retrieves the current frame of the video within a component. Frames are 0-indexed, and if the component is wrapped in a `<Sequence>`, it returns the frame relative to when the Sequence starts.
|
|
32
|
+
* @see [Documentation](https://www.remotion.dev/docs/use-current-frame)
|
|
33
|
+
*/
|
|
34
|
+
const useCurrentFrame = () => {
|
|
35
|
+
return (0, exports.useCurrentFrameWithOptionalSubscription)(true);
|
|
36
|
+
};
|
|
30
37
|
exports.useCurrentFrame = useCurrentFrame;
|
|
@@ -42,7 +42,7 @@ export type PreviewSizeCtx = {
|
|
|
42
42
|
};
|
|
43
43
|
export declare const PreviewSizeContext: React.Context<PreviewSizeCtx>;
|
|
44
44
|
export declare const calculateScale: ({ canvasSize, compositionHeight, compositionWidth, previewSize, }: {
|
|
45
|
-
previewSize:
|
|
45
|
+
previewSize: PreviewSize['size'];
|
|
46
46
|
compositionWidth: number;
|
|
47
47
|
compositionHeight: number;
|
|
48
48
|
canvasSize: {
|
|
@@ -50,5 +50,5 @@ export declare const calculateScale: ({ canvasSize, compositionHeight, compositi
|
|
|
50
50
|
height: number;
|
|
51
51
|
};
|
|
52
52
|
}) => number;
|
|
53
|
-
export declare const useCurrentScale: (options?: Options
|
|
53
|
+
export declare const useCurrentScale: (options?: Options) => number;
|
|
54
54
|
export {};
|
|
@@ -2,10 +2,11 @@ import type { cancelRender as cancelRenderOriginal } from './cancel-render.js';
|
|
|
2
2
|
import type { DelayRenderOptions, DelayRenderScope } from './delay-render.js';
|
|
3
3
|
type DelayRenderFn = (label?: string, options?: DelayRenderOptions) => number;
|
|
4
4
|
type ContinueRenderFn = (handle: number) => void;
|
|
5
|
+
type CancelRenderFn = typeof cancelRenderOriginal;
|
|
5
6
|
export declare const DelayRenderContextType: import("react").Context<DelayRenderScope | null>;
|
|
6
7
|
export declare const useDelayRender: () => {
|
|
7
8
|
delayRender: DelayRenderFn;
|
|
8
9
|
continueRender: ContinueRenderFn;
|
|
9
|
-
cancelRender:
|
|
10
|
+
cancelRender: CancelRenderFn;
|
|
10
11
|
};
|
|
11
12
|
export {};
|
|
@@ -7,5 +7,5 @@ export declare const useLazyComponent: <Props>({ compProps, componentName, noSus
|
|
|
7
7
|
compProps: CompProps<Props>;
|
|
8
8
|
componentName: string;
|
|
9
9
|
noSuspense: boolean;
|
|
10
|
-
}) => ComponentType<Props
|
|
10
|
+
}) => LazyExoticComponent<ComponentType<Props>> | ComponentType<Props>;
|
|
11
11
|
export {};
|
|
@@ -38,6 +38,13 @@ const react_1 = __importStar(require("react"));
|
|
|
38
38
|
const registry_store_js_1 = require("./registry-store.js");
|
|
39
39
|
const use_sync_external_store_js_1 = require("./use-sync-external-store.js");
|
|
40
40
|
const useIsomorphicLayoutEffect = typeof window === 'undefined' ? react_1.useEffect : react_1.useLayoutEffect;
|
|
41
|
+
const createComponentWrapper = (componentStore) => {
|
|
42
|
+
const Wrapper = (props) => {
|
|
43
|
+
const Comp = (0, use_sync_external_store_js_1.useSyncExternalStore)(componentStore.subscribe, componentStore.getSnapshot, componentStore.getSnapshot);
|
|
44
|
+
return react_1.default.createElement(Comp, props);
|
|
45
|
+
};
|
|
46
|
+
return Wrapper;
|
|
47
|
+
};
|
|
41
48
|
// Expected, it can be any component props
|
|
42
49
|
const useLazyComponent = ({ compProps, componentName, noSuspense, }) => {
|
|
43
50
|
// Why a store + stable wrapper instead of returning compProps.component directly?
|
|
@@ -76,16 +83,19 @@ const useLazyComponent = ({ compProps, componentName, noSuspense, }) => {
|
|
|
76
83
|
componentStore.setSnapshot(() => componentFromProps);
|
|
77
84
|
}
|
|
78
85
|
}, [componentFromProps, componentStore]);
|
|
86
|
+
// Passing a bound factory keeps its closure separate from the render, including
|
|
87
|
+
// after minification. The wrapper must only retain the store, not initial props.
|
|
88
|
+
const createWrapper = createComponentWrapper;
|
|
89
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
90
|
+
const Wrapper = (0, react_1.useMemo)(createWrapper.bind(null, componentStore), [
|
|
91
|
+
componentStore,
|
|
92
|
+
]);
|
|
79
93
|
const lazy = (0, react_1.useMemo)(() => {
|
|
80
94
|
if ('component' in compProps) {
|
|
81
95
|
// In SSR, suspense is not yet supported, we cannot use React.lazy
|
|
82
96
|
if (typeof document === 'undefined' || noSuspense) {
|
|
83
97
|
return compProps.component;
|
|
84
98
|
}
|
|
85
|
-
const Wrapper = (props) => {
|
|
86
|
-
const Comp = (0, use_sync_external_store_js_1.useSyncExternalStore)(componentStore.subscribe, componentStore.getSnapshot, componentStore.getSnapshot);
|
|
87
|
-
return react_1.default.createElement(Comp, props);
|
|
88
|
-
};
|
|
89
99
|
return Wrapper;
|
|
90
100
|
}
|
|
91
101
|
if ('lazyComponent' in compProps &&
|
|
@@ -101,7 +111,7 @@ const useLazyComponent = ({ compProps, componentName, noSuspense, }) => {
|
|
|
101
111
|
// For the 'component' case, we intentionally do NOT depend on
|
|
102
112
|
// compProps.component — the stable wrapper subscribes to componentStore instead.
|
|
103
113
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
104
|
-
}, [lazyComponentFromProps, componentStore]);
|
|
114
|
+
}, [lazyComponentFromProps, componentStore, Wrapper]);
|
|
105
115
|
return lazy;
|
|
106
116
|
};
|
|
107
117
|
exports.useLazyComponent = useLazyComponent;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
import type { LogLevel } from './log';
|
|
2
3
|
export declare const useMediaBuffering: ({ element, shouldBuffer, isPremounting, isPostmounting, logLevel, mountTime, src, }: {
|
|
3
|
-
element: React.RefObject<
|
|
4
|
+
element: React.RefObject<HTMLVideoElement | HTMLAudioElement | null>;
|
|
4
5
|
shouldBuffer: boolean;
|
|
5
6
|
isPremounting: boolean;
|
|
6
7
|
isPostmounting: boolean;
|
|
7
|
-
logLevel:
|
|
8
|
+
logLevel: LogLevel;
|
|
8
9
|
mountTime: number;
|
|
9
10
|
src: string | null;
|
|
10
11
|
}) => boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
type OnDuration = (src: string, durationInSeconds: number) => void;
|
|
2
|
+
export declare const useMediaDuration: (mediaRef: React.RefObject<HTMLMediaElement | null>, onDuration: OnDuration, src: string, useCurrentSrc: boolean) => void;
|
|
3
|
+
export declare const scheduleMediaSourceCleanup: (cleanup: (() => void) | null) => void;
|
|
4
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scheduleMediaSourceCleanup = exports.useMediaDuration = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const subscribeToMediaDuration = (mediaRef, onDurationRef, src) => {
|
|
6
|
+
var _a;
|
|
7
|
+
const { current } = mediaRef;
|
|
8
|
+
if (!current) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (current.duration) {
|
|
12
|
+
(_a = onDurationRef.current) === null || _a === void 0 ? void 0 : _a.call(onDurationRef, src !== null && src !== void 0 ? src : current.src, current.duration);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const onLoadedMetadata = () => {
|
|
16
|
+
var _a;
|
|
17
|
+
(_a = onDurationRef.current) === null || _a === void 0 ? void 0 : _a.call(onDurationRef, src !== null && src !== void 0 ? src : current.src, current.duration);
|
|
18
|
+
};
|
|
19
|
+
current.addEventListener('loadedmetadata', onLoadedMetadata);
|
|
20
|
+
return () => {
|
|
21
|
+
current.removeEventListener('loadedmetadata', onLoadedMetadata);
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const useMediaDuration = (mediaRef, onDuration, src, useCurrentSrc) => {
|
|
25
|
+
const onDurationRef = (0, react_1.useRef)(onDuration);
|
|
26
|
+
onDurationRef.current = onDuration;
|
|
27
|
+
// The listener and its cleanup must not share the component render scope.
|
|
28
|
+
// Binding prevents production minifiers from inlining that scope back in.
|
|
29
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
+
(0, react_1.useEffect)(subscribeToMediaDuration.bind(null, mediaRef, onDurationRef, useCurrentSrc ? null : src), [mediaRef, src, useCurrentSrc]);
|
|
31
|
+
};
|
|
32
|
+
exports.useMediaDuration = useMediaDuration;
|
|
33
|
+
const scheduleMediaSourceCleanup = (cleanup) => {
|
|
34
|
+
requestAnimationFrame(() => cleanup === null || cleanup === void 0 ? void 0 : cleanup());
|
|
35
|
+
};
|
|
36
|
+
exports.scheduleMediaSourceCleanup = scheduleMediaSourceCleanup;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const useVideoEnabled: () => boolean;
|
|
2
2
|
export declare const useAudioEnabled: () => boolean;
|
|
3
3
|
export declare const MediaEnabledProvider: ({ children, videoEnabled, audioEnabled, }: {
|
|
4
|
-
readonly children:
|
|
4
|
+
readonly children: React.ReactNode;
|
|
5
5
|
readonly videoEnabled: boolean | null;
|
|
6
6
|
readonly audioEnabled: boolean | null;
|
|
7
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -28,6 +28,6 @@ const useAudioEnabled = () => {
|
|
|
28
28
|
exports.useAudioEnabled = useAudioEnabled;
|
|
29
29
|
const MediaEnabledProvider = ({ children, videoEnabled, audioEnabled, }) => {
|
|
30
30
|
const value = (0, react_1.useMemo)(() => ({ videoEnabled, audioEnabled }), [videoEnabled, audioEnabled]);
|
|
31
|
-
return (jsx_runtime_1.jsx(MediaEnabledContext.Provider, { value: value, children: children }));
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(MediaEnabledContext.Provider, { value: value, children: children }));
|
|
32
32
|
};
|
|
33
33
|
exports.MediaEnabledProvider = MediaEnabledProvider;
|
|
@@ -20,7 +20,7 @@ export declare const useBasicMediaInTimeline: ({ src, displayName, trimBefore, t
|
|
|
20
20
|
export type BasicMediaInTimelineReturnType = ReturnType<typeof useBasicMediaInTimeline>;
|
|
21
21
|
export declare const useMediaInTimelineRegistration: ({ src, mediaType, playbackRate, displayName, id, getStack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, documentationLink, muted, }: {
|
|
22
22
|
src: string | undefined;
|
|
23
|
-
mediaType:
|
|
23
|
+
mediaType: 'audio' | 'video';
|
|
24
24
|
playbackRate: number;
|
|
25
25
|
displayName: string | null;
|
|
26
26
|
id: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
2
|
export declare const useMediaPlayback: ({ mediaRef, src, mediaType, playbackRate: localPlaybackRate, preservePitch, onlyWarnForMediaSeekingError, acceptableTimeshift, pauseWhenBuffering, isPremounting, isPostmounting, onAutoPlayError, }: {
|
|
3
|
-
mediaRef: RefObject<
|
|
3
|
+
mediaRef: RefObject<HTMLVideoElement | HTMLAudioElement | null>;
|
|
4
4
|
src: string | undefined;
|
|
5
|
-
mediaType:
|
|
5
|
+
mediaType: 'audio' | 'video';
|
|
6
6
|
playbackRate: number;
|
|
7
7
|
preservePitch: boolean | undefined;
|
|
8
8
|
onlyWarnForMediaSeekingError: boolean;
|
|
@@ -10,5 +10,5 @@ export declare const useMediaPlayback: ({ mediaRef, src, mediaType, playbackRate
|
|
|
10
10
|
pauseWhenBuffering: boolean;
|
|
11
11
|
isPremounting: boolean;
|
|
12
12
|
isPostmounting: boolean;
|
|
13
|
-
onAutoPlayError: (() => void)
|
|
13
|
+
onAutoPlayError: null | (() => void);
|
|
14
14
|
}) => void;
|