@remotion/player 4.0.541 → 4.0.543

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.
@@ -11,19 +11,20 @@ const is_backgrounded_js_1 = require("./is-backgrounded.js");
11
11
  const set_global_time_anchor_js_1 = require("./set-global-time-anchor.js");
12
12
  const use_player_methods_js_1 = require("./use-player-methods.js");
13
13
  const shouldForceAnchorChange = (newState) => {
14
- if (newState === 'suspended' || newState === 'running-to-suspended') {
15
- return true;
14
+ if (newState === 'closed') {
15
+ return false;
16
16
  }
17
- if (newState === 'closed' ||
17
+ if (newState === 'suspended' ||
18
+ newState === 'running-to-suspended' ||
18
19
  newState === 'interrupted' ||
19
20
  newState === 'running' ||
20
21
  newState === 'suspended-to-running') {
21
- return false;
22
+ return true;
22
23
  }
23
24
  throw new Error(`Unexpected audio context state: ${newState}`);
24
25
  };
25
26
  const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, outFrame, browserMediaControlsBehavior, getCurrentFrame, muted, }) => {
26
- var _a, _b, _c;
27
+ var _a, _b, _c, _d;
27
28
  const config = remotion_1.Internals.useUnsafeVideoConfig();
28
29
  const fps = (_a = config === null || config === void 0 ? void 0 : config.fps) !== null && _a !== void 0 ? _a : null;
29
30
  const durationInFrames = (_b = config === null || config === void 0 ? void 0 : config.durationInFrames) !== null && _b !== void 0 ? _b : null;
@@ -41,43 +42,123 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
41
42
  // In that case, we use setTimeout() instead.
42
43
  const isBackgroundedRef = (0, is_backgrounded_js_1.useIsBackgrounded)();
43
44
  const lastTimeUpdateTimestamp = (0, react_2.useRef)(0);
45
+ const seekRevisionAtRender = (_d = seek === null || seek === void 0 ? void 0 : seek.revision.current) !== null && _d !== void 0 ? _d : null;
46
+ const anchorSeekRevision = (0, react_2.useRef)(seekRevisionAtRender);
47
+ const playbackJumpRevision = (0, react_2.useRef)(0);
48
+ const jumpRevision = playbackJumpRevision.current;
44
49
  const playbackClockRef = (0, react_2.useRef)(null);
45
- const previousMutedRef = (0, react_2.useRef)(muted);
46
- const anchoredAudioContextRef = (0, react_2.useRef)(null);
50
+ const previousAudioBoundary = (0, react_2.useRef)(null);
47
51
  (0, browser_mediasession_js_1.useBrowserMediaSession)({
48
52
  browserMediaControlsBehavior,
49
53
  playbackRate,
50
54
  videoConfig: config,
51
55
  });
52
- // Update time anchor when seeking:
53
- // If the user clicked on a different time in the timeline, we need to re-sync the anchor
54
- (0, react_1.useLayoutEffect)(() => {
55
- if (!sharedAudioContext) {
56
- return;
57
- }
58
- if (!sharedAudioContext.audioContext) {
59
- return;
60
- }
61
- if (fps === null) {
62
- return;
56
+ const updateAudioAnchor = (0, react_2.useCallback)(() => {
57
+ if (!(sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.audioContext) || fps === null || muted) {
58
+ return false;
63
59
  }
64
- if (muted) {
65
- return;
60
+ let absoluteFrame = getCurrentFrame();
61
+ const clock = playbackClockRef.current;
62
+ if (playing &&
63
+ clock !== null &&
64
+ durationInFrames !== null &&
65
+ clock.compositionId === compositionId &&
66
+ clock.fps === fps &&
67
+ clock.playbackRate === playbackRate) {
68
+ const actualFirstFrame = inFrame !== null && inFrame !== void 0 ? inFrame : 0;
69
+ const actualLastFrame = outFrame !== null && outFrame !== void 0 ? outFrame : durationInFrames - 1;
70
+ const { nextFrame, hasEnded } = (0, calculate_next_frame_js_1.calculateNextFrame)({
71
+ time: performance.now() - clock.startedTime,
72
+ currentFrame: clock.frame,
73
+ playbackSpeed: playbackRate,
74
+ fps,
75
+ actualFirstFrame,
76
+ actualLastFrame,
77
+ framesAdvanced: clock.framesAdvanced,
78
+ shouldLoop: loop,
79
+ });
80
+ absoluteFrame =
81
+ hasEnded && !moveToBeginningWhenEnded
82
+ ? playbackRate > 0
83
+ ? actualLastFrame
84
+ : actualFirstFrame
85
+ : nextFrame;
66
86
  }
67
87
  const changed = (0, set_global_time_anchor_js_1.setGlobalTimeAnchor)({
68
88
  audioContext: sharedAudioContext.audioContext,
69
89
  audioSyncAnchor: sharedAudioContext.audioSyncAnchor,
70
- absoluteTimeInSeconds: frame / fps,
90
+ absoluteTimeInSeconds: absoluteFrame / fps,
71
91
  globalPlaybackRate: playbackRate,
72
92
  logLevel,
73
- force: false,
93
+ force: true,
74
94
  });
75
95
  if (changed) {
76
96
  sharedAudioContext.audioSyncAnchorEmitter.dispatch('changed');
77
97
  }
78
- }, [fps, frame, logLevel, playbackRate, sharedAudioContext, muted]);
79
- // When the audio context is suspended, we use the opportunity to
80
- // re-anchor the time to be exact.
98
+ return changed;
99
+ }, [
100
+ compositionId,
101
+ durationInFrames,
102
+ fps,
103
+ getCurrentFrame,
104
+ inFrame,
105
+ logLevel,
106
+ loop,
107
+ moveToBeginningWhenEnded,
108
+ muted,
109
+ outFrame,
110
+ playbackRate,
111
+ playing,
112
+ sharedAudioContext,
113
+ ]);
114
+ // Re-anchor only at playback boundaries. A late React commit during ordinary
115
+ // playback must not move the audio clock and discard already scheduled audio.
116
+ (0, react_1.useLayoutEffect)(() => {
117
+ var _a;
118
+ const boundary = {
119
+ audioContext: (_a = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.audioContext) !== null && _a !== void 0 ? _a : null,
120
+ compositionId,
121
+ fps,
122
+ playbackRate,
123
+ muted,
124
+ playing,
125
+ seekRevision: seekRevisionAtRender,
126
+ jumpRevision,
127
+ };
128
+ const previous = previousAudioBoundary.current;
129
+ previousAudioBoundary.current = boundary;
130
+ anchorSeekRevision.current = seekRevisionAtRender;
131
+ if (previous !== null &&
132
+ Object.keys(boundary).every((key) => boundary[key] ===
133
+ previous[key])) {
134
+ return;
135
+ }
136
+ const clock = playbackClockRef.current;
137
+ if (clock !== null && clock.seekRevision !== seekRevisionAtRender) {
138
+ clock.frame = getCurrentFrame();
139
+ clock.seekRevision = seekRevisionAtRender;
140
+ }
141
+ const changed = updateAudioAnchor();
142
+ if (!changed &&
143
+ playing &&
144
+ !muted &&
145
+ (sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext._experimentalKeepAudioContextAlive)) {
146
+ // A changed timebase can invalidate queued audio even at the same anchor.
147
+ sharedAudioContext.audioSyncAnchorEmitter.dispatch('changed');
148
+ }
149
+ }, [
150
+ compositionId,
151
+ fps,
152
+ playbackRate,
153
+ muted,
154
+ sharedAudioContext,
155
+ getCurrentFrame,
156
+ jumpRevision,
157
+ playing,
158
+ seekRevisionAtRender,
159
+ updateAudioAnchor,
160
+ ]);
161
+ // Native pauses, resumes and interruptions are clock boundaries too.
81
162
  (0, react_1.useLayoutEffect)(() => {
82
163
  const audioContext = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.audioContext;
83
164
  if (!audioContext) {
@@ -91,30 +172,24 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
91
172
  }
92
173
  const callback = () => {
93
174
  const newState = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.getAudioContextState();
175
+ // Native audio can already be playing while its output timestamp still
176
+ // lags. Keep the schedule established before this resume started.
177
+ if (newState === 'running' &&
178
+ (sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.getIsResumingAudioContext())) {
179
+ return;
180
+ }
94
181
  if (newState && shouldForceAnchorChange(newState)) {
95
- const changed = (0, set_global_time_anchor_js_1.setGlobalTimeAnchor)({
96
- audioContext,
97
- audioSyncAnchor: sharedAudioContext.audioSyncAnchor,
98
- absoluteTimeInSeconds: getCurrentFrame() / fps,
99
- globalPlaybackRate: playbackRate,
100
- logLevel,
101
- force: true,
102
- });
103
- if (changed) {
104
- sharedAudioContext.audioSyncAnchorEmitter.dispatch('changed');
105
- }
182
+ updateAudioAnchor();
106
183
  }
107
184
  };
108
185
  audioContext === null || audioContext === void 0 ? void 0 : audioContext.addEventListener('statechange', callback);
109
186
  return () => {
110
187
  audioContext === null || audioContext === void 0 ? void 0 : audioContext.removeEventListener('statechange', callback);
111
188
  };
112
- }, [fps, getCurrentFrame, logLevel, muted, playbackRate, sharedAudioContext]);
189
+ }, [fps, getCurrentFrame, muted, sharedAudioContext, updateAudioAnchor]);
113
190
  (0, react_2.useEffect)(() => {
114
191
  var _a, _b;
115
192
  var _c;
116
- const wasMuted = previousMutedRef.current;
117
- previousMutedRef.current = muted;
118
193
  if (fps === null || durationInFrames === null || compositionId === null) {
119
194
  playbackClockRef.current = null;
120
195
  return;
@@ -139,41 +214,18 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
139
214
  compositionId,
140
215
  startedTime: performance.now(),
141
216
  framesAdvanced: 0,
217
+ frame: getCurrentFrame(),
218
+ seekRevision: (_c = seek === null || seek === void 0 ? void 0 : seek.revision.current) !== null && _c !== void 0 ? _c : null,
142
219
  fps,
143
220
  playbackRate,
144
221
  }
145
222
  : previousClock;
223
+ clock.frame = remotion_1.Internals.Timeline.clampFrameToCompositionRange(clock.frame, durationInFrames);
146
224
  playbackClockRef.current = clock;
147
- if ((sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext._experimentalKeepAudioContextAlive) &&
148
- sharedAudioContext.audioContext &&
149
- !muted) {
150
- const didUnmute = wasMuted && !muted;
151
- const didReplaceAudioContext = anchoredAudioContextRef.current !== sharedAudioContext.audioContext;
152
- const shouldRescheduleAudio = shouldRestartClock || didUnmute || didReplaceAudioContext;
153
- // The native clock keeps running through pauses and muted playback.
154
- // These transitions need an exact anchor, as does a replacement context
155
- // with its own time origin. Other effect re-runs use the drift tolerance
156
- // so duration changes do not introduce frame-quantized audio shifts.
157
- const changed = (0, set_global_time_anchor_js_1.setGlobalTimeAnchor)({
158
- audioContext: sharedAudioContext.audioContext,
159
- audioSyncAnchor: sharedAudioContext.audioSyncAnchor,
160
- absoluteTimeInSeconds: getCurrentFrame() / fps,
161
- globalPlaybackRate: playbackRate,
162
- logLevel,
163
- force: shouldRescheduleAudio,
164
- });
165
- anchoredAudioContextRef.current = sharedAudioContext.audioContext;
166
- // A changed timebase can invalidate queued audio even if the anchor
167
- // happens to remain numerically equal (for example at frame zero).
168
- if (changed || shouldRescheduleAudio) {
169
- sharedAudioContext.audioSyncAnchorEmitter.dispatch('changed');
170
- }
171
- }
172
225
  let hasBeenStopped = false;
173
226
  let audioContextFailed = false;
174
227
  let reqAnimFrameCall = null;
175
- let playbackFrame = getCurrentFrame();
176
- let lastSeekRevision = (_c = seek === null || seek === void 0 ? void 0 : seek.revision.current) !== null && _c !== void 0 ? _c : null;
228
+ let unsubscribeBuffering = null;
177
229
  const cancelQueuedFrame = () => {
178
230
  if (reqAnimFrameCall !== null) {
179
231
  if (reqAnimFrameCall.type === 'raf') {
@@ -182,15 +234,19 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
182
234
  else {
183
235
  clearTimeout(reqAnimFrameCall.id);
184
236
  }
237
+ reqAnimFrameCall = null;
185
238
  }
186
239
  };
187
240
  const stop = () => {
188
241
  hasBeenStopped = true;
189
242
  cancelQueuedFrame();
243
+ unsubscribeBuffering === null || unsubscribeBuffering === void 0 ? void 0 : unsubscribeBuffering();
244
+ unsubscribeBuffering = null;
190
245
  };
191
246
  const callback = () => {
192
247
  var _a, _b;
193
248
  var _c;
249
+ reqAnimFrameCall = null;
194
250
  if (hasBeenStopped) {
195
251
  return;
196
252
  }
@@ -198,19 +254,32 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
198
254
  (_a = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.suspend) === null || _a === void 0 ? void 0 : _a.call(sharedAudioContext);
199
255
  return;
200
256
  }
201
- if (!muted && !audioContextFailed && !isBuffering()) {
257
+ if (isBuffering()) {
258
+ queueNextFrame();
259
+ return;
260
+ }
261
+ if (!muted && !audioContextFailed) {
202
262
  (_b = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.resume) === null || _b === void 0 ? void 0 : _b.call(sharedAudioContext);
203
263
  }
204
264
  const time = performance.now() - clock.startedTime;
205
265
  const actualLastFrame = outFrame !== null && outFrame !== void 0 ? outFrame : durationInFrames - 1;
206
266
  const actualFirstFrame = inFrame !== null && inFrame !== void 0 ? inFrame : 0;
207
267
  const seekRevision = (_c = seek === null || seek === void 0 ? void 0 : seek.revision.current) !== null && _c !== void 0 ? _c : null;
208
- if (seekRevision !== lastSeekRevision) {
209
- playbackFrame = getCurrentFrame();
210
- lastSeekRevision = seekRevision;
268
+ if (seekRevision !== clock.seekRevision) {
269
+ clock.frame = getCurrentFrame();
270
+ clock.seekRevision = seekRevision;
271
+ if (anchorSeekRevision.current !== seekRevision) {
272
+ // A same-frame seek may not cause a React commit. It still needs
273
+ // an exact anchor before advancing playback from that position.
274
+ updateAudioAnchor();
275
+ anchorSeekRevision.current = seekRevision;
276
+ if (previousAudioBoundary.current !== null) {
277
+ previousAudioBoundary.current.seekRevision = seekRevision;
278
+ }
279
+ }
211
280
  }
212
281
  // React may not have committed the previous playback update yet.
213
- const currentFrame = playbackFrame;
282
+ const currentFrame = clock.frame;
214
283
  const { nextFrame, framesToAdvance, hasEnded } = (0, calculate_next_frame_js_1.calculateNextFrame)({
215
284
  time,
216
285
  currentFrame,
@@ -228,10 +297,23 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
228
297
  ? actualLastFrame
229
298
  : actualFirstFrame
230
299
  : nextFrame;
231
- if (frameToDisplay !== currentFrame && !isBuffering()) {
232
- playbackFrame = frameToDisplay;
300
+ const didJump = frameToDisplay !== currentFrame + framesToAdvance;
301
+ if (didJump) {
302
+ // Re-anchor after the jump's target frame commits.
303
+ playbackJumpRevision.current++;
304
+ }
305
+ clock.frame = frameToDisplay;
306
+ if (frameToDisplay !== currentFrame) {
233
307
  setFrameFromPlayback((c) => ({ ...c, [compositionId]: frameToDisplay }));
234
308
  }
309
+ else if (didJump) {
310
+ // A jump can land on the same frame without a React commit.
311
+ updateAudioAnchor();
312
+ if (previousAudioBoundary.current !== null) {
313
+ previousAudioBoundary.current.jumpRevision =
314
+ playbackJumpRevision.current;
315
+ }
316
+ }
235
317
  if (hasEnded) {
236
318
  stop();
237
319
  pause();
@@ -270,19 +352,25 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
270
352
  if (!muted && !audioContextFailed) {
271
353
  (_b = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.suspend) === null || _b === void 0 ? void 0 : _b.call(sharedAudioContext);
272
354
  }
273
- const unsubscribe = subscribeBuffering((state) => {
355
+ unsubscribeBuffering = subscribeBuffering((state) => {
274
356
  if (state.buffering) {
275
357
  return;
276
358
  }
277
- unsubscribe();
359
+ unsubscribeBuffering === null || unsubscribeBuffering === void 0 ? void 0 : unsubscribeBuffering();
360
+ unsubscribeBuffering = null;
361
+ if (hasBeenStopped) {
362
+ return;
363
+ }
364
+ // The context clock may have advanced while the timeline was
365
+ // stalled, especially with _experimentalKeepAudioContextAlive.
366
+ clock.startedTime = performance.now();
367
+ clock.framesAdvanced = 0;
368
+ updateAudioAnchor();
278
369
  if (!muted &&
279
370
  !audioContextFailed &&
280
371
  (sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext._experimentalKeepAudioContextAlive)) {
281
372
  sharedAudioContext.resume();
282
373
  }
283
- // Buffered media became reachable; start a fresh clock.
284
- clock.startedTime = performance.now();
285
- clock.framesAdvanced = 0;
286
374
  queueNextFrame();
287
375
  });
288
376
  return;
@@ -297,19 +385,22 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
297
385
  }
298
386
  reqAnimFrameCall = { type: 'raf', id: requestAnimationFrame(callback) };
299
387
  };
388
+ const unsubscribeSeek = seek === null || seek === void 0 ? void 0 : seek.subscribe(() => {
389
+ clock.startedTime = performance.now();
390
+ clock.framesAdvanced = 0;
391
+ });
300
392
  queueNextFrame();
301
393
  const onVisibilityChange = () => {
302
- if (document.visibilityState === 'visible') {
394
+ if (reqAnimFrameCall === null) {
303
395
  return;
304
396
  }
305
- // If tab goes into the background, cancel requestAnimationFrame() and update immediately.
306
- // , so the transition to setTimeout() can be fulfilled.
307
397
  cancelQueuedFrame();
308
398
  callback();
309
399
  };
310
400
  window.addEventListener('visibilitychange', onVisibilityChange);
311
401
  return () => {
312
402
  window.removeEventListener('visibilitychange', onVisibilityChange);
403
+ unsubscribeSeek === null || unsubscribeSeek === void 0 ? void 0 : unsubscribeSeek();
313
404
  stop();
314
405
  };
315
406
  }, [
@@ -333,8 +424,8 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
333
424
  setPlayerMuted,
334
425
  subscribeBuffering,
335
426
  seek,
336
- logLevel,
337
427
  muted,
428
+ updateAudioAnchor,
338
429
  ]);
339
430
  (0, react_2.useEffect)(() => {
340
431
  const now = performance.now();
@@ -4,8 +4,10 @@ exports.usePlayerMethods = void 0;
4
4
  const react_1 = require("react");
5
5
  const remotion_1 = require("remotion");
6
6
  const emitter_context_js_1 = require("./emitter-context.js");
7
+ const playback_range_context_js_1 = require("./playback-range-context.js");
7
8
  const usePlayerMethods = () => {
8
- var _a, _b, _c;
9
+ var _a;
10
+ var _b, _c, _d, _e;
9
11
  const seekFrame = remotion_1.Internals.Timeline.useTimelineSeekFrame();
10
12
  const { setPlaying, frameRef, audioAndVideoTags, isPlaying: readIsPlaying, isBuffering, } = (0, react_1.useContext)(remotion_1.Internals.SetTimelineContext);
11
13
  const audioContext = (0, react_1.useContext)(remotion_1.Internals.SharedAudioContext);
@@ -14,9 +16,11 @@ const usePlayerMethods = () => {
14
16
  const muted = playerMuted || mediaVolume === 0;
15
17
  const environment = (0, remotion_1.useRemotionEnvironment)();
16
18
  const video = remotion_1.Internals.useVideo();
17
- const videoId = (_a = video === null || video === void 0 ? void 0 : video.id) !== null && _a !== void 0 ? _a : null;
18
- const videoDurationInFrames = (_b = video === null || video === void 0 ? void 0 : video.durationInFrames) !== null && _b !== void 0 ? _b : null;
19
+ const videoId = (_b = video === null || video === void 0 ? void 0 : video.id) !== null && _b !== void 0 ? _b : null;
20
+ const videoDurationInFrames = (_c = video === null || video === void 0 ? void 0 : video.durationInFrames) !== null && _c !== void 0 ? _c : null;
19
21
  const config = remotion_1.Internals.useUnsafeVideoConfig();
22
+ const { inFrame, outFrame } = (0, react_1.useContext)(playback_range_context_js_1.PlaybackRangeContext);
23
+ const playbackRate = (_d = (_a = (0, react_1.useContext)(remotion_1.Internals.PlaybackRateContext)) === null || _a === void 0 ? void 0 : _a.playbackRate) !== null && _d !== void 0 ? _d : 1;
20
24
  const emitter = (0, react_1.useContext)(emitter_context_js_1.PlayerEventEmitterContext);
21
25
  const playStart = (0, react_1.useRef)(0);
22
26
  const fallbackFrame = (0, react_1.useRef)(null);
@@ -61,9 +65,11 @@ const usePlayerMethods = () => {
61
65
  if (readIsPlaying()) {
62
66
  return;
63
67
  }
64
- const lastFrameForPlayback = ((_a = config === null || config === void 0 ? void 0 : config.durationInFrames) !== null && _a !== void 0 ? _a : 1) - 1;
65
- if (getCurrentFrame() === lastFrameForPlayback) {
66
- seek(0);
68
+ const rangeStart = inFrame !== null && inFrame !== void 0 ? inFrame : 0;
69
+ const rangeEnd = outFrame !== null && outFrame !== void 0 ? outFrame : ((_a = config === null || config === void 0 ? void 0 : config.durationInFrames) !== null && _a !== void 0 ? _a : 1) - 1;
70
+ const reverse = playbackRate < 0;
71
+ if (getCurrentFrame() === (reverse ? rangeStart : rangeEnd)) {
72
+ seek(reverse ? rangeEnd : rangeStart);
67
73
  }
68
74
  if (!muted) {
69
75
  if (isAutoPlayAttempt) {
@@ -92,6 +98,9 @@ const usePlayerMethods = () => {
92
98
  audioContext,
93
99
  audioTagsContext,
94
100
  config === null || config === void 0 ? void 0 : config.durationInFrames,
101
+ inFrame,
102
+ outFrame,
103
+ playbackRate,
95
104
  emitter,
96
105
  getCurrentFrame,
97
106
  muted,
@@ -127,7 +136,7 @@ const usePlayerMethods = () => {
127
136
  }
128
137
  }
129
138
  }, [config, emitter, frameRef, readIsPlaying, setPlaying, seekFrame]);
130
- const lastFrame = ((_c = config === null || config === void 0 ? void 0 : config.durationInFrames) !== null && _c !== void 0 ? _c : 1) - 1;
139
+ const lastFrame = ((_e = config === null || config === void 0 ? void 0 : config.durationInFrames) !== null && _e !== void 0 ? _e : 1) - 1;
131
140
  const frameBack = (0, react_1.useCallback)((frames) => {
132
141
  var _a, _b;
133
142
  if (!videoId) {