remotion 4.0.15 → 4.0.16
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/use-media-playback.js +25 -10
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/index.mjs +18 -13
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
|
@@ -32,8 +32,18 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
|
|
|
32
32
|
if (!src) {
|
|
33
33
|
throw new Error(`No 'src' attribute was passed to the ${tagName} element.`);
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
const playbackRateToSet = Math.max(0, playbackRate);
|
|
36
|
+
if (mediaRef.current.playbackRate !== playbackRateToSet) {
|
|
37
|
+
mediaRef.current.playbackRate = playbackRateToSet;
|
|
38
|
+
}
|
|
39
|
+
// Let's throttle the seeking to only every 10 frames when a video is playing to avoid bottlenecking
|
|
40
|
+
// the video tag.
|
|
41
|
+
if (playing) {
|
|
42
|
+
if (absoluteFrame % 10 !== 0) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const desiredUnclampedTime = (0, get_current_time_js_1.getMediaTime)({
|
|
37
47
|
fps,
|
|
38
48
|
frame,
|
|
39
49
|
src,
|
|
@@ -41,15 +51,20 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
|
|
|
41
51
|
startFrom: -mediaStartsAt,
|
|
42
52
|
mediaType,
|
|
43
53
|
});
|
|
54
|
+
const { duration } = mediaRef.current;
|
|
55
|
+
const shouldBeTime = !Number.isNaN(duration) && Number.isFinite(duration)
|
|
56
|
+
? Math.min(duration, desiredUnclampedTime)
|
|
57
|
+
: desiredUnclampedTime;
|
|
44
58
|
const isTime = mediaRef.current.currentTime;
|
|
45
59
|
const timeShift = Math.abs(shouldBeTime - isTime);
|
|
46
|
-
if (timeShift > acceptableTimeshift
|
|
60
|
+
if (timeShift > acceptableTimeshift) {
|
|
47
61
|
// If scrubbing around, adjust timing
|
|
48
|
-
// or if time shift is bigger than 0.
|
|
62
|
+
// or if time shift is bigger than 0.45sec
|
|
49
63
|
mediaRef.current.currentTime = shouldBeTime;
|
|
50
64
|
if (!onlyWarnForMediaSeekingError) {
|
|
51
65
|
(0, warn_about_non_seekable_media_js_1.warnAboutNonSeekableMedia)(mediaRef.current, onlyWarnForMediaSeekingError ? 'console-warning' : 'console-error');
|
|
52
66
|
}
|
|
67
|
+
return;
|
|
53
68
|
}
|
|
54
69
|
// Only perform a seek if the time is not already the same.
|
|
55
70
|
// Chrome rounds to 6 digits, so 0.033333333 -> 0.033333,
|
|
@@ -57,15 +72,15 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
|
|
|
57
72
|
// Refer to the https://github.com/remotion-dev/video-buffering-example
|
|
58
73
|
// which is fixed by only seeking conditionally.
|
|
59
74
|
const makesSenseToSeek = Math.abs(mediaRef.current.currentTime - shouldBeTime) > 0.00001;
|
|
75
|
+
if (!makesSenseToSeek) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
60
78
|
if (!playing || absoluteFrame === 0) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
79
|
+
mediaRef.current.currentTime = shouldBeTime;
|
|
80
|
+
return;
|
|
64
81
|
}
|
|
65
82
|
if (mediaRef.current.paused && !mediaRef.current.ended && playing) {
|
|
66
|
-
|
|
67
|
-
mediaRef.current.currentTime = shouldBeTime;
|
|
68
|
-
}
|
|
83
|
+
mediaRef.current.currentTime = shouldBeTime;
|
|
69
84
|
(0, play_and_handle_not_allowed_error_js_1.playAndHandleNotAllowedError)(mediaRef, mediaType);
|
|
70
85
|
}
|
|
71
86
|
}, [
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.
|
|
1
|
+
export declare const VERSION = "4.0.16";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/index.mjs
CHANGED
|
@@ -59,7 +59,7 @@ function truthy(value) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// Automatically generated on publish
|
|
62
|
-
const VERSION = '4.0.
|
|
62
|
+
const VERSION = '4.0.16';
|
|
63
63
|
|
|
64
64
|
const checkMultipleRemotionVersions = () => {
|
|
65
65
|
if (typeof globalThis === 'undefined') {
|
|
@@ -1776,7 +1776,14 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
|
|
|
1776
1776
|
if (mediaRef.current.playbackRate !== playbackRateToSet) {
|
|
1777
1777
|
mediaRef.current.playbackRate = playbackRateToSet;
|
|
1778
1778
|
}
|
|
1779
|
-
|
|
1779
|
+
// Let's throttle the seeking to only every 10 frames when a video is playing to avoid bottlenecking
|
|
1780
|
+
// the video tag.
|
|
1781
|
+
if (playing) {
|
|
1782
|
+
if (absoluteFrame % 10 !== 0) {
|
|
1783
|
+
return;
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
const desiredUnclampedTime = getMediaTime({
|
|
1780
1787
|
fps,
|
|
1781
1788
|
frame,
|
|
1782
1789
|
src,
|
|
@@ -1786,18 +1793,18 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
|
|
|
1786
1793
|
});
|
|
1787
1794
|
const { duration } = mediaRef.current;
|
|
1788
1795
|
const shouldBeTime = !Number.isNaN(duration) && Number.isFinite(duration)
|
|
1789
|
-
? Math.min(duration,
|
|
1790
|
-
:
|
|
1796
|
+
? Math.min(duration, desiredUnclampedTime)
|
|
1797
|
+
: desiredUnclampedTime;
|
|
1791
1798
|
const isTime = mediaRef.current.currentTime;
|
|
1792
1799
|
const timeShift = Math.abs(shouldBeTime - isTime);
|
|
1793
1800
|
if (timeShift > acceptableTimeshift) {
|
|
1794
1801
|
// If scrubbing around, adjust timing
|
|
1795
1802
|
// or if time shift is bigger than 0.45sec
|
|
1796
|
-
console.log('seekingA', timeShift, mediaRef.current.currentTime, shouldBeTime);
|
|
1797
1803
|
mediaRef.current.currentTime = shouldBeTime;
|
|
1798
1804
|
if (!onlyWarnForMediaSeekingError) {
|
|
1799
1805
|
warnAboutNonSeekableMedia(mediaRef.current, onlyWarnForMediaSeekingError ? 'console-warning' : 'console-error');
|
|
1800
1806
|
}
|
|
1807
|
+
return;
|
|
1801
1808
|
}
|
|
1802
1809
|
// Only perform a seek if the time is not already the same.
|
|
1803
1810
|
// Chrome rounds to 6 digits, so 0.033333333 -> 0.033333,
|
|
@@ -1805,17 +1812,15 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
|
|
|
1805
1812
|
// Refer to the https://github.com/remotion-dev/video-buffering-example
|
|
1806
1813
|
// which is fixed by only seeking conditionally.
|
|
1807
1814
|
const makesSenseToSeek = Math.abs(mediaRef.current.currentTime - shouldBeTime) > 0.00001;
|
|
1815
|
+
if (!makesSenseToSeek) {
|
|
1816
|
+
return;
|
|
1817
|
+
}
|
|
1808
1818
|
if (!playing || absoluteFrame === 0) {
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
mediaRef.current.currentTime = shouldBeTime;
|
|
1812
|
-
}
|
|
1819
|
+
mediaRef.current.currentTime = shouldBeTime;
|
|
1820
|
+
return;
|
|
1813
1821
|
}
|
|
1814
1822
|
if (mediaRef.current.paused && !mediaRef.current.ended && playing) {
|
|
1815
|
-
|
|
1816
|
-
console.log('seekingC');
|
|
1817
|
-
mediaRef.current.currentTime = shouldBeTime;
|
|
1818
|
-
}
|
|
1823
|
+
mediaRef.current.currentTime = shouldBeTime;
|
|
1819
1824
|
playAndHandleNotAllowedError(mediaRef, mediaType);
|
|
1820
1825
|
}
|
|
1821
1826
|
}, [
|
package/dist/esm/version.mjs
CHANGED