remotion 4.0.485 → 4.0.487
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 +49 -0
- package/dist/cjs/Folder.d.ts +2 -2
- package/dist/cjs/HtmlInCanvas.js +2 -4
- package/dist/cjs/Interactive.d.ts +6 -0
- package/dist/cjs/ResolveCompositionConfig.d.ts +1 -0
- package/dist/cjs/Still.js +2 -0
- package/dist/cjs/TimelineContext.d.ts +3 -3
- package/dist/cjs/buffering.d.ts +1 -1
- package/dist/cjs/buffering.js +14 -6
- package/dist/cjs/canvas-image/CanvasImage.js +42 -20
- package/dist/cjs/get-media-sync-action.d.ts +44 -0
- package/dist/cjs/get-media-sync-action.js +78 -0
- package/dist/cjs/interactivity-schema.d.ts +13 -1
- package/dist/cjs/interactivity-schema.js +6 -0
- package/dist/cjs/internals.d.ts +9 -2
- package/dist/cjs/timeline-position-state.d.ts +2 -2
- package/dist/cjs/use-media-playback.js +70 -82
- package/dist/cjs/use-request-video-callback-time.d.ts +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wrap-remotion-context.d.ts +1 -1
- package/dist/esm/index.mjs +219 -113
- package/dist/esm/version.mjs +1 -1
- package/package.json +3 -3
|
@@ -5,6 +5,7 @@ const react_1 = require("react");
|
|
|
5
5
|
const use_audio_frame_js_1 = require("./audio/use-audio-frame.js");
|
|
6
6
|
const buffer_until_first_frame_js_1 = require("./buffer-until-first-frame.js");
|
|
7
7
|
const buffering_js_1 = require("./buffering.js");
|
|
8
|
+
const get_media_sync_action_js_1 = require("./get-media-sync-action.js");
|
|
8
9
|
const log_level_context_js_1 = require("./log-level-context.js");
|
|
9
10
|
const log_js_1 = require("./log.js");
|
|
10
11
|
const media_tag_current_time_timestamp_js_1 = require("./media-tag-current-time-timestamp.js");
|
|
@@ -144,7 +145,7 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
|
|
|
144
145
|
}, [mediaRef, playbackRate, preservePitch]);
|
|
145
146
|
(0, react_1.useEffect)(() => {
|
|
146
147
|
var _a, _b;
|
|
147
|
-
var _c;
|
|
148
|
+
var _c, _d;
|
|
148
149
|
const tagName = mediaType === 'audio' ? '<Html5Audio>' : '<Html5Video>';
|
|
149
150
|
if (!mediaRef.current) {
|
|
150
151
|
throw new Error(`No ${mediaType} ref found`);
|
|
@@ -152,107 +153,94 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
|
|
|
152
153
|
if (!src) {
|
|
153
154
|
throw new Error(`No 'src' attribute was passed to the ${tagName} element.`);
|
|
154
155
|
}
|
|
155
|
-
const {
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
rvcCurrentTime.current
|
|
166
|
-
|
|
167
|
-
:
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
156
|
+
const { current } = mediaRef;
|
|
157
|
+
const action = (0, get_media_sync_action_js_1.getMediaSyncAction)({
|
|
158
|
+
duration: current.duration,
|
|
159
|
+
currentTime: current.currentTime,
|
|
160
|
+
paused: current.paused,
|
|
161
|
+
ended: current.ended,
|
|
162
|
+
desiredUnclampedTime,
|
|
163
|
+
mediaTagTime: mediaTagCurrentTime.current.time,
|
|
164
|
+
mediaTagLastUpdate: mediaTagCurrentTime.current.lastUpdate,
|
|
165
|
+
rvcTime: (_c = (_a = rvcCurrentTime.current) === null || _a === void 0 ? void 0 : _a.time) !== null && _c !== void 0 ? _c : null,
|
|
166
|
+
rvcLastUpdate: (_d = (_b = rvcCurrentTime.current) === null || _b === void 0 ? void 0 : _b.lastUpdate) !== null && _d !== void 0 ? _d : null,
|
|
167
|
+
isVariableFpsVideo: Boolean(isVariableFpsVideoMap.current[src]),
|
|
168
|
+
acceptableTimeShift: acceptableTimeShiftButLessThanDuration,
|
|
169
|
+
lastSeekDueToShift: lastSeekDueToShift.current,
|
|
170
|
+
playing,
|
|
171
|
+
playbackRate,
|
|
172
|
+
mediaTagBufferingOrStalled: isMediaTagBuffering || isBuffering(),
|
|
173
|
+
playerBuffering: buffering.buffering.current,
|
|
174
|
+
absoluteFrame,
|
|
175
|
+
onlyWarnForMediaSeekingError,
|
|
176
|
+
isPremounting,
|
|
177
|
+
isPostmounting,
|
|
178
|
+
pauseWhenBuffering,
|
|
179
|
+
});
|
|
180
|
+
if (action.type === 'none') {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (action.type === 'seek-due-to-shift') {
|
|
175
184
|
lastSeek.current = (0, seek_js_1.seek)({
|
|
176
|
-
mediaRef:
|
|
177
|
-
time: shouldBeTime,
|
|
185
|
+
mediaRef: current,
|
|
186
|
+
time: action.shouldBeTime,
|
|
178
187
|
logLevel,
|
|
179
|
-
why:
|
|
188
|
+
why: action.why,
|
|
180
189
|
mountTime,
|
|
181
190
|
});
|
|
182
191
|
lastSeekDueToShift.current = lastSeek.current;
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
bufferUntilFirstFrame(shouldBeTime);
|
|
186
|
-
}
|
|
187
|
-
if (mediaRef.current.paused) {
|
|
188
|
-
(0, play_and_handle_not_allowed_error_js_1.playAndHandleNotAllowedError)({
|
|
189
|
-
mediaRef,
|
|
190
|
-
mediaType,
|
|
191
|
-
onAutoPlayError,
|
|
192
|
-
logLevel,
|
|
193
|
-
mountTime,
|
|
194
|
-
reason: 'player is playing but media tag is paused, and just seeked',
|
|
195
|
-
isPlayer: env.isPlayer,
|
|
196
|
-
});
|
|
197
|
-
}
|
|
192
|
+
if (action.bufferUntilFirstFrame) {
|
|
193
|
+
bufferUntilFirstFrame(action.shouldBeTime);
|
|
198
194
|
}
|
|
199
|
-
if (
|
|
200
|
-
(0,
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const seekThreshold = playing ? 0.15 : 0.01;
|
|
205
|
-
// Only perform a seek if the time is not already the same.
|
|
206
|
-
// Chrome rounds to 6 digits, so 0.033333333 -> 0.033333,
|
|
207
|
-
// therefore a threshold is allowed.
|
|
208
|
-
// Refer to the https://github.com/remotion-dev/video-buffering-example
|
|
209
|
-
// which is fixed by only seeking conditionally.
|
|
210
|
-
const makesSenseToSeek = Math.abs(mediaRef.current.currentTime - shouldBeTime) > seekThreshold;
|
|
211
|
-
const isMediaTagBufferingOrStalled = isMediaTagBuffering || isBuffering();
|
|
212
|
-
const isSomethingElseBuffering = buffering.buffering.current && !isMediaTagBufferingOrStalled;
|
|
213
|
-
if (!playing || isSomethingElseBuffering) {
|
|
214
|
-
if (makesSenseToSeek) {
|
|
215
|
-
lastSeek.current = (0, seek_js_1.seek)({
|
|
216
|
-
mediaRef: mediaRef.current,
|
|
217
|
-
time: shouldBeTime,
|
|
195
|
+
if (action.playReason !== null) {
|
|
196
|
+
(0, play_and_handle_not_allowed_error_js_1.playAndHandleNotAllowedError)({
|
|
197
|
+
mediaRef,
|
|
198
|
+
mediaType,
|
|
199
|
+
onAutoPlayError,
|
|
218
200
|
logLevel,
|
|
219
|
-
why: `not playing or something else is buffering. time offset is over seek threshold (${seekThreshold})`,
|
|
220
201
|
mountTime,
|
|
202
|
+
reason: action.playReason,
|
|
203
|
+
isPlayer: env.isPlayer,
|
|
221
204
|
});
|
|
222
205
|
}
|
|
206
|
+
if (action.warnAboutNonSeekable) {
|
|
207
|
+
(0, warn_about_non_seekable_media_js_1.warnAboutNonSeekableMedia)(current, 'console-error');
|
|
208
|
+
}
|
|
223
209
|
return;
|
|
224
210
|
}
|
|
225
|
-
if (
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
// We now assured we are in playing state and not buffering
|
|
229
|
-
const pausedCondition = mediaRef.current.paused && !mediaRef.current.ended;
|
|
230
|
-
const firstFrameCondition = absoluteFrame === 0;
|
|
231
|
-
if (pausedCondition || firstFrameCondition) {
|
|
232
|
-
const reason = pausedCondition
|
|
233
|
-
? 'media tag is paused'
|
|
234
|
-
: 'absolute frame is 0';
|
|
235
|
-
if (makesSenseToSeek) {
|
|
211
|
+
if (action.type === 'seek-if-not-playing') {
|
|
212
|
+
if (action.why !== null) {
|
|
236
213
|
lastSeek.current = (0, seek_js_1.seek)({
|
|
237
|
-
mediaRef:
|
|
238
|
-
time: shouldBeTime,
|
|
214
|
+
mediaRef: current,
|
|
215
|
+
time: action.shouldBeTime,
|
|
239
216
|
logLevel,
|
|
240
|
-
why:
|
|
217
|
+
why: action.why,
|
|
241
218
|
mountTime,
|
|
242
219
|
});
|
|
243
220
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
// action.type === 'play-and-seek'
|
|
224
|
+
if (action.why !== null) {
|
|
225
|
+
lastSeek.current = (0, seek_js_1.seek)({
|
|
226
|
+
mediaRef: current,
|
|
227
|
+
time: action.shouldBeTime,
|
|
248
228
|
logLevel,
|
|
229
|
+
why: action.why,
|
|
249
230
|
mountTime,
|
|
250
|
-
reason: `player is playing and ${reason}`,
|
|
251
|
-
isPlayer: env.isPlayer,
|
|
252
231
|
});
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
232
|
+
}
|
|
233
|
+
(0, play_and_handle_not_allowed_error_js_1.playAndHandleNotAllowedError)({
|
|
234
|
+
mediaRef,
|
|
235
|
+
mediaType,
|
|
236
|
+
onAutoPlayError,
|
|
237
|
+
logLevel,
|
|
238
|
+
mountTime,
|
|
239
|
+
reason: action.playReason,
|
|
240
|
+
isPlayer: env.isPlayer,
|
|
241
|
+
});
|
|
242
|
+
if (action.bufferUntilFirstFrame) {
|
|
243
|
+
bufferUntilFirstFrame(action.shouldBeTime);
|
|
256
244
|
}
|
|
257
245
|
}, [
|
|
258
246
|
absoluteFrame,
|
|
@@ -2,7 +2,7 @@ import type { RefObject } from 'react';
|
|
|
2
2
|
export declare const useRequestVideoCallbackTime: ({ mediaRef, mediaType, lastSeek, onVariableFpsVideoDetected, }: {
|
|
3
3
|
mediaRef: RefObject<HTMLAudioElement | HTMLVideoElement | null>;
|
|
4
4
|
mediaType: "audio" | "video";
|
|
5
|
-
lastSeek:
|
|
5
|
+
lastSeek: RefObject<number | null>;
|
|
6
6
|
onVariableFpsVideoDetected: () => void;
|
|
7
7
|
}) => RefObject<{
|
|
8
8
|
time: number;
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -39,7 +39,7 @@ export declare function useRemotionContexts(): {
|
|
|
39
39
|
listenForResume: (callback: () => void) => {
|
|
40
40
|
remove: () => void;
|
|
41
41
|
};
|
|
42
|
-
buffering: React.
|
|
42
|
+
buffering: React.RefObject<boolean>;
|
|
43
43
|
} | null;
|
|
44
44
|
logLevelContext: import("./log-level-context.js").LoggingContextValue;
|
|
45
45
|
};
|