remotion 3.2.35-crf.3 → 3.2.35

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/LICENSE.md CHANGED
@@ -7,7 +7,7 @@ Depending on the type of your legal entity, you are granted permission to use Re
7
7
 
8
8
  ## Free license
9
9
 
10
- Copyright © 2022 [Jonny Burger](https://jonny.io)
10
+ Copyright © 2022 [Remotion](https://www.remotion.dev/)
11
11
 
12
12
  ### Eligibility
13
13
 
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  declare type Value = Record<string, string>;
3
3
  export declare const PreloadContext: React.Context<Value>;
4
- export declare const setPreloads: (updater: (p: Record<string, string>) => Record<string, string>) => void;
4
+ export declare const setPreloads: (updater: (p: Value) => Value) => void;
5
5
  export declare const PrefetchProvider: React.FC<{
6
6
  children: React.ReactNode;
7
7
  }>;
@@ -3,5 +3,7 @@ declare type FetchAndPreload = {
3
3
  free: () => void;
4
4
  waitUntilDone: () => Promise<string>;
5
5
  };
6
- export declare const prefetch: (src: string) => FetchAndPreload;
6
+ export declare const prefetch: (src: string, options?: {
7
+ method?: 'blob-url' | 'base64';
8
+ }) => FetchAndPreload;
7
9
  export {};
package/dist/prefetch.js CHANGED
@@ -10,7 +10,22 @@ const usePreload = (src) => {
10
10
  return (_a = preloads[src]) !== null && _a !== void 0 ? _a : src;
11
11
  };
12
12
  exports.usePreload = usePreload;
13
- const prefetch = (src) => {
13
+ const blobToBase64 = function (blob) {
14
+ const reader = new FileReader();
15
+ return new Promise((resolve, reject) => {
16
+ reader.onload = function () {
17
+ const dataUrl = reader.result;
18
+ resolve(dataUrl);
19
+ };
20
+ reader.onerror = (err) => {
21
+ return reject(err);
22
+ };
23
+ reader.readAsDataURL(blob);
24
+ });
25
+ };
26
+ const prefetch = (src, options) => {
27
+ var _a;
28
+ const method = (_a = options === null || options === void 0 ? void 0 : options.method) !== null && _a !== void 0 ? _a : 'blob-url';
14
29
  if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
15
30
  return {
16
31
  free: () => undefined,
@@ -41,17 +56,24 @@ const prefetch = (src) => {
41
56
  return res.blob();
42
57
  })
43
58
  .then((buf) => {
44
- if (canceled) {
59
+ if (!buf) {
45
60
  return;
46
61
  }
47
- if (buf) {
48
- objectUrl = URL.createObjectURL(buf);
49
- (0, prefetch_state_1.setPreloads)((p) => ({
50
- ...p,
51
- [src]: objectUrl,
52
- }));
53
- resolve(objectUrl);
62
+ if (method === 'base64') {
63
+ return blobToBase64(buf);
54
64
  }
65
+ return URL.createObjectURL(buf);
66
+ })
67
+ .then((url) => {
68
+ if (canceled) {
69
+ return;
70
+ }
71
+ objectUrl = url;
72
+ (0, prefetch_state_1.setPreloads)((p) => ({
73
+ ...p,
74
+ [src]: objectUrl,
75
+ }));
76
+ resolve(objectUrl);
55
77
  })
56
78
  .catch((err) => {
57
79
  reject(err);
@@ -59,7 +81,9 @@ const prefetch = (src) => {
59
81
  return {
60
82
  free: () => {
61
83
  if (objectUrl) {
62
- URL.revokeObjectURL(objectUrl);
84
+ if (method === 'blob-url') {
85
+ URL.revokeObjectURL(objectUrl);
86
+ }
63
87
  (0, prefetch_state_1.setPreloads)((p) => {
64
88
  const copy = { ...p };
65
89
  delete copy[src];
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "3.2.35-crf.3+08916235b";
1
+ export declare const VERSION = "3.2.35";
package/dist/version.js CHANGED
@@ -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 = '3.2.35-crf.3+08916235b';
5
+ exports.VERSION = '3.2.35';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "3.2.35-crf.3+08916235b",
3
+ "version": "3.2.35",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -55,5 +55,5 @@
55
55
  "publishConfig": {
56
56
  "access": "public"
57
57
  },
58
- "gitHead": "08916235b80e2f2bee603e2ba0ea8827b436cf8c"
58
+ "gitHead": "1bf079a1df57808460b1dd87de07d698388598da"
59
59
  }