@remotion/renderer 4.0.351 → 4.0.353

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.
@@ -121,12 +121,12 @@ const makeInlineAudioMixing = (dir) => {
121
121
  const samplesToShaveFromStart = trimLeftOffset * sample_rate_1.DEFAULT_SAMPLE_RATE;
122
122
  const samplesToShaveFromEnd = trimRightOffset * sample_rate_1.DEFAULT_SAMPLE_RATE;
123
123
  if (Math.abs(Math.round(samplesToShaveFromEnd) - samplesToShaveFromEnd) >
124
- 0.00000001) {
125
- throw new Error('samplesToShaveFromEnd should be approximately an integer');
124
+ 0.0000001) {
125
+ throw new Error(`samplesToShaveFromEnd should be approximately an integer, is${samplesToShaveFromEnd}`);
126
126
  }
127
127
  if (Math.abs(Math.round(samplesToShaveFromStart) - samplesToShaveFromStart) >
128
- 0.00000001) {
129
- throw new Error('samplesToShaveFromStart should be approximately an integer');
128
+ 0.0000001) {
129
+ throw new Error(`samplesToShaveFromStart should be approximately an integer, is ${samplesToShaveFromStart}`);
130
130
  }
131
131
  if (isFirst) {
132
132
  arr = arr.slice(Math.round(samplesToShaveFromStart) * asset.numberOfChannels);
@@ -135,10 +135,9 @@ const makeInlineAudioMixing = (dir) => {
135
135
  arr = arr.slice(0, arr.length + Math.round(samplesToShaveFromEnd) * asset.numberOfChannels);
136
136
  }
137
137
  const positionInSeconds = (asset.frame - firstFrame) / fps - (isFirst ? 0 : trimLeftOffset);
138
- const position = Math.round(positionInSeconds *
138
+ const position = Math.round(positionInSeconds * sample_rate_1.DEFAULT_SAMPLE_RATE) *
139
139
  asset.numberOfChannels *
140
- sample_rate_1.DEFAULT_SAMPLE_RATE *
141
- BYTES_PER_SAMPLE);
140
+ BYTES_PER_SAMPLE;
142
141
  (0, node_fs_1.writeSync)(
143
142
  // fs
144
143
  fileDescriptor,
@@ -48,6 +48,32 @@ const shouldHideWarning = (log) => {
48
48
  }
49
49
  return false;
50
50
  };
51
+ const format = (eventType, args) => {
52
+ var _a, _b, _c, _d, _e, _f, _g, _h;
53
+ const previewString = args
54
+ .filter((a) => { var _a; return !(a.type === 'symbol' && ((_a = a.description) === null || _a === void 0 ? void 0 : _a.includes(`__remotion_`))); })
55
+ .map((a) => (0, format_logs_1.formatRemoteObject)(a))
56
+ .filter(Boolean)
57
+ .join(' ');
58
+ let logLevelFromRemotionLog = null;
59
+ let tag = null;
60
+ for (const a of args) {
61
+ if (a.type === 'symbol' && ((_a = a.description) === null || _a === void 0 ? void 0 : _a.includes(`__remotion_level_`))) {
62
+ logLevelFromRemotionLog = (_d = (_c = (_b = a.description) === null || _b === void 0 ? void 0 : _b.split('__remotion_level_')) === null || _c === void 0 ? void 0 : _c[1]) === null || _d === void 0 ? void 0 : _d.replace(')', '');
63
+ }
64
+ if (a.type === 'symbol' && ((_e = a.description) === null || _e === void 0 ? void 0 : _e.includes(`__remotion_tag_`))) {
65
+ tag = (_h = (_g = (_f = a.description) === null || _f === void 0 ? void 0 : _f.split('__remotion_tag_')) === null || _g === void 0 ? void 0 : _g[1]) === null || _h === void 0 ? void 0 : _h.replace(')', '');
66
+ }
67
+ }
68
+ const logLevelFromEvent = eventType === 'debug'
69
+ ? 'verbose'
70
+ : eventType === 'error'
71
+ ? 'error'
72
+ : eventType === 'warning'
73
+ ? 'warn'
74
+ : 'verbose';
75
+ return { previewString, logLevelFromRemotionLog, logLevelFromEvent, tag };
76
+ };
51
77
  class Page extends EventEmitter_1.EventEmitter {
52
78
  static async _create({ client, target, defaultViewport, browser, sourceMapGetter, logLevel, indent, pageIndex, onBrowserLog, }) {
53
79
  const page = new Page({
@@ -74,22 +100,23 @@ class Page extends EventEmitter_1.EventEmitter {
74
100
  _Page_frameManager.set(this, void 0);
75
101
  _Page_pageBindings.set(this, new Map());
76
102
  _Page_onConsole.set(this, (log) => {
77
- var _a, _b;
78
- const { url, columnNumber, lineNumber } = log.location();
103
+ var _a, _b, _c;
104
+ const stackTrace = log.stackTrace();
105
+ const { url, columnNumber, lineNumber } = (_a = stackTrace[0]) !== null && _a !== void 0 ? _a : {};
79
106
  const logLevel = this.logLevel;
80
107
  const indent = this.indent;
81
108
  if (shouldHideWarning(log)) {
82
109
  return;
83
110
  }
84
- (_a = this.onBrowserLog) === null || _a === void 0 ? void 0 : _a.call(this, {
85
- stackTrace: log.stackTrace(),
111
+ (_b = this.onBrowserLog) === null || _b === void 0 ? void 0 : _b.call(this, {
112
+ stackTrace,
86
113
  text: log.text,
87
114
  type: log.type,
88
115
  });
89
116
  if ((url === null || url === void 0 ? void 0 : url.endsWith(no_react_1.NoReactInternals.bundleName)) &&
90
117
  lineNumber &&
91
118
  this.sourceMapGetter()) {
92
- const origPosition = (_b = this.sourceMapGetter()) === null || _b === void 0 ? void 0 : _b.originalPositionFor({
119
+ const origPosition = (_c = this.sourceMapGetter()) === null || _c === void 0 ? void 0 : _c.originalPositionFor({
93
120
  column: columnNumber !== null && columnNumber !== void 0 ? columnNumber : 0,
94
121
  line: lineNumber,
95
122
  });
@@ -105,7 +132,9 @@ class Page extends EventEmitter_1.EventEmitter {
105
132
  const tagInfo = [origPosition === null || origPosition === void 0 ? void 0 : origPosition.name, isDelayRenderClear ? null : file]
106
133
  .filter(truthy_1.truthy)
107
134
  .join('@');
108
- const tag = [tabInfo, tagInfo].filter(truthy_1.truthy).join(', ');
135
+ const tag = [tabInfo, log.tag, log.tag ? null : tagInfo]
136
+ .filter(truthy_1.truthy)
137
+ .join(', ');
109
138
  if (log.type === 'error') {
110
139
  logger_1.Log.error({
111
140
  logLevel,
@@ -114,11 +143,11 @@ class Page extends EventEmitter_1.EventEmitter {
114
143
  }, log.previewString);
115
144
  }
116
145
  else {
117
- logger_1.Log.verbose({
146
+ logger_1.Log[logLevel]({
118
147
  logLevel,
119
148
  tag,
120
149
  indent,
121
- }, isDelayRenderClear ? log.previewString : log.previewString);
150
+ }, log.previewString);
122
151
  }
123
152
  }
124
153
  else if (log.type === 'error') {
@@ -317,13 +346,7 @@ _Page_client = new WeakMap(), _Page_target = new WeakMap(), _Page_timeoutSetting
317
346
  return (0, util_1.releaseObject)(__classPrivateFieldGet(this, _Page_client, "f"), arg);
318
347
  });
319
348
  }
320
- const previewString = args
321
- ? args
322
- .map((arg) => {
323
- return (0, format_logs_1.formatRemoteObject)(arg);
324
- })
325
- .join(', ')
326
- : '';
349
+ const { previewString, logLevelFromRemotionLog, logLevelFromEvent, tag } = format(level, args !== null && args !== void 0 ? args : []);
327
350
  if (source !== 'worker') {
328
351
  const message = new ConsoleMessage_1.ConsoleMessage({
329
352
  type: level,
@@ -331,6 +354,8 @@ _Page_client = new WeakMap(), _Page_target = new WeakMap(), _Page_timeoutSetting
331
354
  args: [],
332
355
  stackTraceLocations: [{ url, lineNumber }],
333
356
  previewString,
357
+ logLevel: logLevelFromRemotionLog !== null && logLevelFromRemotionLog !== void 0 ? logLevelFromRemotionLog : logLevelFromEvent,
358
+ tag,
334
359
  });
335
360
  (_a = this.onBrowserLog) === null || _a === void 0 ? void 0 : _a.call(this, {
336
361
  stackTrace: message.stackTrace(),
@@ -382,6 +407,7 @@ _Page_client = new WeakMap(), _Page_target = new WeakMap(), _Page_timeoutSetting
382
407
  contextId: event.executionContextId,
383
408
  });
384
409
  }, _Page_addConsoleMessage = function _Page_addConsoleMessage(eventType, args, stackTrace) {
410
+ var _a, _b;
385
411
  const textTokens = [];
386
412
  for (const arg of args) {
387
413
  const remoteObject = arg._remoteObject;
@@ -402,16 +428,16 @@ _Page_client = new WeakMap(), _Page_target = new WeakMap(), _Page_timeoutSetting
402
428
  });
403
429
  }
404
430
  }
405
- const previewString = args
406
- .map((a) => (0, format_logs_1.formatRemoteObject)(a._remoteObject))
407
- .filter(Boolean)
408
- .join(' ');
431
+ const { previewString, logLevelFromRemotionLog, logLevelFromEvent, tag } = format(eventType, (_a = args.map((a) => a._remoteObject)) !== null && _a !== void 0 ? _a : []);
432
+ const logLevel = (_b = logLevelFromRemotionLog) !== null && _b !== void 0 ? _b : logLevelFromEvent;
409
433
  const message = new ConsoleMessage_1.ConsoleMessage({
410
434
  type: eventType,
411
435
  text: textTokens.join(' '),
412
436
  args,
413
437
  stackTraceLocations,
414
438
  previewString,
439
+ logLevel,
440
+ tag,
415
441
  });
416
442
  __classPrivateFieldGet(this, _Page_onConsole, "f").call(this, message);
417
443
  };
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { LogLevel } from 'remotion';
16
17
  import type { JSHandle } from './JSHandle';
17
18
  export interface ConsoleMessageLocation {
18
19
  url?: string;
@@ -26,13 +27,16 @@ export declare class ConsoleMessage {
26
27
  text: string;
27
28
  args: JSHandle[];
28
29
  previewString: string;
29
- constructor({ type, text, args, stackTraceLocations, previewString, }: {
30
+ logLevel: LogLevel;
31
+ tag: string | null;
32
+ constructor({ type, text, args, stackTraceLocations, previewString, logLevel, tag, }: {
30
33
  type: ConsoleMessageType;
31
34
  text: string;
32
35
  args: JSHandle[];
33
36
  stackTraceLocations: ConsoleMessageLocation[];
34
37
  previewString: string;
38
+ logLevel: LogLevel;
39
+ tag: string | null;
35
40
  });
36
- location(): ConsoleMessageLocation;
37
41
  stackTrace(): ConsoleMessageLocation[];
38
42
  }
@@ -29,17 +29,15 @@ var _ConsoleMessage_stackTraceLocations;
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
30
  exports.ConsoleMessage = void 0;
31
31
  class ConsoleMessage {
32
- constructor({ type, text, args, stackTraceLocations, previewString, }) {
32
+ constructor({ type, text, args, stackTraceLocations, previewString, logLevel, tag, }) {
33
33
  _ConsoleMessage_stackTraceLocations.set(this, void 0);
34
34
  this.type = type;
35
35
  this.text = text;
36
36
  this.args = args;
37
37
  this.previewString = previewString;
38
38
  __classPrivateFieldSet(this, _ConsoleMessage_stackTraceLocations, stackTraceLocations, "f");
39
- }
40
- location() {
41
- var _a;
42
- return (_a = __classPrivateFieldGet(this, _ConsoleMessage_stackTraceLocations, "f")[0]) !== null && _a !== void 0 ? _a : {};
39
+ this.logLevel = logLevel;
40
+ this.tag = tag;
43
41
  }
44
42
  stackTrace() {
45
43
  return __classPrivateFieldGet(this, _ConsoleMessage_stackTraceLocations, "f");
package/dist/client.d.ts CHANGED
@@ -947,10 +947,46 @@ export declare const BrowserSafeApis: {
947
947
  };
948
948
  setConfig: (pattern: string | null) => void;
949
949
  };
950
+ mediaCacheSizeInBytesOption: {
951
+ name: string;
952
+ cliFlag: "media-cache-size-in-bytes";
953
+ description: () => import("react/jsx-runtime").JSX.Element;
954
+ ssrName: "mediaCacheSizeInBytes";
955
+ docLink: string;
956
+ type: number | null;
957
+ getValue: ({ commandLine }: {
958
+ commandLine: Record<string, unknown>;
959
+ }) => {
960
+ source: string;
961
+ value: number;
962
+ } | {
963
+ source: string;
964
+ value: null;
965
+ };
966
+ setConfig: (size: number | null) => void;
967
+ };
950
968
  };
951
969
  validColorSpaces: readonly ["default", "bt709", "bt2020-ncl"];
952
970
  optionsMap: {
953
971
  readonly renderMedia: {
972
+ readonly mediaCacheSizeInBytes: {
973
+ name: string;
974
+ cliFlag: "media-cache-size-in-bytes";
975
+ description: () => import("react/jsx-runtime").JSX.Element;
976
+ ssrName: "mediaCacheSizeInBytes";
977
+ docLink: string;
978
+ type: number | null;
979
+ getValue: ({ commandLine }: {
980
+ commandLine: Record<string, unknown>;
981
+ }) => {
982
+ source: string;
983
+ value: number;
984
+ } | {
985
+ source: string;
986
+ value: null;
987
+ };
988
+ setConfig: (size: number | null) => void;
989
+ };
954
990
  readonly offthreadVideoCacheSizeInBytes: {
955
991
  name: string;
956
992
  cliFlag: "offthreadvideo-cache-size-in-bytes";
@@ -1364,6 +1400,24 @@ export declare const BrowserSafeApis: {
1364
1400
  };
1365
1401
  };
1366
1402
  readonly renderStill: {
1403
+ readonly mediaCacheSizeInBytes: {
1404
+ name: string;
1405
+ cliFlag: "media-cache-size-in-bytes";
1406
+ description: () => import("react/jsx-runtime").JSX.Element;
1407
+ ssrName: "mediaCacheSizeInBytes";
1408
+ docLink: string;
1409
+ type: number | null;
1410
+ getValue: ({ commandLine }: {
1411
+ commandLine: Record<string, unknown>;
1412
+ }) => {
1413
+ source: string;
1414
+ value: number;
1415
+ } | {
1416
+ source: string;
1417
+ value: null;
1418
+ };
1419
+ setConfig: (size: number | null) => void;
1420
+ };
1367
1421
  readonly offthreadVideoCacheSizeInBytes: {
1368
1422
  name: string;
1369
1423
  cliFlag: "offthreadvideo-cache-size-in-bytes";
@@ -1487,6 +1541,24 @@ export declare const BrowserSafeApis: {
1487
1541
  };
1488
1542
  };
1489
1543
  readonly getCompositions: {
1544
+ readonly mediaCacheSizeInBytes: {
1545
+ name: string;
1546
+ cliFlag: "media-cache-size-in-bytes";
1547
+ description: () => import("react/jsx-runtime").JSX.Element;
1548
+ ssrName: "mediaCacheSizeInBytes";
1549
+ docLink: string;
1550
+ type: number | null;
1551
+ getValue: ({ commandLine }: {
1552
+ commandLine: Record<string, unknown>;
1553
+ }) => {
1554
+ source: string;
1555
+ value: number;
1556
+ } | {
1557
+ source: string;
1558
+ value: null;
1559
+ };
1560
+ setConfig: (size: number | null) => void;
1561
+ };
1490
1562
  readonly offthreadVideoCacheSizeInBytes: {
1491
1563
  name: string;
1492
1564
  cliFlag: "offthreadvideo-cache-size-in-bytes";
@@ -1595,6 +1667,24 @@ export declare const BrowserSafeApis: {
1595
1667
  };
1596
1668
  };
1597
1669
  readonly selectComposition: {
1670
+ readonly mediaCacheSizeInBytes: {
1671
+ name: string;
1672
+ cliFlag: "media-cache-size-in-bytes";
1673
+ description: () => import("react/jsx-runtime").JSX.Element;
1674
+ ssrName: "mediaCacheSizeInBytes";
1675
+ docLink: string;
1676
+ type: number | null;
1677
+ getValue: ({ commandLine }: {
1678
+ commandLine: Record<string, unknown>;
1679
+ }) => {
1680
+ source: string;
1681
+ value: number;
1682
+ } | {
1683
+ source: string;
1684
+ value: null;
1685
+ };
1686
+ setConfig: (size: number | null) => void;
1687
+ };
1598
1688
  readonly offthreadVideoCacheSizeInBytes: {
1599
1689
  name: string;
1600
1690
  cliFlag: "offthreadvideo-cache-size-in-bytes";
@@ -1703,6 +1793,24 @@ export declare const BrowserSafeApis: {
1703
1793
  };
1704
1794
  };
1705
1795
  readonly renderFrames: {
1796
+ readonly mediaCacheSizeInBytes: {
1797
+ name: string;
1798
+ cliFlag: "media-cache-size-in-bytes";
1799
+ description: () => import("react/jsx-runtime").JSX.Element;
1800
+ ssrName: "mediaCacheSizeInBytes";
1801
+ docLink: string;
1802
+ type: number | null;
1803
+ getValue: ({ commandLine }: {
1804
+ commandLine: Record<string, unknown>;
1805
+ }) => {
1806
+ source: string;
1807
+ value: number;
1808
+ } | {
1809
+ source: string;
1810
+ value: null;
1811
+ };
1812
+ setConfig: (size: number | null) => void;
1813
+ };
1706
1814
  readonly forSeamlessAacConcatenation: {
1707
1815
  name: string;
1708
1816
  cliFlag: "for-seamless-aac-concatenation";
@@ -1859,6 +1967,24 @@ export declare const BrowserSafeApis: {
1859
1967
  };
1860
1968
  };
1861
1969
  readonly renderMediaOnLambda: {
1970
+ readonly mediaCacheSizeInBytes: {
1971
+ name: string;
1972
+ cliFlag: "media-cache-size-in-bytes";
1973
+ description: () => import("react/jsx-runtime").JSX.Element;
1974
+ ssrName: "mediaCacheSizeInBytes";
1975
+ docLink: string;
1976
+ type: number | null;
1977
+ getValue: ({ commandLine }: {
1978
+ commandLine: Record<string, unknown>;
1979
+ }) => {
1980
+ source: string;
1981
+ value: number;
1982
+ } | {
1983
+ source: string;
1984
+ value: null;
1985
+ };
1986
+ setConfig: (size: number | null) => void;
1987
+ };
1862
1988
  readonly offthreadVideoCacheSizeInBytes: {
1863
1989
  name: string;
1864
1990
  cliFlag: "offthreadvideo-cache-size-in-bytes";
@@ -2113,6 +2239,24 @@ export declare const BrowserSafeApis: {
2113
2239
  };
2114
2240
  };
2115
2241
  readonly renderStillOnLambda: {
2242
+ readonly mediaCacheSizeInBytes: {
2243
+ name: string;
2244
+ cliFlag: "media-cache-size-in-bytes";
2245
+ description: () => import("react/jsx-runtime").JSX.Element;
2246
+ ssrName: "mediaCacheSizeInBytes";
2247
+ docLink: string;
2248
+ type: number | null;
2249
+ getValue: ({ commandLine }: {
2250
+ commandLine: Record<string, unknown>;
2251
+ }) => {
2252
+ source: string;
2253
+ value: number;
2254
+ } | {
2255
+ source: string;
2256
+ value: null;
2257
+ };
2258
+ setConfig: (size: number | null) => void;
2259
+ };
2116
2260
  readonly offthreadVideoCacheSizeInBytes: {
2117
2261
  name: string;
2118
2262
  cliFlag: "offthreadvideo-cache-size-in-bytes";
@@ -2244,11 +2388,11 @@ export declare const BrowserSafeApis: {
2244
2388
  };
2245
2389
  };
2246
2390
  readonly getCompositionsOnLambda: {
2247
- readonly offthreadVideoCacheSizeInBytes: {
2391
+ readonly mediaCacheSizeInBytes: {
2248
2392
  name: string;
2249
- cliFlag: "offthreadvideo-cache-size-in-bytes";
2393
+ cliFlag: "media-cache-size-in-bytes";
2250
2394
  description: () => import("react/jsx-runtime").JSX.Element;
2251
- ssrName: "offthreadVideoCacheSizeInBytes";
2395
+ ssrName: "mediaCacheSizeInBytes";
2252
2396
  docLink: string;
2253
2397
  type: number | null;
2254
2398
  getValue: ({ commandLine }: {
@@ -2262,11 +2406,11 @@ export declare const BrowserSafeApis: {
2262
2406
  };
2263
2407
  setConfig: (size: number | null) => void;
2264
2408
  };
2265
- readonly offthreadVideoThreads: {
2409
+ readonly offthreadVideoCacheSizeInBytes: {
2266
2410
  name: string;
2267
- cliFlag: "offthreadvideo-video-threads";
2411
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
2268
2412
  description: () => import("react/jsx-runtime").JSX.Element;
2269
- ssrName: "offthreadVideoThreads";
2413
+ ssrName: "offthreadVideoCacheSizeInBytes";
2270
2414
  docLink: string;
2271
2415
  type: number | null;
2272
2416
  getValue: ({ commandLine }: {
@@ -2312,6 +2456,24 @@ export declare const BrowserSafeApis: {
2312
2456
  };
2313
2457
  };
2314
2458
  readonly renderMediaOnCloudRun: {
2459
+ readonly mediaCacheSizeInBytes: {
2460
+ name: string;
2461
+ cliFlag: "media-cache-size-in-bytes";
2462
+ description: () => import("react/jsx-runtime").JSX.Element;
2463
+ ssrName: "mediaCacheSizeInBytes";
2464
+ docLink: string;
2465
+ type: number | null;
2466
+ getValue: ({ commandLine }: {
2467
+ commandLine: Record<string, unknown>;
2468
+ }) => {
2469
+ source: string;
2470
+ value: number;
2471
+ } | {
2472
+ source: string;
2473
+ value: null;
2474
+ };
2475
+ setConfig: (size: number | null) => void;
2476
+ };
2315
2477
  readonly offthreadVideoCacheSizeInBytes: {
2316
2478
  name: string;
2317
2479
  cliFlag: "offthreadvideo-cache-size-in-bytes";
@@ -2596,6 +2758,24 @@ export declare const BrowserSafeApis: {
2596
2758
  };
2597
2759
  };
2598
2760
  readonly renderStillOnCloudRun: {
2761
+ readonly mediaCacheSizeInBytes: {
2762
+ name: string;
2763
+ cliFlag: "media-cache-size-in-bytes";
2764
+ description: () => import("react/jsx-runtime").JSX.Element;
2765
+ ssrName: "mediaCacheSizeInBytes";
2766
+ docLink: string;
2767
+ type: number | null;
2768
+ getValue: ({ commandLine }: {
2769
+ commandLine: Record<string, unknown>;
2770
+ }) => {
2771
+ source: string;
2772
+ value: number;
2773
+ } | {
2774
+ source: string;
2775
+ value: null;
2776
+ };
2777
+ setConfig: (size: number | null) => void;
2778
+ };
2599
2779
  readonly offthreadVideoCacheSizeInBytes: {
2600
2780
  name: string;
2601
2781
  cliFlag: "offthreadvideo-cache-size-in-bytes";