🎥 Make videos programmatically with React
`@remotion`: Load video on Safari during premounting
Jonny Burgerdd73897843d5
diff --git a/packages/core/src/use-media-buffering.ts b/packages/core/src/use-media-buffering.tsindex dfa03a6609..3ae74fb270 100644--- a/packages/core/src/use-media-buffering.ts+++ b/packages/core/src/use-media-buffering.ts@@ -28,6 +28,21 @@ export const useMediaBuffering = ({}if (isPremounting) {+ // Needed by iOS Safari which will not load by default+ // and therefore not fire the canplay event.++ // Be cautious about using `current.load()` as it will+ // reset if a video is already playing.+ // Therefore only calling it after checking if the video+ // has no future data.++ // Breaks on Firefox though: https://github.com/remotion-dev/remotion/issues/3915+ if (current.readyState < current.HAVE_FUTURE_DATA) {+ if (!navigator.userAgent.includes('Firefox/')) {+ current.load();+ }+ }+return;}