remotion 4.0.38 → 4.0.40

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.
@@ -0,0 +1,3 @@
1
+ export type RemotionEnvironment = 'preview' | 'rendering' | 'player-development' | 'player-production';
2
+ export declare const getRemotionEnvironment: () => RemotionEnvironment;
3
+ export declare const useRemotionEnvironment: () => RemotionEnvironment;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useRemotionEnvironment = exports.getRemotionEnvironment = void 0;
4
+ const is_player_js_1 = require("./is-player.js");
5
+ const getRemotionEnvironment = () => {
6
+ if (process.env.NODE_ENV === 'production') {
7
+ if (typeof window !== 'undefined' && window.remotion_isPlayer) {
8
+ return 'player-production';
9
+ }
10
+ return 'rendering';
11
+ }
12
+ // The Vitest framework sets NODE_ENV as test.
13
+ // Right now we don't need to treat it in a special
14
+ // way which is good - defaulting to `rendering`.
15
+ if (process.env.NODE_ENV === 'test') {
16
+ return 'rendering';
17
+ }
18
+ if (typeof window !== 'undefined' && window.remotion_isPlayer) {
19
+ return 'player-development';
20
+ }
21
+ return 'preview';
22
+ };
23
+ exports.getRemotionEnvironment = getRemotionEnvironment;
24
+ const useRemotionEnvironment = () => {
25
+ const isPlayer = (0, is_player_js_1.useIsPlayer)();
26
+ if (isPlayer) {
27
+ if (process.env.NODE_ENV === 'production') {
28
+ return 'player-production';
29
+ }
30
+ return 'player-development';
31
+ }
32
+ return (0, exports.getRemotionEnvironment)();
33
+ };
34
+ exports.useRemotionEnvironment = useRemotionEnvironment;
@@ -9,5 +9,6 @@ type FetchAndPreload = {
9
9
  */
10
10
  export declare const prefetch: (src: string, options?: {
11
11
  method?: 'blob-url' | 'base64';
12
+ contentType?: string;
12
13
  }) => FetchAndPreload;
13
14
  export {};
@@ -63,10 +63,18 @@ const prefetch = (src, options) => {
63
63
  if (!buf) {
64
64
  return;
65
65
  }
66
+ if (!buf.type.startsWith('video/') &&
67
+ !buf.type.startsWith('audio/') &&
68
+ !(options === null || options === void 0 ? void 0 : options.contentType)) {
69
+ console.warn(`Called prefetch() on ${src} which returned a "Content-Type" of ${buf.type}. Prefetched content should have a proper content type (video/... or audio/...) or a contentType passed the options of prefetch(). Otherwise, prefetching will not work properly in all browsers.`);
70
+ }
71
+ const actualBlob = (options === null || options === void 0 ? void 0 : options.contentType)
72
+ ? new Blob([buf], { type: options.contentType })
73
+ : buf;
66
74
  if (method === 'base64') {
67
- return blobToBase64(buf);
75
+ return blobToBase64(actualBlob);
68
76
  }
69
- return URL.createObjectURL(buf);
77
+ return URL.createObjectURL(actualBlob);
70
78
  })
71
79
  .then((url) => {
72
80
  if (canceled) {
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.38";
1
+ export declare const VERSION = "4.0.40";
@@ -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.38';
5
+ exports.VERSION = '4.0.40';
@@ -59,7 +59,7 @@ function truthy(value) {
59
59
  }
60
60
 
61
61
  // Automatically generated on publish
62
- const VERSION = '4.0.38';
62
+ const VERSION = '4.0.40';
63
63
 
64
64
  const checkMultipleRemotionVersions = () => {
65
65
  if (typeof globalThis === 'undefined') {
@@ -1318,10 +1318,18 @@ const prefetch = (src, options) => {
1318
1318
  if (!buf) {
1319
1319
  return;
1320
1320
  }
1321
+ if (!buf.type.startsWith('video/') &&
1322
+ !buf.type.startsWith('audio/') &&
1323
+ !(options === null || options === void 0 ? void 0 : options.contentType)) {
1324
+ console.warn(`Called prefetch() on ${src} which returned a "Content-Type" of ${buf.type}. Prefetched content should have a proper content type (video/... or audio/...) or a contentType passed the options of prefetch(). Otherwise, prefetching will not work properly in all browsers.`);
1325
+ }
1326
+ const actualBlob = (options === null || options === void 0 ? void 0 : options.contentType)
1327
+ ? new Blob([buf], { type: options.contentType })
1328
+ : buf;
1321
1329
  if (method === 'base64') {
1322
- return blobToBase64(buf);
1330
+ return blobToBase64(actualBlob);
1323
1331
  }
1324
- return URL.createObjectURL(buf);
1332
+ return URL.createObjectURL(actualBlob);
1325
1333
  })
1326
1334
  .then((url) => {
1327
1335
  if (canceled) {
@@ -4634,6 +4642,7 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAm
4634
4642
  current.removeEventListener('loadeddata', loadedDataHandler);
4635
4643
  };
4636
4644
  }
4645
+ console.log({ currentTime, frame, mediaStartsAt });
4637
4646
  current.currentTime = currentTime;
4638
4647
  const seekedHandler = () => {
4639
4648
  warnAboutNonSeekableMedia(current, 'exception');
@@ -4683,7 +4692,6 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAm
4683
4692
  videoConfig.fps,
4684
4693
  frame,
4685
4694
  mediaStartsAt,
4686
- onError,
4687
4695
  ]);
4688
4696
  const { src } = props;
4689
4697
  // If video source switches, make new handle
@@ -4715,6 +4723,7 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAm
4715
4723
  };
4716
4724
  }, [src, onDuration]);
4717
4725
  }
4726
+ console.log(JSON.stringify({ props }));
4718
4727
  return jsx("video", { ref: videoRef, ...props, onError: onError });
4719
4728
  };
4720
4729
  const VideoForRendering = forwardRef(VideoForRenderingForwardFunction);
@@ -1,4 +1,4 @@
1
1
  // Automatically generated on publish
2
- const VERSION = '4.0.38';
2
+ const VERSION = '4.0.40';
3
3
 
4
4
  export { VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "4.0.38",
3
+ "version": "4.0.40",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",