@remotion/player 4.0.0-copy.4 → 4.0.0-esm.17
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/LICENSE.md +1 -1
- package/dist/{MediaVolumeSlider.d.ts → cjs/MediaVolumeSlider.d.ts} +0 -0
- package/dist/{MediaVolumeSlider.js → cjs/MediaVolumeSlider.js} +5 -7
- package/dist/{Player.d.ts → cjs/Player.d.ts} +1 -4
- package/dist/{Player.js → cjs/Player.js} +5 -2
- package/dist/{PlayerControls.d.ts → cjs/PlayerControls.d.ts} +0 -0
- package/dist/{PlayerControls.js → cjs/PlayerControls.js} +0 -0
- package/dist/{PlayerSeekBar.d.ts → cjs/PlayerSeekBar.d.ts} +0 -0
- package/dist/{PlayerSeekBar.js → cjs/PlayerSeekBar.js} +0 -0
- package/dist/{PlayerUI.d.ts → cjs/PlayerUI.d.ts} +2 -2
- package/dist/{PlayerUI.js → cjs/PlayerUI.js} +0 -0
- package/dist/{SharedPlayerContext.d.ts → cjs/SharedPlayerContext.d.ts} +0 -0
- package/dist/{SharedPlayerContext.js → cjs/SharedPlayerContext.js} +1 -0
- package/dist/{Thumbnail.d.ts → cjs/Thumbnail.d.ts} +0 -3
- package/dist/{Thumbnail.js → cjs/Thumbnail.js} +3 -2
- package/dist/{ThumbnailUI.d.ts → cjs/ThumbnailUI.d.ts} +2 -2
- package/dist/{ThumbnailUI.js → cjs/ThumbnailUI.js} +0 -0
- package/dist/{calculate-next-frame.d.ts → cjs/calculate-next-frame.d.ts} +0 -0
- package/dist/{calculate-next-frame.js → cjs/calculate-next-frame.js} +0 -0
- package/dist/{calculate-scale.d.ts → cjs/calculate-scale.d.ts} +0 -0
- package/dist/{calculate-scale.js → cjs/calculate-scale.js} +0 -0
- package/dist/{emitter-context.d.ts → cjs/emitter-context.d.ts} +0 -0
- package/dist/{emitter-context.js → cjs/emitter-context.js} +0 -0
- package/dist/{error-boundary.d.ts → cjs/error-boundary.d.ts} +0 -0
- package/dist/{error-boundary.js → cjs/error-boundary.js} +0 -0
- package/dist/{event-emitter.d.ts → cjs/event-emitter.d.ts} +0 -0
- package/dist/{event-emitter.js → cjs/event-emitter.js} +0 -0
- package/dist/{format-time.d.ts → cjs/format-time.d.ts} +0 -0
- package/dist/{format-time.js → cjs/format-time.js} +0 -0
- package/dist/{icons.d.ts → cjs/icons.d.ts} +0 -0
- package/dist/{icons.js → cjs/icons.js} +0 -0
- package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
- package/dist/{index.js → cjs/index.js} +0 -0
- package/dist/{player-css-classname.d.ts → cjs/player-css-classname.d.ts} +0 -0
- package/dist/{player-css-classname.js → cjs/player-css-classname.js} +0 -0
- package/dist/{player-methods.d.ts → cjs/player-methods.d.ts} +0 -0
- package/dist/{player-methods.js → cjs/player-methods.js} +0 -0
- package/dist/{test → cjs/test}/index.test.d.ts +0 -0
- package/dist/{test → cjs/test}/index.test.js +0 -0
- package/dist/{test → cjs/test}/test-utils.d.ts +0 -0
- package/dist/{test → cjs/test}/test-utils.js +0 -0
- package/dist/{test → cjs/test}/validate-in-out-frames.test.d.ts +0 -0
- package/dist/{test → cjs/test}/validate-in-out-frames.test.js +0 -0
- package/dist/{test → cjs/test}/validate-prop.test.d.ts +0 -0
- package/dist/{test → cjs/test}/validate-prop.test.js +0 -0
- package/dist/{use-hover-state.d.ts → cjs/use-hover-state.d.ts} +0 -0
- package/dist/{use-hover-state.js → cjs/use-hover-state.js} +0 -0
- package/dist/{use-playback.d.ts → cjs/use-playback.d.ts} +0 -0
- package/dist/{use-playback.js → cjs/use-playback.js} +0 -0
- package/dist/{use-player.d.ts → cjs/use-player.d.ts} +0 -0
- package/dist/{use-player.js → cjs/use-player.js} +0 -0
- package/dist/{use-thumbnail.d.ts → cjs/use-thumbnail.d.ts} +0 -0
- package/dist/{use-thumbnail.js → cjs/use-thumbnail.js} +0 -0
- package/dist/{use-video-controls-resize.d.ts → cjs/use-video-controls-resize.d.ts} +0 -0
- package/dist/{use-video-controls-resize.js → cjs/use-video-controls-resize.js} +0 -0
- package/dist/{utils → cjs/utils}/calculate-player-size.d.ts +0 -0
- package/dist/{utils → cjs/utils}/calculate-player-size.js +0 -0
- package/dist/{utils → cjs/utils}/cancellable-promise.d.ts +0 -0
- package/dist/{utils → cjs/utils}/cancellable-promise.js +0 -0
- package/dist/{utils → cjs/utils}/delay.d.ts +0 -0
- package/dist/{utils → cjs/utils}/delay.js +0 -0
- package/dist/{utils → cjs/utils}/is-node.d.ts +0 -0
- package/dist/{utils → cjs/utils}/is-node.js +0 -0
- package/dist/{utils → cjs/utils}/preview-size.d.ts +0 -0
- package/dist/{utils → cjs/utils}/preview-size.js +0 -0
- package/dist/{utils → cjs/utils}/props-if-has-props.d.ts +0 -0
- package/dist/{utils → cjs/utils}/props-if-has-props.js +0 -0
- package/dist/{utils → cjs/utils}/use-cancellable-promises.d.ts +0 -0
- package/dist/{utils → cjs/utils}/use-cancellable-promises.js +0 -0
- package/dist/{utils → cjs/utils}/use-click-prevention-on-double-click.d.ts +0 -0
- package/dist/{utils → cjs/utils}/use-click-prevention-on-double-click.js +0 -0
- package/dist/{utils → cjs/utils}/use-element-size.d.ts +1 -0
- package/dist/{utils → cjs/utils}/use-element-size.js +1 -1
- package/dist/{utils → cjs/utils}/validate-in-out-frame.d.ts +1 -1
- package/dist/{utils → cjs/utils}/validate-in-out-frame.js +13 -13
- package/dist/{utils → cjs/utils}/validate-initial-frame.d.ts +0 -0
- package/dist/{utils → cjs/utils}/validate-initial-frame.js +0 -0
- package/dist/{utils → cjs/utils}/validate-playbackrate.d.ts +0 -0
- package/dist/{utils → cjs/utils}/validate-playbackrate.js +0 -0
- package/dist/{volume-persistance.d.ts → cjs/volume-persistance.d.ts} +0 -0
- package/dist/{volume-persistance.js → cjs/volume-persistance.js} +0 -0
- package/dist/esm/MediaVolumeSlider.d.ts +5 -0
- package/dist/esm/MediaVolumeSlider.js +114 -0
- package/dist/esm/Player.d.ts +43 -0
- package/dist/esm/Player.js +136 -0
- package/dist/esm/PlayerControls.d.ts +41 -0
- package/dist/esm/PlayerControls.js +134 -0
- package/dist/esm/PlayerSeekBar.d.ts +8 -0
- package/dist/esm/PlayerSeekBar.js +142 -0
- package/dist/esm/PlayerUI.d.ts +38 -0
- package/dist/esm/PlayerUI.js +283 -0
- package/dist/esm/SharedPlayerContext.d.ts +14 -0
- package/dist/esm/SharedPlayerContext.js +68 -0
- package/dist/esm/Thumbnail.d.ts +20 -0
- package/dist/esm/Thumbnail.js +35 -0
- package/dist/esm/ThumbnailUI.d.ts +11 -0
- package/dist/esm/ThumbnailUI.js +82 -0
- package/dist/esm/calculate-next-frame.d.ts +14 -0
- package/dist/esm/calculate-next-frame.js +24 -0
- package/dist/esm/calculate-scale.d.ts +39 -0
- package/dist/esm/calculate-scale.js +77 -0
- package/dist/esm/emitter-context.d.ts +4 -0
- package/dist/esm/emitter-context.js +3 -0
- package/dist/esm/error-boundary.d.ts +19 -0
- package/dist/esm/error-boundary.js +32 -0
- package/dist/esm/event-emitter.d.ts +66 -0
- package/dist/esm/event-emitter.js +82 -0
- package/dist/esm/format-time.d.ts +1 -0
- package/dist/esm/format-time.js +5 -0
- package/dist/esm/icons.d.ts +10 -0
- package/dist/esm/icons.js +42 -0
- package/dist/esm/index.d.ts +61 -0
- package/dist/esm/index.js +20 -0
- package/dist/esm/player-css-classname.d.ts +1 -0
- package/dist/esm/player-css-classname.js +1 -0
- package/dist/esm/player-methods.d.ts +24 -0
- package/dist/esm/player-methods.js +1 -0
- package/dist/esm/test/index.test.d.ts +1 -0
- package/dist/esm/test/index.test.js +7 -0
- package/dist/esm/test/test-utils.d.ts +6 -0
- package/dist/esm/test/test-utils.js +14 -0
- package/dist/esm/test/validate-in-out-frames.test.d.ts +1 -0
- package/dist/esm/test/validate-in-out-frames.test.js +54 -0
- package/dist/esm/test/validate-prop.test.d.ts +1 -0
- package/dist/esm/test/validate-prop.test.js +129 -0
- package/dist/esm/use-hover-state.d.ts +1 -0
- package/dist/esm/use-hover-state.js +23 -0
- package/dist/esm/use-playback.d.ts +7 -0
- package/dist/esm/use-playback.js +88 -0
- package/dist/esm/use-player.d.ts +19 -0
- package/dist/esm/use-player.js +128 -0
- package/dist/esm/use-thumbnail.d.ts +6 -0
- package/dist/esm/use-thumbnail.js +14 -0
- package/dist/esm/use-video-controls-resize.d.ts +7 -0
- package/dist/esm/use-video-controls-resize.js +32 -0
- package/dist/esm/utils/calculate-player-size.d.ts +9 -0
- package/dist/esm/utils/calculate-player-size.js +25 -0
- package/dist/esm/utils/cancellable-promise.d.ts +5 -0
- package/dist/esm/utils/cancellable-promise.js +22 -0
- package/dist/esm/utils/delay.d.ts +1 -0
- package/dist/esm/utils/delay.js +2 -0
- package/dist/esm/utils/is-node.d.ts +1 -0
- package/dist/esm/utils/is-node.js +1 -0
- package/dist/esm/utils/preview-size.d.ts +8 -0
- package/dist/esm/utils/preview-size.js +1 -0
- package/dist/esm/utils/props-if-has-props.d.ts +5 -0
- package/dist/esm/utils/props-if-has-props.js +1 -0
- package/dist/esm/utils/use-cancellable-promises.d.ts +7 -0
- package/dist/esm/utils/use-cancellable-promises.js +18 -0
- package/dist/esm/utils/use-click-prevention-on-double-click.d.ts +3 -0
- package/dist/esm/utils/use-click-prevention-on-double-click.js +42 -0
- package/dist/esm/utils/use-element-size.d.ts +16 -0
- package/dist/esm/utils/use-element-size.js +93 -0
- package/dist/esm/utils/validate-in-out-frame.d.ts +6 -0
- package/dist/esm/utils/validate-in-out-frame.js +49 -0
- package/dist/esm/utils/validate-initial-frame.d.ts +4 -0
- package/dist/esm/utils/validate-initial-frame.js +23 -0
- package/dist/esm/utils/validate-playbackrate.d.ts +1 -0
- package/dist/esm/utils/validate-playbackrate.js +14 -0
- package/dist/esm/volume-persistance.d.ts +2 -0
- package/dist/esm/volume-persistance.js +14 -0
- package/dist/tsconfig-cjs.tsbuildinfo +1 -0
- package/dist/tsconfig-esm.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +19 -9
- package/dist/calc-style.d.ts +0 -7
- package/dist/calc-style.js +0 -22
- package/dist/calculate-style.d.ts +0 -19
- package/dist/calculate-style.js +0 -55
- package/dist/outer-style.d.ts +0 -7
- package/dist/outer-style.js +0 -22
package/LICENSE.md
CHANGED
|
File without changes
|
|
@@ -72,6 +72,10 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider }) => {
|
|
|
72
72
|
cursor: 'pointer',
|
|
73
73
|
height: BAR_HEIGHT,
|
|
74
74
|
width: exports.VOLUME_SLIDER_WIDTH,
|
|
75
|
+
backgroundImage: `linear-gradient(
|
|
76
|
+
to right,
|
|
77
|
+
white ${mediaVolume * 100}%, rgba(255, 255, 255, 0) ${mediaVolume * 100}%
|
|
78
|
+
)`,
|
|
75
79
|
};
|
|
76
80
|
if (displayVerticalVolumeSlider) {
|
|
77
81
|
return {
|
|
@@ -85,7 +89,7 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider }) => {
|
|
|
85
89
|
...commonStyle,
|
|
86
90
|
marginLeft: 5,
|
|
87
91
|
};
|
|
88
|
-
}, [displayVerticalVolumeSlider]);
|
|
92
|
+
}, [displayVerticalVolumeSlider, mediaVolume]);
|
|
89
93
|
const sliderStyle = `
|
|
90
94
|
.${randomClass}::-webkit-slider-thumb {
|
|
91
95
|
-webkit-appearance: none;
|
|
@@ -95,12 +99,6 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider }) => {
|
|
|
95
99
|
height: ${KNOB_SIZE}px;
|
|
96
100
|
width: ${KNOB_SIZE}px;
|
|
97
101
|
}
|
|
98
|
-
.${randomClass} {
|
|
99
|
-
background-image: linear-gradient(
|
|
100
|
-
to right,
|
|
101
|
-
white ${mediaVolume * 100}%, rgba(255, 255, 255, 0) ${mediaVolume * 100}%
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
102
|
|
|
105
103
|
.${randomClass}::-moz-range-thumb {
|
|
106
104
|
-webkit-appearance: none;
|
|
@@ -40,7 +40,4 @@ export declare type PlayerProps<T> = {
|
|
|
40
40
|
renderFullscreenButton?: RenderFullscreenButton;
|
|
41
41
|
} & PropsIfHasProps<T> & CompProps<T>;
|
|
42
42
|
export declare const componentOrNullIfLazy: <T>(props: CompProps<T>) => ComponentType<T> | null;
|
|
43
|
-
declare
|
|
44
|
-
function forwardRef<T, P = {}>(render: (props: P, ref: React.MutableRefObject<T>) => React.ReactElement | null): (props: P & React.RefAttributes<T>) => React.ReactElement | null;
|
|
45
|
-
}
|
|
46
|
-
export declare const Player: <T>(props: PlayerProps<T> & React.RefAttributes<PlayerRef>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
|
|
43
|
+
export declare const Player: <T>(props: PlayerProps<T> & React.RefAttributes<PlayerRef>) => React.ReactElement | null;
|
|
@@ -135,6 +135,9 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
135
135
|
remotion_1.Internals.CSSUtils.injectCSS(remotion_1.Internals.CSSUtils.makeDefaultCSS(`.${player_css_classname_1.PLAYER_CSS_CLASSNAME}`, '#fff'));
|
|
136
136
|
}, []);
|
|
137
137
|
}
|
|
138
|
-
return ((0, jsx_runtime_1.jsx)(SharedPlayerContext_1.SharedPlayerContexts, { timelineContext: timelineContextValue, component: component, compositionHeight: compositionHeight, compositionWidth: compositionWidth, durationInFrames: durationInFrames, fps: fps, inputProps: inputProps, numberOfSharedAudioTags: numberOfSharedAudioTags, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.Timeline.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(emitter_context_1.PlayerEventEmitterContext.Provider, { value: emitter, children: (0, jsx_runtime_1.jsx)(PlayerUI_1.default, { ref: rootRef, renderLoading: renderLoading, autoPlay: Boolean(autoPlay), loop: Boolean(loop), controls: Boolean(controls), errorFallback: errorFallback, style: style, inputProps: passedInputProps, allowFullscreen: Boolean(allowFullscreen), moveToBeginningWhenEnded: Boolean(moveToBeginningWhenEnded), clickToPlay: typeof clickToPlay === 'boolean'
|
|
138
|
+
return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.IsPlayerContextProvider, { children: (0, jsx_runtime_1.jsx)(SharedPlayerContext_1.SharedPlayerContexts, { timelineContext: timelineContextValue, component: component, compositionHeight: compositionHeight, compositionWidth: compositionWidth, durationInFrames: durationInFrames, fps: fps, inputProps: inputProps, numberOfSharedAudioTags: numberOfSharedAudioTags, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.Timeline.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(emitter_context_1.PlayerEventEmitterContext.Provider, { value: emitter, children: (0, jsx_runtime_1.jsx)(PlayerUI_1.default, { ref: rootRef, renderLoading: renderLoading, autoPlay: Boolean(autoPlay), loop: Boolean(loop), controls: Boolean(controls), errorFallback: errorFallback, style: style, inputProps: passedInputProps, allowFullscreen: Boolean(allowFullscreen), moveToBeginningWhenEnded: Boolean(moveToBeginningWhenEnded), clickToPlay: typeof clickToPlay === 'boolean'
|
|
139
|
+
? clickToPlay
|
|
140
|
+
: Boolean(controls), showVolumeControls: Boolean(showVolumeControls), doubleClickToFullscreen: Boolean(doubleClickToFullscreen), spaceKeyToPlayOrPause: Boolean(spaceKeyToPlayOrPause), playbackRate: playbackRate, className: className !== null && className !== void 0 ? className : undefined, showPosterWhenUnplayed: Boolean(showPosterWhenUnplayed), showPosterWhenEnded: Boolean(showPosterWhenEnded), showPosterWhenPaused: Boolean(showPosterWhenPaused), renderPoster: renderPoster, inFrame: inFrame !== null && inFrame !== void 0 ? inFrame : null, outFrame: outFrame !== null && outFrame !== void 0 ? outFrame : null, initiallyShowControls: initiallyShowControls !== null && initiallyShowControls !== void 0 ? initiallyShowControls : true, renderFullscreen: renderFullscreenButton !== null && renderFullscreenButton !== void 0 ? renderFullscreenButton : null, renderPlayPauseButton: renderPlayPauseButton !== null && renderPlayPauseButton !== void 0 ? renderPlayPauseButton : null }) }) }) }) }));
|
|
139
141
|
};
|
|
140
|
-
|
|
142
|
+
const forward = react_1.forwardRef;
|
|
143
|
+
exports.Player = forward(PlayerFn);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -9,7 +9,7 @@ export declare type RenderLoading = (canvas: {
|
|
|
9
9
|
width: number;
|
|
10
10
|
}) => React.ReactNode;
|
|
11
11
|
export declare type RenderPoster = RenderLoading;
|
|
12
|
-
declare const _default:
|
|
12
|
+
declare const _default: React.ForwardRefExoticComponent<{
|
|
13
13
|
controls: boolean;
|
|
14
14
|
loop: boolean;
|
|
15
15
|
autoPlay: boolean;
|
|
@@ -34,5 +34,5 @@ declare const _default: (props: {
|
|
|
34
34
|
initiallyShowControls: number | boolean;
|
|
35
35
|
renderPlayPauseButton: RenderPlayPauseButton | null;
|
|
36
36
|
renderFullscreen: RenderFullscreenButton | null;
|
|
37
|
-
} & React.RefAttributes<PlayerRef
|
|
37
|
+
} & React.RefAttributes<PlayerRef>>;
|
|
38
38
|
export default _default;
|
|
File without changes
|
|
File without changes
|
|
@@ -16,8 +16,5 @@ declare type ThumbnailProps<T> = PropsIfHasProps<T> & CompProps<T> & {
|
|
|
16
16
|
className?: string;
|
|
17
17
|
};
|
|
18
18
|
export declare const ThumbnailFn: <T>({ frameToDisplay, style, inputProps, compositionHeight, compositionWidth, durationInFrames, fps, className, errorFallback, renderLoading, ...componentProps }: ThumbnailProps<T>, ref: MutableRefObject<ThumbnailMethods>) => JSX.Element;
|
|
19
|
-
declare module 'react' {
|
|
20
|
-
function forwardRef<T, P = {}>(render: (props: P, ref: React.MutableRefObject<T>) => React.ReactElement | null): (props: P & React.RefAttributes<T>) => React.ReactElement | null;
|
|
21
|
-
}
|
|
22
19
|
export declare const Thumbnail: <T>(props: ThumbnailProps<T> & import("react").RefAttributes<ThumbnailMethods>) => React.ReactElement | null;
|
|
23
20
|
export {};
|
|
@@ -35,7 +35,8 @@ const ThumbnailFn = ({ frameToDisplay, style, inputProps, compositionHeight, com
|
|
|
35
35
|
const passedInputProps = (0, react_1.useMemo)(() => {
|
|
36
36
|
return inputProps !== null && inputProps !== void 0 ? inputProps : {};
|
|
37
37
|
}, [inputProps]);
|
|
38
|
-
return ((0, jsx_runtime_1.jsx)(SharedPlayerContext_1.SharedPlayerContexts, { timelineContext: timelineState, component: Component, compositionHeight: compositionHeight, compositionWidth: compositionWidth, durationInFrames: durationInFrames, fps: fps, inputProps: inputProps, numberOfSharedAudioTags: 0, children: (0, jsx_runtime_1.jsx)(emitter_context_1.ThumbnailEmitterContext.Provider, { value: emitter, children: (0, jsx_runtime_1.jsx)(ThumbnailUI_1.default, { className: className, errorFallback: errorFallback, inputProps: passedInputProps, renderLoading: renderLoading, style: style }) }) }));
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.IsPlayerContextProvider, { children: (0, jsx_runtime_1.jsx)(SharedPlayerContext_1.SharedPlayerContexts, { timelineContext: timelineState, component: Component, compositionHeight: compositionHeight, compositionWidth: compositionWidth, durationInFrames: durationInFrames, fps: fps, inputProps: inputProps, numberOfSharedAudioTags: 0, children: (0, jsx_runtime_1.jsx)(emitter_context_1.ThumbnailEmitterContext.Provider, { value: emitter, children: (0, jsx_runtime_1.jsx)(ThumbnailUI_1.default, { className: className, errorFallback: errorFallback, inputProps: passedInputProps, renderLoading: renderLoading, style: style }) }) }) }));
|
|
39
39
|
};
|
|
40
40
|
exports.ThumbnailFn = ThumbnailFn;
|
|
41
|
-
|
|
41
|
+
const forward = react_1.forwardRef;
|
|
42
|
+
exports.Thumbnail = forward(exports.ThumbnailFn);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ThumbnailMethods } from './player-methods';
|
|
3
3
|
import type { ErrorFallback, RenderLoading } from './PlayerUI';
|
|
4
|
-
declare const _default:
|
|
4
|
+
declare const _default: React.ForwardRefExoticComponent<{
|
|
5
5
|
inputProps: unknown;
|
|
6
6
|
style?: React.CSSProperties | undefined;
|
|
7
7
|
errorFallback: ErrorFallback;
|
|
8
8
|
renderLoading: RenderLoading | undefined;
|
|
9
9
|
className: string | undefined;
|
|
10
|
-
} & React.RefAttributes<ThumbnailMethods
|
|
10
|
+
} & React.RefAttributes<ThumbnailMethods>>;
|
|
11
11
|
export default _default;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -93,6 +93,6 @@ const useElementSize = (ref, options) => {
|
|
|
93
93
|
elementSizeHooks = elementSizeHooks.filter((e) => e !== updateSize);
|
|
94
94
|
};
|
|
95
95
|
}, [updateSize]);
|
|
96
|
-
return size;
|
|
96
|
+
return size ? { ...size, refresh: updateSize } : null;
|
|
97
97
|
};
|
|
98
98
|
exports.useElementSize = useElementSize;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const validateSingleFrame: (frame: unknown, variableName: string) => number | null;
|
|
2
2
|
export declare const validateInOutFrames: ({ inFrame, durationInFrames, outFrame, }: {
|
|
3
3
|
inFrame: unknown;
|
|
4
4
|
outFrame: unknown;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateInOutFrames = exports.
|
|
4
|
-
const
|
|
3
|
+
exports.validateInOutFrames = exports.validateSingleFrame = void 0;
|
|
4
|
+
const validateSingleFrame = (frame, variableName) => {
|
|
5
5
|
if (typeof frame === 'undefined' || frame === null) {
|
|
6
6
|
return frame !== null && frame !== void 0 ? frame : null;
|
|
7
7
|
}
|
|
@@ -19,11 +19,11 @@ const validateSingleFrameFrame = (frame, variableName) => {
|
|
|
19
19
|
}
|
|
20
20
|
return frame;
|
|
21
21
|
};
|
|
22
|
-
exports.
|
|
22
|
+
exports.validateSingleFrame = validateSingleFrame;
|
|
23
23
|
const validateInOutFrames = ({ inFrame, durationInFrames, outFrame, }) => {
|
|
24
|
-
const validatedInFrame = (0, exports.
|
|
25
|
-
const
|
|
26
|
-
if (validatedInFrame === null &&
|
|
24
|
+
const validatedInFrame = (0, exports.validateSingleFrame)(inFrame, 'inFrame');
|
|
25
|
+
const validatedOutFrame = (0, exports.validateSingleFrame)(outFrame, 'outFrame');
|
|
26
|
+
if (validatedInFrame === null && validatedOutFrame === null) {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
// Must not be over the duration
|
|
@@ -31,22 +31,22 @@ const validateInOutFrames = ({ inFrame, durationInFrames, outFrame, }) => {
|
|
|
31
31
|
throw new Error('inFrame must be less than (durationInFrames - 1), but is ' +
|
|
32
32
|
validatedInFrame);
|
|
33
33
|
}
|
|
34
|
-
if (
|
|
34
|
+
if (validatedOutFrame !== null && validatedOutFrame > durationInFrames - 1) {
|
|
35
35
|
throw new Error('outFrame must be less than (durationInFrames - 1), but is ' +
|
|
36
|
-
|
|
36
|
+
validatedOutFrame);
|
|
37
37
|
}
|
|
38
38
|
// Must not be under 0
|
|
39
39
|
if (validatedInFrame !== null && validatedInFrame < 0) {
|
|
40
40
|
throw new Error('inFrame must be greater than 0, but is ' + validatedInFrame);
|
|
41
41
|
}
|
|
42
|
-
if (
|
|
43
|
-
throw new Error(
|
|
42
|
+
if (validatedOutFrame !== null && validatedOutFrame <= 0) {
|
|
43
|
+
throw new Error(`outFrame must be greater than 0, but is ${validatedOutFrame}. If you want to render a single frame, use <Thumbnail /> instead.`);
|
|
44
44
|
}
|
|
45
|
-
if (
|
|
45
|
+
if (validatedOutFrame !== null &&
|
|
46
46
|
validatedInFrame !== null &&
|
|
47
|
-
|
|
47
|
+
validatedOutFrame <= validatedInFrame) {
|
|
48
48
|
throw new Error('outFrame must be greater than inFrame, but is ' +
|
|
49
|
-
|
|
49
|
+
validatedOutFrame +
|
|
50
50
|
' <= ' +
|
|
51
51
|
validatedInFrame);
|
|
52
52
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useId, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { Internals, random } from 'remotion';
|
|
4
|
+
import { ICON_SIZE, VolumeOffIcon, VolumeOnIcon } from './icons';
|
|
5
|
+
import { useHoverState } from './use-hover-state';
|
|
6
|
+
const BAR_HEIGHT = 5;
|
|
7
|
+
const KNOB_SIZE = 12;
|
|
8
|
+
export const VOLUME_SLIDER_WIDTH = 100;
|
|
9
|
+
export const MediaVolumeSlider = ({ displayVerticalVolumeSlider }) => {
|
|
10
|
+
const [mediaMuted, setMediaMuted] = Internals.useMediaMutedState();
|
|
11
|
+
const [mediaVolume, setMediaVolume] = Internals.useMediaVolumeState();
|
|
12
|
+
const [focused, setFocused] = useState(false);
|
|
13
|
+
const parentDivRef = useRef(null);
|
|
14
|
+
const inputRef = useRef(null);
|
|
15
|
+
const hover = useHoverState(parentDivRef);
|
|
16
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
17
|
+
const randomId = typeof useId === 'undefined' ? 'volume-slider' : useId();
|
|
18
|
+
const [randomClass] = useState(() => `__remotion-volume-slider-${random(randomId)}`.replace('.', ''));
|
|
19
|
+
const isMutedOrZero = mediaMuted || mediaVolume === 0;
|
|
20
|
+
const onVolumeChange = (e) => {
|
|
21
|
+
setMediaVolume(parseFloat(e.target.value));
|
|
22
|
+
};
|
|
23
|
+
const onBlur = () => {
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
// We need a small delay to check which element was focused next,
|
|
26
|
+
// and if it wasn't the volume slider, we hide it
|
|
27
|
+
if (document.activeElement !== inputRef.current) {
|
|
28
|
+
setFocused(false);
|
|
29
|
+
}
|
|
30
|
+
}, 10);
|
|
31
|
+
};
|
|
32
|
+
const onClick = useCallback(() => {
|
|
33
|
+
if (mediaVolume === 0) {
|
|
34
|
+
setMediaVolume(1);
|
|
35
|
+
setMediaMuted(false);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
setMediaMuted((mute) => !mute);
|
|
39
|
+
}, [mediaVolume, setMediaMuted, setMediaVolume]);
|
|
40
|
+
const parentDivStyle = useMemo(() => {
|
|
41
|
+
return {
|
|
42
|
+
display: 'inline-flex',
|
|
43
|
+
background: 'none',
|
|
44
|
+
border: 'none',
|
|
45
|
+
padding: '6px',
|
|
46
|
+
justifyContent: 'center',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
touchAction: 'none',
|
|
49
|
+
...(displayVerticalVolumeSlider && { position: 'relative' }),
|
|
50
|
+
};
|
|
51
|
+
}, [displayVerticalVolumeSlider]);
|
|
52
|
+
const volumeContainer = useMemo(() => {
|
|
53
|
+
return {
|
|
54
|
+
display: 'inline',
|
|
55
|
+
width: ICON_SIZE,
|
|
56
|
+
height: ICON_SIZE,
|
|
57
|
+
cursor: 'pointer',
|
|
58
|
+
appearance: 'none',
|
|
59
|
+
background: 'none',
|
|
60
|
+
border: 'none',
|
|
61
|
+
padding: 0,
|
|
62
|
+
};
|
|
63
|
+
}, []);
|
|
64
|
+
const inputStyle = useMemo(() => {
|
|
65
|
+
const commonStyle = {
|
|
66
|
+
WebkitAppearance: 'none',
|
|
67
|
+
backgroundColor: 'rgba(255, 255, 255, 0.5)',
|
|
68
|
+
borderRadius: BAR_HEIGHT / 2,
|
|
69
|
+
cursor: 'pointer',
|
|
70
|
+
height: BAR_HEIGHT,
|
|
71
|
+
width: VOLUME_SLIDER_WIDTH,
|
|
72
|
+
backgroundImage: `linear-gradient(
|
|
73
|
+
to right,
|
|
74
|
+
white ${mediaVolume * 100}%, rgba(255, 255, 255, 0) ${mediaVolume * 100}%
|
|
75
|
+
)`,
|
|
76
|
+
};
|
|
77
|
+
if (displayVerticalVolumeSlider) {
|
|
78
|
+
return {
|
|
79
|
+
...commonStyle,
|
|
80
|
+
transform: `rotate(-90deg)`,
|
|
81
|
+
position: 'absolute',
|
|
82
|
+
bottom: ICON_SIZE + VOLUME_SLIDER_WIDTH / 2 + 5,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
...commonStyle,
|
|
87
|
+
marginLeft: 5,
|
|
88
|
+
};
|
|
89
|
+
}, [displayVerticalVolumeSlider, mediaVolume]);
|
|
90
|
+
const sliderStyle = `
|
|
91
|
+
.${randomClass}::-webkit-slider-thumb {
|
|
92
|
+
-webkit-appearance: none;
|
|
93
|
+
background-color: white;
|
|
94
|
+
border-radius: ${KNOB_SIZE / 2}px;
|
|
95
|
+
box-shadow: 0 0 2px black;
|
|
96
|
+
height: ${KNOB_SIZE}px;
|
|
97
|
+
width: ${KNOB_SIZE}px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.${randomClass}::-moz-range-thumb {
|
|
101
|
+
-webkit-appearance: none;
|
|
102
|
+
background-color: white;
|
|
103
|
+
border-radius: ${KNOB_SIZE / 2}px;
|
|
104
|
+
box-shadow: 0 0 2px black;
|
|
105
|
+
height: ${KNOB_SIZE}px;
|
|
106
|
+
width: ${KNOB_SIZE}px;
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
return (_jsxs("div", { ref: parentDivRef, style: parentDivStyle, children: [_jsx("style", {
|
|
110
|
+
// eslint-disable-next-line react/no-danger
|
|
111
|
+
dangerouslySetInnerHTML: {
|
|
112
|
+
__html: sliderStyle,
|
|
113
|
+
} }), _jsx("button", { "aria-label": isMutedOrZero ? 'Unmute sound' : 'Mute sound', title: isMutedOrZero ? 'Unmute sound' : 'Mute sound', onClick: onClick, onBlur: onBlur, onFocus: () => setFocused(true), style: volumeContainer, type: "button", children: isMutedOrZero ? _jsx(VolumeOffIcon, {}) : _jsx(VolumeOnIcon, {}) }), (focused || hover) && !mediaMuted ? (_jsx("input", { ref: inputRef, "aria-label": "Change volume", className: randomClass, max: 1, min: 0, onBlur: () => setFocused(false), onChange: onVolumeChange, step: 0.01, type: "range", value: mediaVolume, style: inputStyle })) : null] }));
|
|
114
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { CompProps } from 'remotion';
|
|
4
|
+
import type { PlayerRef } from './player-methods';
|
|
5
|
+
import type { RenderFullscreenButton, RenderPlayPauseButton } from './PlayerControls';
|
|
6
|
+
import type { RenderLoading, RenderPoster } from './PlayerUI';
|
|
7
|
+
import type { PropsIfHasProps } from './utils/props-if-has-props';
|
|
8
|
+
export declare type ErrorFallback = (info: {
|
|
9
|
+
error: Error;
|
|
10
|
+
}) => React.ReactNode;
|
|
11
|
+
export declare type PlayerProps<T> = {
|
|
12
|
+
durationInFrames: number;
|
|
13
|
+
compositionWidth: number;
|
|
14
|
+
compositionHeight: number;
|
|
15
|
+
fps: number;
|
|
16
|
+
showVolumeControls?: boolean;
|
|
17
|
+
controls?: boolean;
|
|
18
|
+
errorFallback?: ErrorFallback;
|
|
19
|
+
style?: React.CSSProperties;
|
|
20
|
+
loop?: boolean;
|
|
21
|
+
autoPlay?: boolean;
|
|
22
|
+
allowFullscreen?: boolean;
|
|
23
|
+
clickToPlay?: boolean;
|
|
24
|
+
doubleClickToFullscreen?: boolean;
|
|
25
|
+
spaceKeyToPlayOrPause?: boolean;
|
|
26
|
+
numberOfSharedAudioTags?: number;
|
|
27
|
+
playbackRate?: number;
|
|
28
|
+
renderLoading?: RenderLoading;
|
|
29
|
+
moveToBeginningWhenEnded?: boolean;
|
|
30
|
+
className?: string;
|
|
31
|
+
initialFrame?: number;
|
|
32
|
+
renderPoster?: RenderPoster;
|
|
33
|
+
showPosterWhenPaused?: boolean;
|
|
34
|
+
showPosterWhenEnded?: boolean;
|
|
35
|
+
showPosterWhenUnplayed?: boolean;
|
|
36
|
+
inFrame?: number | null;
|
|
37
|
+
outFrame?: number | null;
|
|
38
|
+
initiallyShowControls?: number | boolean;
|
|
39
|
+
renderPlayPauseButton?: RenderPlayPauseButton;
|
|
40
|
+
renderFullscreenButton?: RenderFullscreenButton;
|
|
41
|
+
} & PropsIfHasProps<T> & CompProps<T>;
|
|
42
|
+
export declare const componentOrNullIfLazy: <T>(props: CompProps<T>) => ComponentType<T> | null;
|
|
43
|
+
export declare const Player: <T>(props: PlayerProps<T> & React.RefAttributes<PlayerRef>) => React.ReactElement | null;
|