remotion 4.0.14 → 4.0.15

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.
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.14";
1
+ export declare const VERSION = "4.0.15";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Automatically generated on publish
5
- exports.VERSION = '4.0.14';
5
+ exports.VERSION = '4.0.15';
@@ -59,7 +59,7 @@ function truthy(value) {
59
59
  }
60
60
 
61
61
  // Automatically generated on publish
62
- const VERSION = '4.0.14';
62
+ const VERSION = '4.0.15';
63
63
 
64
64
  const checkMultipleRemotionVersions = () => {
65
65
  if (typeof globalThis === 'undefined') {
@@ -1772,8 +1772,11 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
1772
1772
  if (!src) {
1773
1773
  throw new Error(`No 'src' attribute was passed to the ${tagName} element.`);
1774
1774
  }
1775
- mediaRef.current.playbackRate = Math.max(0, playbackRate);
1776
- const shouldBeTime = getMediaTime({
1775
+ const playbackRateToSet = Math.max(0, playbackRate);
1776
+ if (mediaRef.current.playbackRate !== playbackRateToSet) {
1777
+ mediaRef.current.playbackRate = playbackRateToSet;
1778
+ }
1779
+ const _shouldBeTime = getMediaTime({
1777
1780
  fps,
1778
1781
  frame,
1779
1782
  src,
@@ -1781,11 +1784,16 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
1781
1784
  startFrom: -mediaStartsAt,
1782
1785
  mediaType,
1783
1786
  });
1787
+ const { duration } = mediaRef.current;
1788
+ const shouldBeTime = !Number.isNaN(duration) && Number.isFinite(duration)
1789
+ ? Math.min(duration, _shouldBeTime)
1790
+ : _shouldBeTime;
1784
1791
  const isTime = mediaRef.current.currentTime;
1785
1792
  const timeShift = Math.abs(shouldBeTime - isTime);
1786
- if (timeShift > acceptableTimeshift && !mediaRef.current.ended) {
1793
+ if (timeShift > acceptableTimeshift) {
1787
1794
  // If scrubbing around, adjust timing
1788
- // or if time shift is bigger than 0.2sec
1795
+ // or if time shift is bigger than 0.45sec
1796
+ console.log('seekingA', timeShift, mediaRef.current.currentTime, shouldBeTime);
1789
1797
  mediaRef.current.currentTime = shouldBeTime;
1790
1798
  if (!onlyWarnForMediaSeekingError) {
1791
1799
  warnAboutNonSeekableMedia(mediaRef.current, onlyWarnForMediaSeekingError ? 'console-warning' : 'console-error');
@@ -1799,11 +1807,13 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
1799
1807
  const makesSenseToSeek = Math.abs(mediaRef.current.currentTime - shouldBeTime) > 0.00001;
1800
1808
  if (!playing || absoluteFrame === 0) {
1801
1809
  if (makesSenseToSeek) {
1810
+ console.log('seekingB');
1802
1811
  mediaRef.current.currentTime = shouldBeTime;
1803
1812
  }
1804
1813
  }
1805
1814
  if (mediaRef.current.paused && !mediaRef.current.ended && playing) {
1806
1815
  if (makesSenseToSeek) {
1816
+ console.log('seekingC');
1807
1817
  mediaRef.current.currentTime = shouldBeTime;
1808
1818
  }
1809
1819
  playAndHandleNotAllowedError(mediaRef, mediaType);
@@ -1,4 +1,4 @@
1
1
  // Automatically generated on publish
2
- const VERSION = '4.0.14';
2
+ const VERSION = '4.0.15';
3
3
 
4
4
  export { VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "4.0.14",
3
+ "version": "4.0.15",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",