remotion 4.0.185 → 4.0.187
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/audio/AudioForPreview.js +2 -0
- package/dist/cjs/audio/shared-audio-tags.d.ts +3 -3
- package/dist/cjs/audio/shared-audio-tags.js +1 -1
- package/dist/cjs/internals.d.ts +3 -3
- package/dist/cjs/play-and-handle-not-allowed-error.d.ts +1 -1
- package/dist/cjs/play-and-handle-not-allowed-error.js +10 -1
- package/dist/cjs/use-media-in-timeline.d.ts +2 -1
- package/dist/cjs/use-media-in-timeline.js +3 -3
- package/dist/cjs/use-media-playback.d.ts +2 -1
- package/dist/cjs/use-media-playback.js +4 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/OffthreadVideo.js +2 -2
- package/dist/cjs/video/OffthreadVideoForRendering.js +6 -3
- package/dist/cjs/video/Video.d.ts +1 -0
- package/dist/cjs/video/Video.js +2 -2
- package/dist/cjs/video/VideoForPreview.js +3 -1
- package/dist/cjs/video/VideoForRendering.d.ts +1 -0
- package/dist/cjs/video/props.d.ts +2 -0
- package/dist/esm/index.mjs +63 -85
- package/dist/esm/no-react.mjs +6 -6
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
|
@@ -86,6 +86,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
86
86
|
stack: _remotionInternalStack,
|
|
87
87
|
showInTimeline,
|
|
88
88
|
premountDisplay: null,
|
|
89
|
+
onAutoPlayError: null,
|
|
89
90
|
});
|
|
90
91
|
(0, use_media_playback_js_1.useMediaPlayback)({
|
|
91
92
|
mediaRef: audioRef,
|
|
@@ -97,6 +98,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
97
98
|
isPremounting: Boolean(sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.premounting),
|
|
98
99
|
pauseWhenBuffering,
|
|
99
100
|
debugSeeking: _remotionDebugSeeking,
|
|
101
|
+
onAutoPlayError: null,
|
|
100
102
|
});
|
|
101
103
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
102
104
|
return audioRef.current;
|
|
@@ -31,9 +31,9 @@ type SharedContext = {
|
|
|
31
31
|
};
|
|
32
32
|
export declare const SharedAudioContext: React.Context<SharedContext | null>;
|
|
33
33
|
export declare const SharedAudioContextProvider: React.FC<{
|
|
34
|
-
numberOfAudioTags: number;
|
|
35
|
-
children: React.ReactNode;
|
|
36
|
-
component: LazyExoticComponent<ComponentType<Record<string, unknown>>> | null;
|
|
34
|
+
readonly numberOfAudioTags: number;
|
|
35
|
+
readonly children: React.ReactNode;
|
|
36
|
+
readonly component: LazyExoticComponent<ComponentType<Record<string, unknown>>> | null;
|
|
37
37
|
}>;
|
|
38
38
|
export declare const useSharedAudio: (aud: RemotionAudioProps, audioId: string) => AudioElem;
|
|
39
39
|
export {};
|
|
@@ -158,7 +158,7 @@ const SharedAudioContextProvider = ({ children, numberOfAudioTags, component })
|
|
|
158
158
|
}, [rerenderAudios]);
|
|
159
159
|
const playAllAudios = (0, react_1.useCallback)(() => {
|
|
160
160
|
refs.forEach((ref) => {
|
|
161
|
-
(0, play_and_handle_not_allowed_error_js_1.playAndHandleNotAllowedError)(ref.ref, 'audio');
|
|
161
|
+
(0, play_and_handle_not_allowed_error_js_1.playAndHandleNotAllowedError)(ref.ref, 'audio', null);
|
|
162
162
|
});
|
|
163
163
|
}, [refs]);
|
|
164
164
|
const value = (0, react_1.useMemo)(() => {
|
package/dist/cjs/internals.d.ts
CHANGED
|
@@ -56,9 +56,9 @@ export declare const Internals: {
|
|
|
56
56
|
numberOfAudioTags: number;
|
|
57
57
|
} | null>;
|
|
58
58
|
readonly SharedAudioContextProvider: import("react").FC<{
|
|
59
|
-
numberOfAudioTags: number;
|
|
60
|
-
children: import("react").ReactNode;
|
|
61
|
-
component: import("react").LazyExoticComponent<import("react").ComponentType<Record<string, unknown>>> | null;
|
|
59
|
+
readonly numberOfAudioTags: number;
|
|
60
|
+
readonly children: import("react").ReactNode;
|
|
61
|
+
readonly component: import("react").LazyExoticComponent<import("react").ComponentType<Record<string, unknown>>> | null;
|
|
62
62
|
}>;
|
|
63
63
|
readonly invalidCompositionErrorMessage: string;
|
|
64
64
|
readonly isCompositionIdValid: (id: string) => RegExpMatchArray | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
|
-
export declare const playAndHandleNotAllowedError: (mediaRef: RefObject<HTMLVideoElement | HTMLAudioElement>, mediaType: 'audio' | 'video') => void;
|
|
2
|
+
export declare const playAndHandleNotAllowedError: (mediaRef: RefObject<HTMLVideoElement | HTMLAudioElement>, mediaType: 'audio' | 'video', onAutoPlayError: null | (() => void)) => void;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.playAndHandleNotAllowedError = void 0;
|
|
4
|
-
const
|
|
4
|
+
const get_remotion_environment_1 = require("./get-remotion-environment");
|
|
5
|
+
const playAndHandleNotAllowedError = (mediaRef, mediaType, onAutoPlayError) => {
|
|
5
6
|
const { current } = mediaRef;
|
|
6
7
|
if (!current) {
|
|
7
8
|
return;
|
|
@@ -35,8 +36,16 @@ const playAndHandleNotAllowedError = (mediaRef, mediaType) => {
|
|
|
35
36
|
// eslint-disable-next-line no-console
|
|
36
37
|
console.log(`Could not play ${mediaType} due to following error: `, err);
|
|
37
38
|
if (!current.muted) {
|
|
39
|
+
if (onAutoPlayError) {
|
|
40
|
+
onAutoPlayError();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
38
43
|
// eslint-disable-next-line no-console
|
|
39
44
|
console.log(`The video will be muted and we'll retry playing it.`);
|
|
45
|
+
if (mediaType === 'video' && (0, get_remotion_environment_1.getRemotionEnvironment)().isPlayer) {
|
|
46
|
+
// eslint-disable-next-line no-console
|
|
47
|
+
console.log('Use onAutoPlayError() to handle this error yourself.');
|
|
48
|
+
}
|
|
40
49
|
current.muted = true;
|
|
41
50
|
current.play();
|
|
42
51
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
2
|
import type { VolumeProp } from './volume-prop.js';
|
|
3
|
-
export declare const useMediaInTimeline: ({ volume, mediaVolume, mediaRef, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, }: {
|
|
3
|
+
export declare const useMediaInTimeline: ({ volume, mediaVolume, mediaRef, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, onAutoPlayError, }: {
|
|
4
4
|
volume: VolumeProp | undefined;
|
|
5
5
|
mediaVolume: number;
|
|
6
6
|
mediaRef: RefObject<HTMLAudioElement | HTMLVideoElement>;
|
|
@@ -12,4 +12,5 @@ export declare const useMediaInTimeline: ({ volume, mediaVolume, mediaRef, src,
|
|
|
12
12
|
stack: string | null;
|
|
13
13
|
showInTimeline: boolean;
|
|
14
14
|
premountDisplay: number | null;
|
|
15
|
+
onAutoPlayError: null | (() => void);
|
|
15
16
|
}) => void;
|
|
@@ -21,7 +21,7 @@ const warnOnce = (message) => {
|
|
|
21
21
|
console.warn(message);
|
|
22
22
|
didWarn[message] = true;
|
|
23
23
|
};
|
|
24
|
-
const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, }) => {
|
|
24
|
+
const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, onAutoPlayError, }) => {
|
|
25
25
|
const videoConfig = (0, use_video_config_js_1.useVideoConfig)();
|
|
26
26
|
const { rootId, audioAndVideoTags } = (0, react_1.useContext)(timeline_position_state_js_1.TimelineContext);
|
|
27
27
|
const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
|
|
@@ -125,13 +125,13 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, pla
|
|
|
125
125
|
// Don't play if for example in a <Freeze> state.
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
|
-
return (0, play_and_handle_not_allowed_error_js_1.playAndHandleNotAllowedError)(mediaRef, mediaType);
|
|
128
|
+
return (0, play_and_handle_not_allowed_error_js_1.playAndHandleNotAllowedError)(mediaRef, mediaType, onAutoPlayError);
|
|
129
129
|
},
|
|
130
130
|
};
|
|
131
131
|
audioAndVideoTags.current.push(tag);
|
|
132
132
|
return () => {
|
|
133
133
|
audioAndVideoTags.current = audioAndVideoTags.current.filter((a) => a.id !== id);
|
|
134
134
|
};
|
|
135
|
-
}, [audioAndVideoTags, id, mediaRef, mediaType, playing]);
|
|
135
|
+
}, [audioAndVideoTags, id, mediaRef, mediaType, onAutoPlayError, playing]);
|
|
136
136
|
};
|
|
137
137
|
exports.useMediaInTimeline = useMediaInTimeline;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
2
|
export declare const DEFAULT_ACCEPTABLE_TIMESHIFT = 0.45;
|
|
3
|
-
export declare const useMediaPlayback: ({ mediaRef, src, mediaType, playbackRate: localPlaybackRate, onlyWarnForMediaSeekingError, acceptableTimeshift, pauseWhenBuffering, isPremounting, debugSeeking, }: {
|
|
3
|
+
export declare const useMediaPlayback: ({ mediaRef, src, mediaType, playbackRate: localPlaybackRate, onlyWarnForMediaSeekingError, acceptableTimeshift, pauseWhenBuffering, isPremounting, debugSeeking, onAutoPlayError, }: {
|
|
4
4
|
mediaRef: RefObject<HTMLVideoElement | HTMLAudioElement>;
|
|
5
5
|
src: string | undefined;
|
|
6
6
|
mediaType: 'audio' | 'video';
|
|
@@ -10,4 +10,5 @@ export declare const useMediaPlayback: ({ mediaRef, src, mediaType, playbackRate
|
|
|
10
10
|
pauseWhenBuffering: boolean;
|
|
11
11
|
isPremounting: boolean;
|
|
12
12
|
debugSeeking: boolean;
|
|
13
|
+
onAutoPlayError: null | (() => void);
|
|
13
14
|
}) => void;
|
|
@@ -23,7 +23,7 @@ const seek = (mediaRef, time) => {
|
|
|
23
23
|
const timeToSet = (0, video_fragment_js_1.isIosSafari)() ? Number(time.toFixed(1)) : time;
|
|
24
24
|
mediaRef.current.currentTime = timeToSet;
|
|
25
25
|
};
|
|
26
|
-
const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybackRate, onlyWarnForMediaSeekingError, acceptableTimeshift, pauseWhenBuffering, isPremounting, debugSeeking, }) => {
|
|
26
|
+
const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybackRate, onlyWarnForMediaSeekingError, acceptableTimeshift, pauseWhenBuffering, isPremounting, debugSeeking, onAutoPlayError, }) => {
|
|
27
27
|
const { playbackRate: globalPlaybackRate } = (0, react_1.useContext)(timeline_position_state_js_1.TimelineContext);
|
|
28
28
|
const frame = (0, use_current_frame_js_1.useCurrentFrame)();
|
|
29
29
|
const absoluteFrame = (0, timeline_position_state_js_1.useTimelinePosition)();
|
|
@@ -144,7 +144,7 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
|
|
|
144
144
|
if (playing && !isVariableFpsVideo) {
|
|
145
145
|
bufferUntilFirstFrame(shouldBeTime);
|
|
146
146
|
if (mediaRef.current.paused) {
|
|
147
|
-
(0, play_and_handle_not_allowed_error_js_1.playAndHandleNotAllowedError)(mediaRef, mediaType);
|
|
147
|
+
(0, play_and_handle_not_allowed_error_js_1.playAndHandleNotAllowedError)(mediaRef, mediaType, onAutoPlayError);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
if (!onlyWarnForMediaSeekingError) {
|
|
@@ -173,7 +173,7 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
|
|
|
173
173
|
if (makesSenseToSeek) {
|
|
174
174
|
seek(mediaRef, shouldBeTime);
|
|
175
175
|
}
|
|
176
|
-
(0, play_and_handle_not_allowed_error_js_1.playAndHandleNotAllowedError)(mediaRef, mediaType);
|
|
176
|
+
(0, play_and_handle_not_allowed_error_js_1.playAndHandleNotAllowedError)(mediaRef, mediaType, onAutoPlayError);
|
|
177
177
|
if (!isVariableFpsVideo) {
|
|
178
178
|
bufferUntilFirstFrame(shouldBeTime);
|
|
179
179
|
}
|
|
@@ -194,6 +194,7 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
|
|
|
194
194
|
playbackRate,
|
|
195
195
|
playing,
|
|
196
196
|
src,
|
|
197
|
+
onAutoPlayError,
|
|
197
198
|
]);
|
|
198
199
|
};
|
|
199
200
|
exports.useMediaPlayback = useMediaPlayback;
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -35,7 +35,7 @@ const OffthreadVideo = (props) => {
|
|
|
35
35
|
if (environment.isRendering) {
|
|
36
36
|
return (0, jsx_runtime_1.jsx)(OffthreadVideoForRendering_js_1.OffthreadVideoForRendering, { ...otherProps });
|
|
37
37
|
}
|
|
38
|
-
const { transparent, toneMapped, _remotionDebugSeeking, ...withoutTransparent } = otherProps;
|
|
39
|
-
return ((0, jsx_runtime_1.jsx)(VideoForPreview_js_1.VideoForPreview, { _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null, _remotionInternalNativeLoopPassed: false, _remotionDebugSeeking: _remotionDebugSeeking !== null && _remotionDebugSeeking !== void 0 ? _remotionDebugSeeking : false, onDuration: onDuration, onlyWarnForMediaSeekingError: true, pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, ...withoutTransparent }));
|
|
38
|
+
const { transparent, toneMapped, _remotionDebugSeeking, onAutoPlayError, ...withoutTransparent } = otherProps;
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(VideoForPreview_js_1.VideoForPreview, { _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null, _remotionInternalNativeLoopPassed: false, _remotionDebugSeeking: _remotionDebugSeeking !== null && _remotionDebugSeeking !== void 0 ? _remotionDebugSeeking : false, onDuration: onDuration, onlyWarnForMediaSeekingError: true, pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, onAutoPlayError: onAutoPlayError !== null && onAutoPlayError !== void 0 ? onAutoPlayError : undefined, ...withoutTransparent }));
|
|
40
40
|
};
|
|
41
41
|
exports.OffthreadVideo = OffthreadVideo;
|
|
@@ -130,8 +130,10 @@ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate,
|
|
|
130
130
|
const blob = await res.blob();
|
|
131
131
|
const url = URL.createObjectURL(blob);
|
|
132
132
|
cleanup.push(() => URL.revokeObjectURL(url));
|
|
133
|
-
setImageSrc(
|
|
134
|
-
|
|
133
|
+
setImageSrc({
|
|
134
|
+
src: url,
|
|
135
|
+
handle: newHandle,
|
|
136
|
+
});
|
|
135
137
|
}
|
|
136
138
|
catch (err) {
|
|
137
139
|
if (onError) {
|
|
@@ -174,6 +176,7 @@ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate,
|
|
|
174
176
|
if (!imageSrc) {
|
|
175
177
|
return null;
|
|
176
178
|
}
|
|
177
|
-
|
|
179
|
+
(0, delay_render_js_1.continueRender)(imageSrc.handle);
|
|
180
|
+
return ((0, jsx_runtime_1.jsx)(Img_js_1.Img, { src: imageSrc.src, className: className, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, ...props, onError: onErr }));
|
|
178
181
|
};
|
|
179
182
|
exports.OffthreadVideoForRendering = OffthreadVideoForRendering;
|
|
@@ -17,6 +17,7 @@ export declare const Video: React.ForwardRefExoticComponent<Omit<Omit<React.Deta
|
|
|
17
17
|
loopVolumeCurveBehavior?: import("../audio/use-audio-frame.js").LoopVolumeCurveBehavior | undefined;
|
|
18
18
|
delayRenderRetries?: number | undefined;
|
|
19
19
|
onError?: ((err: Error) => void) | undefined;
|
|
20
|
+
onAutoPlayError?: (() => void) | undefined;
|
|
20
21
|
} & RemotionMainVideoProps & {
|
|
21
22
|
/**
|
|
22
23
|
* @deprecated For internal use only
|
package/dist/cjs/video/Video.js
CHANGED
|
@@ -19,7 +19,7 @@ const VideoForRendering_js_1 = require("./VideoForRendering.js");
|
|
|
19
19
|
const duration_state_js_1 = require("./duration-state.js");
|
|
20
20
|
const VideoForwardingFunction = (props, ref) => {
|
|
21
21
|
var _a, _b;
|
|
22
|
-
const { startFrom, endAt, name, pauseWhenBuffering, stack, _remotionInternalNativeLoopPassed, showInTimeline, ...otherProps } = props;
|
|
22
|
+
const { startFrom, endAt, name, pauseWhenBuffering, stack, _remotionInternalNativeLoopPassed, showInTimeline, onAutoPlayError, ...otherProps } = props;
|
|
23
23
|
const { loop, _remotionDebugSeeking, ...propsOtherThanLoop } = props;
|
|
24
24
|
const { fps } = (0, use_video_config_js_1.useVideoConfig)();
|
|
25
25
|
const environment = (0, get_remotion_environment_js_1.getRemotionEnvironment)();
|
|
@@ -56,7 +56,7 @@ const VideoForwardingFunction = (props, ref) => {
|
|
|
56
56
|
}
|
|
57
57
|
return ((0, jsx_runtime_1.jsx)(VideoForPreview_js_1.VideoForPreview, { onlyWarnForMediaSeekingError: false, ...otherProps, ref: ref,
|
|
58
58
|
// Proposal: Make this default to true in v5
|
|
59
|
-
pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, onDuration: onDuration, _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null, _remotionInternalNativeLoopPassed: _remotionInternalNativeLoopPassed !== null && _remotionInternalNativeLoopPassed !== void 0 ? _remotionInternalNativeLoopPassed : false, _remotionDebugSeeking: _remotionDebugSeeking !== null && _remotionDebugSeeking !== void 0 ? _remotionDebugSeeking : false, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true }));
|
|
59
|
+
pauseWhenBuffering: pauseWhenBuffering !== null && pauseWhenBuffering !== void 0 ? pauseWhenBuffering : false, onDuration: onDuration, _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null, _remotionInternalNativeLoopPassed: _remotionInternalNativeLoopPassed !== null && _remotionInternalNativeLoopPassed !== void 0 ? _remotionInternalNativeLoopPassed : false, _remotionDebugSeeking: _remotionDebugSeeking !== null && _remotionDebugSeeking !== void 0 ? _remotionDebugSeeking : false, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, onAutoPlayError: onAutoPlayError !== null && onAutoPlayError !== void 0 ? onAutoPlayError : undefined }));
|
|
60
60
|
};
|
|
61
61
|
/**
|
|
62
62
|
* @description allows you to include a video file in your Remotion project. It wraps the native HTMLVideoElement.
|
|
@@ -19,7 +19,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
19
19
|
const videoRef = (0, react_1.useRef)(null);
|
|
20
20
|
const { volume, muted, playbackRate, onlyWarnForMediaSeekingError, src, onDuration,
|
|
21
21
|
// @ts-expect-error
|
|
22
|
-
acceptableTimeShift, acceptableTimeShiftInSeconds, toneFrequency, name, _remotionInternalNativeLoopPassed, _remotionInternalStack, _remotionDebugSeeking, style, pauseWhenBuffering, showInTimeline, loopVolumeCurveBehavior, onError, ...nativeProps } = props;
|
|
22
|
+
acceptableTimeShift, acceptableTimeShiftInSeconds, toneFrequency, name, _remotionInternalNativeLoopPassed, _remotionInternalStack, _remotionDebugSeeking, style, pauseWhenBuffering, showInTimeline, loopVolumeCurveBehavior, onError, onAutoPlayError, ...nativeProps } = props;
|
|
23
23
|
const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)(loopVolumeCurveBehavior !== null && loopVolumeCurveBehavior !== void 0 ? loopVolumeCurveBehavior : 'repeat');
|
|
24
24
|
const { fps, durationInFrames } = (0, use_video_config_js_1.useVideoConfig)();
|
|
25
25
|
const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
|
|
@@ -44,6 +44,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
44
44
|
stack: _remotionInternalStack,
|
|
45
45
|
showInTimeline,
|
|
46
46
|
premountDisplay: null,
|
|
47
|
+
onAutoPlayError: onAutoPlayError !== null && onAutoPlayError !== void 0 ? onAutoPlayError : null,
|
|
47
48
|
});
|
|
48
49
|
(0, use_sync_volume_with_media_tag_js_1.useSyncVolumeWithMediaTag)({
|
|
49
50
|
volumePropFrame,
|
|
@@ -62,6 +63,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
62
63
|
isPremounting: Boolean(parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.premounting),
|
|
63
64
|
pauseWhenBuffering,
|
|
64
65
|
debugSeeking: _remotionDebugSeeking,
|
|
66
|
+
onAutoPlayError: onAutoPlayError !== null && onAutoPlayError !== void 0 ? onAutoPlayError : null,
|
|
65
67
|
});
|
|
66
68
|
const actualFrom = parentSequence ? parentSequence.relativeFrom : 0;
|
|
67
69
|
const duration = parentSequence
|
|
@@ -13,6 +13,7 @@ export declare const VideoForRendering: ForwardRefExoticComponent<Omit<React.Det
|
|
|
13
13
|
loopVolumeCurveBehavior?: import("../audio/use-audio-frame.js").LoopVolumeCurveBehavior | undefined;
|
|
14
14
|
delayRenderRetries?: number | undefined;
|
|
15
15
|
onError?: ((err: Error) => void) | undefined;
|
|
16
|
+
onAutoPlayError?: (() => void) | undefined;
|
|
16
17
|
} & {
|
|
17
18
|
readonly onDuration: (src: string, durationInSeconds: number) => void;
|
|
18
19
|
} & RefAttributes<HTMLVideoElement>>;
|
|
@@ -23,6 +23,7 @@ export type RemotionVideoProps = Omit<React.DetailedHTMLProps<React.VideoHTMLAtt
|
|
|
23
23
|
loopVolumeCurveBehavior?: LoopVolumeCurveBehavior;
|
|
24
24
|
delayRenderRetries?: number;
|
|
25
25
|
onError?: (err: Error) => void;
|
|
26
|
+
onAutoPlayError?: () => void;
|
|
26
27
|
};
|
|
27
28
|
type DeprecatedOffthreadVideoProps = {
|
|
28
29
|
/**
|
|
@@ -54,5 +55,6 @@ export type OffthreadVideoProps = {
|
|
|
54
55
|
*/
|
|
55
56
|
stack?: string;
|
|
56
57
|
showInTimeline?: boolean;
|
|
58
|
+
onAutoPlayError?: null | (() => void);
|
|
57
59
|
} & RemotionMainVideoProps & DeprecatedOffthreadVideoProps;
|
|
58
60
|
export {};
|
package/dist/esm/index.mjs
CHANGED
|
@@ -138,7 +138,7 @@ function truthy(value) {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
// src/version.ts
|
|
141
|
-
var VERSION = "4.0.
|
|
141
|
+
var VERSION = "4.0.187";
|
|
142
142
|
|
|
143
143
|
// src/multiple-versions-warning.ts
|
|
144
144
|
var checkMultipleRemotionVersions = () => {
|
|
@@ -300,46 +300,14 @@ var useNonce = () => {
|
|
|
300
300
|
// src/timeline-position-state.ts
|
|
301
301
|
var exports_timeline_position_state = {};
|
|
302
302
|
__export(exports_timeline_position_state, {
|
|
303
|
-
useTimelineSetFrame: () =>
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
},
|
|
313
|
-
usePlayingState: () => {
|
|
314
|
-
{
|
|
315
|
-
return usePlayingState;
|
|
316
|
-
}
|
|
317
|
-
},
|
|
318
|
-
persistCurrentFrame: () => {
|
|
319
|
-
{
|
|
320
|
-
return persistCurrentFrame;
|
|
321
|
-
}
|
|
322
|
-
},
|
|
323
|
-
getInitialFrameState: () => {
|
|
324
|
-
{
|
|
325
|
-
return getInitialFrameState;
|
|
326
|
-
}
|
|
327
|
-
},
|
|
328
|
-
getFrameForComposition: () => {
|
|
329
|
-
{
|
|
330
|
-
return getFrameForComposition;
|
|
331
|
-
}
|
|
332
|
-
},
|
|
333
|
-
TimelineContext: () => {
|
|
334
|
-
{
|
|
335
|
-
return TimelineContext;
|
|
336
|
-
}
|
|
337
|
-
},
|
|
338
|
-
SetTimelineContext: () => {
|
|
339
|
-
{
|
|
340
|
-
return SetTimelineContext;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
303
|
+
useTimelineSetFrame: () => useTimelineSetFrame,
|
|
304
|
+
useTimelinePosition: () => useTimelinePosition,
|
|
305
|
+
usePlayingState: () => usePlayingState,
|
|
306
|
+
persistCurrentFrame: () => persistCurrentFrame,
|
|
307
|
+
getInitialFrameState: () => getInitialFrameState,
|
|
308
|
+
getFrameForComposition: () => getFrameForComposition,
|
|
309
|
+
TimelineContext: () => TimelineContext,
|
|
310
|
+
SetTimelineContext: () => SetTimelineContext
|
|
343
311
|
});
|
|
344
312
|
import {createContext as createContext8, useContext as useContext7, useMemo as useMemo7} from "react";
|
|
345
313
|
|
|
@@ -2149,7 +2117,7 @@ var getAssetDisplayName = (filename) => {
|
|
|
2149
2117
|
};
|
|
2150
2118
|
|
|
2151
2119
|
// src/play-and-handle-not-allowed-error.ts
|
|
2152
|
-
var playAndHandleNotAllowedError = (mediaRef, mediaType) => {
|
|
2120
|
+
var playAndHandleNotAllowedError = (mediaRef, mediaType, onAutoPlayError) => {
|
|
2153
2121
|
const { current } = mediaRef;
|
|
2154
2122
|
if (!current) {
|
|
2155
2123
|
return;
|
|
@@ -2177,7 +2145,14 @@ var playAndHandleNotAllowedError = (mediaRef, mediaType) => {
|
|
|
2177
2145
|
}
|
|
2178
2146
|
console.log(`Could not play ${mediaType} due to following error: `, err);
|
|
2179
2147
|
if (!current.muted) {
|
|
2148
|
+
if (onAutoPlayError) {
|
|
2149
|
+
onAutoPlayError();
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
2180
2152
|
console.log(`The video will be muted and we'll retry playing it.`);
|
|
2153
|
+
if (mediaType === "video" && getRemotionEnvironment().isPlayer) {
|
|
2154
|
+
console.log("Use onAutoPlayError() to handle this error yourself.");
|
|
2155
|
+
}
|
|
2181
2156
|
current.muted = true;
|
|
2182
2157
|
current.play();
|
|
2183
2158
|
}
|
|
@@ -2232,7 +2207,8 @@ var useMediaInTimeline = ({
|
|
|
2232
2207
|
id,
|
|
2233
2208
|
stack,
|
|
2234
2209
|
showInTimeline,
|
|
2235
|
-
premountDisplay
|
|
2210
|
+
premountDisplay,
|
|
2211
|
+
onAutoPlayError
|
|
2236
2212
|
}) => {
|
|
2237
2213
|
const videoConfig = useVideoConfig();
|
|
2238
2214
|
const { rootId, audioAndVideoTags } = useContext16(TimelineContext);
|
|
@@ -2327,14 +2303,14 @@ var useMediaInTimeline = ({
|
|
|
2327
2303
|
if (!playing) {
|
|
2328
2304
|
return;
|
|
2329
2305
|
}
|
|
2330
|
-
return playAndHandleNotAllowedError(mediaRef, mediaType);
|
|
2306
|
+
return playAndHandleNotAllowedError(mediaRef, mediaType, onAutoPlayError);
|
|
2331
2307
|
}
|
|
2332
2308
|
};
|
|
2333
2309
|
audioAndVideoTags.current.push(tag);
|
|
2334
2310
|
return () => {
|
|
2335
2311
|
audioAndVideoTags.current = audioAndVideoTags.current.filter((a) => a.id !== id);
|
|
2336
2312
|
};
|
|
2337
|
-
}, [audioAndVideoTags, id, mediaRef, mediaType, playing]);
|
|
2313
|
+
}, [audioAndVideoTags, id, mediaRef, mediaType, onAutoPlayError, playing]);
|
|
2338
2314
|
};
|
|
2339
2315
|
|
|
2340
2316
|
// src/use-media-playback.ts
|
|
@@ -2855,7 +2831,8 @@ var useMediaPlayback = ({
|
|
|
2855
2831
|
acceptableTimeshift,
|
|
2856
2832
|
pauseWhenBuffering,
|
|
2857
2833
|
isPremounting,
|
|
2858
|
-
debugSeeking
|
|
2834
|
+
debugSeeking,
|
|
2835
|
+
onAutoPlayError
|
|
2859
2836
|
}) => {
|
|
2860
2837
|
const { playbackRate: globalPlaybackRate } = useContext18(TimelineContext);
|
|
2861
2838
|
const frame = useCurrentFrame();
|
|
@@ -2963,7 +2940,7 @@ var useMediaPlayback = ({
|
|
|
2963
2940
|
if (playing && !isVariableFpsVideo) {
|
|
2964
2941
|
bufferUntilFirstFrame(shouldBeTime);
|
|
2965
2942
|
if (mediaRef.current.paused) {
|
|
2966
|
-
playAndHandleNotAllowedError(mediaRef, mediaType);
|
|
2943
|
+
playAndHandleNotAllowedError(mediaRef, mediaType, onAutoPlayError);
|
|
2967
2944
|
}
|
|
2968
2945
|
}
|
|
2969
2946
|
if (!onlyWarnForMediaSeekingError) {
|
|
@@ -2985,7 +2962,7 @@ var useMediaPlayback = ({
|
|
|
2985
2962
|
if (makesSenseToSeek) {
|
|
2986
2963
|
seek(mediaRef, shouldBeTime);
|
|
2987
2964
|
}
|
|
2988
|
-
playAndHandleNotAllowedError(mediaRef, mediaType);
|
|
2965
|
+
playAndHandleNotAllowedError(mediaRef, mediaType, onAutoPlayError);
|
|
2989
2966
|
if (!isVariableFpsVideo) {
|
|
2990
2967
|
bufferUntilFirstFrame(shouldBeTime);
|
|
2991
2968
|
}
|
|
@@ -3005,7 +2982,8 @@ var useMediaPlayback = ({
|
|
|
3005
2982
|
onlyWarnForMediaSeekingError,
|
|
3006
2983
|
playbackRate,
|
|
3007
2984
|
playing,
|
|
3008
|
-
src
|
|
2985
|
+
src,
|
|
2986
|
+
onAutoPlayError
|
|
3009
2987
|
]);
|
|
3010
2988
|
};
|
|
3011
2989
|
|
|
@@ -3231,7 +3209,7 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, component }) =>
|
|
|
3231
3209
|
}, [rerenderAudios]);
|
|
3232
3210
|
const playAllAudios = useCallback8(() => {
|
|
3233
3211
|
refs.forEach((ref) => {
|
|
3234
|
-
playAndHandleNotAllowedError(ref.ref, "audio");
|
|
3212
|
+
playAndHandleNotAllowedError(ref.ref, "audio", null);
|
|
3235
3213
|
});
|
|
3236
3214
|
}, [refs]);
|
|
3237
3215
|
const value = useMemo19(() => {
|
|
@@ -3394,7 +3372,8 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
3394
3372
|
id: timelineId,
|
|
3395
3373
|
stack: _remotionInternalStack,
|
|
3396
3374
|
showInTimeline,
|
|
3397
|
-
premountDisplay: null
|
|
3375
|
+
premountDisplay: null,
|
|
3376
|
+
onAutoPlayError: null
|
|
3398
3377
|
});
|
|
3399
3378
|
useMediaPlayback({
|
|
3400
3379
|
mediaRef: audioRef,
|
|
@@ -3405,7 +3384,8 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
3405
3384
|
acceptableTimeshift: acceptableTimeShiftInSeconds ?? DEFAULT_ACCEPTABLE_TIMESHIFT,
|
|
3406
3385
|
isPremounting: Boolean(sequenceContext?.premounting),
|
|
3407
3386
|
pauseWhenBuffering,
|
|
3408
|
-
debugSeeking: _remotionDebugSeeking
|
|
3387
|
+
debugSeeking: _remotionDebugSeeking,
|
|
3388
|
+
onAutoPlayError: null
|
|
3409
3389
|
});
|
|
3410
3390
|
useImperativeHandle3(ref, () => {
|
|
3411
3391
|
return audioRef.current;
|
|
@@ -4322,18 +4302,18 @@ class Easing {
|
|
|
4322
4302
|
return (t) => t * t * ((s + 1) * t - s);
|
|
4323
4303
|
}
|
|
4324
4304
|
static bounce(t) {
|
|
4325
|
-
if (t <
|
|
4305
|
+
if (t < 1 / 2.75) {
|
|
4326
4306
|
return 7.5625 * t * t;
|
|
4327
4307
|
}
|
|
4328
|
-
if (t <
|
|
4329
|
-
const t2_ = t -
|
|
4308
|
+
if (t < 2 / 2.75) {
|
|
4309
|
+
const t2_ = t - 1.5 / 2.75;
|
|
4330
4310
|
return 7.5625 * t2_ * t2_ + 0.75;
|
|
4331
4311
|
}
|
|
4332
|
-
if (t <
|
|
4333
|
-
const t2_ = t -
|
|
4312
|
+
if (t < 2.5 / 2.75) {
|
|
4313
|
+
const t2_ = t - 2.25 / 2.75;
|
|
4334
4314
|
return 7.5625 * t2_ * t2_ + 0.9375;
|
|
4335
4315
|
}
|
|
4336
|
-
const t2 = t -
|
|
4316
|
+
const t2 = t - 2.625 / 2.75;
|
|
4337
4317
|
return 7.5625 * t2 * t2 + 0.984375;
|
|
4338
4318
|
}
|
|
4339
4319
|
static bezier(x1, y1, x2, y2) {
|
|
@@ -4548,21 +4528,9 @@ var Img = forwardRef7(ImgRefForwarding);
|
|
|
4548
4528
|
// src/default-css.ts
|
|
4549
4529
|
var exports_default_css = {};
|
|
4550
4530
|
__export(exports_default_css, {
|
|
4551
|
-
makeDefaultPreviewCSS: () =>
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
}
|
|
4555
|
-
},
|
|
4556
|
-
injectCSS: () => {
|
|
4557
|
-
{
|
|
4558
|
-
return injectCSS;
|
|
4559
|
-
}
|
|
4560
|
-
},
|
|
4561
|
-
OFFTHREAD_VIDEO_CLASS_NAME: () => {
|
|
4562
|
-
{
|
|
4563
|
-
return OFFTHREAD_VIDEO_CLASS_NAME;
|
|
4564
|
-
}
|
|
4565
|
-
}
|
|
4531
|
+
makeDefaultPreviewCSS: () => makeDefaultPreviewCSS,
|
|
4532
|
+
injectCSS: () => injectCSS,
|
|
4533
|
+
OFFTHREAD_VIDEO_CLASS_NAME: () => OFFTHREAD_VIDEO_CLASS_NAME
|
|
4566
4534
|
});
|
|
4567
4535
|
var injected = {};
|
|
4568
4536
|
var injectCSS = (css) => {
|
|
@@ -5050,23 +5018,23 @@ var hue2rgb = function(p, q, t) {
|
|
|
5050
5018
|
if (t > 1) {
|
|
5051
5019
|
t -= 1;
|
|
5052
5020
|
}
|
|
5053
|
-
if (t <
|
|
5021
|
+
if (t < 1 / 6) {
|
|
5054
5022
|
return p + (q - p) * 6 * t;
|
|
5055
5023
|
}
|
|
5056
|
-
if (t <
|
|
5024
|
+
if (t < 1 / 2) {
|
|
5057
5025
|
return q;
|
|
5058
5026
|
}
|
|
5059
|
-
if (t <
|
|
5060
|
-
return p + (q - p) * (
|
|
5027
|
+
if (t < 2 / 3) {
|
|
5028
|
+
return p + (q - p) * (2 / 3 - t) * 6;
|
|
5061
5029
|
}
|
|
5062
5030
|
return p;
|
|
5063
5031
|
};
|
|
5064
5032
|
var hslToRgb = function(h, s, l) {
|
|
5065
5033
|
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
5066
5034
|
const p = 2 * l - q;
|
|
5067
|
-
const r = hue2rgb(p, q, h +
|
|
5035
|
+
const r = hue2rgb(p, q, h + 1 / 3);
|
|
5068
5036
|
const g = hue2rgb(p, q, h);
|
|
5069
|
-
const b2 = hue2rgb(p, q, h -
|
|
5037
|
+
const b2 = hue2rgb(p, q, h - 1 / 3);
|
|
5070
5038
|
return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b2 * 255) << 8;
|
|
5071
5039
|
};
|
|
5072
5040
|
var parse255 = function(str) {
|
|
@@ -5898,8 +5866,10 @@ var OffthreadVideoForRendering = ({
|
|
|
5898
5866
|
const blob = await res.blob();
|
|
5899
5867
|
const url = URL.createObjectURL(blob);
|
|
5900
5868
|
cleanup.push(() => URL.revokeObjectURL(url));
|
|
5901
|
-
setImageSrc(
|
|
5902
|
-
|
|
5869
|
+
setImageSrc({
|
|
5870
|
+
src: url,
|
|
5871
|
+
handle: newHandle
|
|
5872
|
+
});
|
|
5903
5873
|
} catch (err) {
|
|
5904
5874
|
if (onError) {
|
|
5905
5875
|
onError(err);
|
|
@@ -5937,8 +5907,9 @@ var OffthreadVideoForRendering = ({
|
|
|
5937
5907
|
if (!imageSrc) {
|
|
5938
5908
|
return null;
|
|
5939
5909
|
}
|
|
5910
|
+
continueRender(imageSrc.handle);
|
|
5940
5911
|
return jsx29(Img, {
|
|
5941
|
-
src: imageSrc,
|
|
5912
|
+
src: imageSrc.src,
|
|
5942
5913
|
className,
|
|
5943
5914
|
delayRenderRetries,
|
|
5944
5915
|
delayRenderTimeoutInMilliseconds,
|
|
@@ -5981,6 +5952,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
5981
5952
|
showInTimeline,
|
|
5982
5953
|
loopVolumeCurveBehavior,
|
|
5983
5954
|
onError,
|
|
5955
|
+
onAutoPlayError,
|
|
5984
5956
|
...nativeProps
|
|
5985
5957
|
} = props2;
|
|
5986
5958
|
const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
@@ -6006,7 +5978,8 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6006
5978
|
id: timelineId,
|
|
6007
5979
|
stack: _remotionInternalStack,
|
|
6008
5980
|
showInTimeline,
|
|
6009
|
-
premountDisplay: null
|
|
5981
|
+
premountDisplay: null,
|
|
5982
|
+
onAutoPlayError: onAutoPlayError ?? null
|
|
6010
5983
|
});
|
|
6011
5984
|
useSyncVolumeWithMediaTag({
|
|
6012
5985
|
volumePropFrame,
|
|
@@ -6024,7 +5997,8 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6024
5997
|
acceptableTimeshift: acceptableTimeShiftInSeconds ?? DEFAULT_ACCEPTABLE_TIMESHIFT,
|
|
6025
5998
|
isPremounting: Boolean(parentSequence?.premounting),
|
|
6026
5999
|
pauseWhenBuffering,
|
|
6027
|
-
debugSeeking: _remotionDebugSeeking
|
|
6000
|
+
debugSeeking: _remotionDebugSeeking,
|
|
6001
|
+
onAutoPlayError: onAutoPlayError ?? null
|
|
6028
6002
|
});
|
|
6029
6003
|
const actualFrom = parentSequence ? parentSequence.relativeFrom : 0;
|
|
6030
6004
|
const duration = parentSequence ? Math.min(parentSequence.durationInFrames, durationInFrames) : durationInFrames;
|
|
@@ -6164,6 +6138,7 @@ var OffthreadVideo = (props2) => {
|
|
|
6164
6138
|
transparent,
|
|
6165
6139
|
toneMapped,
|
|
6166
6140
|
_remotionDebugSeeking,
|
|
6141
|
+
onAutoPlayError,
|
|
6167
6142
|
...withoutTransparent
|
|
6168
6143
|
} = otherProps;
|
|
6169
6144
|
return jsx31(VideoForPreview, {
|
|
@@ -6174,6 +6149,7 @@ var OffthreadVideo = (props2) => {
|
|
|
6174
6149
|
onlyWarnForMediaSeekingError: true,
|
|
6175
6150
|
pauseWhenBuffering: pauseWhenBuffering ?? false,
|
|
6176
6151
|
showInTimeline: showInTimeline ?? true,
|
|
6152
|
+
onAutoPlayError: onAutoPlayError ?? undefined,
|
|
6177
6153
|
...withoutTransparent
|
|
6178
6154
|
});
|
|
6179
6155
|
};
|
|
@@ -6484,6 +6460,7 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
6484
6460
|
stack,
|
|
6485
6461
|
_remotionInternalNativeLoopPassed,
|
|
6486
6462
|
showInTimeline,
|
|
6463
|
+
onAutoPlayError,
|
|
6487
6464
|
...otherProps
|
|
6488
6465
|
} = props2;
|
|
6489
6466
|
const { loop: loop4, _remotionDebugSeeking, ...propsOtherThanLoop } = props2;
|
|
@@ -6553,7 +6530,8 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
6553
6530
|
_remotionInternalStack: stack ?? null,
|
|
6554
6531
|
_remotionInternalNativeLoopPassed: _remotionInternalNativeLoopPassed ?? false,
|
|
6555
6532
|
_remotionDebugSeeking: _remotionDebugSeeking ?? false,
|
|
6556
|
-
showInTimeline: showInTimeline ?? true
|
|
6533
|
+
showInTimeline: showInTimeline ?? true,
|
|
6534
|
+
onAutoPlayError: onAutoPlayError ?? undefined
|
|
6557
6535
|
});
|
|
6558
6536
|
};
|
|
6559
6537
|
var Video = forwardRef11(VideoForwardingFunction);
|
package/dist/esm/no-react.mjs
CHANGED
|
@@ -318,23 +318,23 @@ var hue2rgb = function(p, q, t) {
|
|
|
318
318
|
if (t > 1) {
|
|
319
319
|
t -= 1;
|
|
320
320
|
}
|
|
321
|
-
if (t <
|
|
321
|
+
if (t < 1 / 6) {
|
|
322
322
|
return p + (q - p) * 6 * t;
|
|
323
323
|
}
|
|
324
|
-
if (t <
|
|
324
|
+
if (t < 1 / 2) {
|
|
325
325
|
return q;
|
|
326
326
|
}
|
|
327
|
-
if (t <
|
|
328
|
-
return p + (q - p) * (
|
|
327
|
+
if (t < 2 / 3) {
|
|
328
|
+
return p + (q - p) * (2 / 3 - t) * 6;
|
|
329
329
|
}
|
|
330
330
|
return p;
|
|
331
331
|
};
|
|
332
332
|
var hslToRgb = function(h, s, l) {
|
|
333
333
|
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
334
334
|
const p = 2 * l - q;
|
|
335
|
-
const r = hue2rgb(p, q, h +
|
|
335
|
+
const r = hue2rgb(p, q, h + 1 / 3);
|
|
336
336
|
const g = hue2rgb(p, q, h);
|
|
337
|
-
const b = hue2rgb(p, q, h -
|
|
337
|
+
const b = hue2rgb(p, q, h - 1 / 3);
|
|
338
338
|
return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
|
|
339
339
|
};
|
|
340
340
|
var parse255 = function(str) {
|
package/dist/esm/version.mjs
CHANGED
package/package.json
CHANGED