@remotion/renderer 3.0.20 → 3.0.21
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/assets/get-audio-channels.d.ts +0 -1
- package/dist/assets/get-audio-channels.js +1 -2
- package/dist/browser/Accessibility.d.ts +175 -0
- package/dist/browser/Accessibility.js +423 -0
- package/dist/browser/AriaQueryHandler.d.ts +20 -0
- package/dist/browser/AriaQueryHandler.js +108 -0
- package/dist/browser/Browser.d.ts +209 -0
- package/dist/browser/Browser.js +402 -0
- package/dist/browser/BrowserConnector.d.ts +26 -0
- package/dist/browser/BrowserConnector.js +49 -0
- package/dist/browser/BrowserFetcher.d.ts +89 -0
- package/dist/browser/BrowserFetcher.js +512 -0
- package/dist/browser/BrowserRunner.d.ts +39 -0
- package/dist/browser/BrowserRunner.js +308 -0
- package/dist/browser/Connection.d.ts +49 -0
- package/dist/browser/Connection.js +262 -0
- package/dist/browser/ConnectionTransport.d.ts +21 -0
- package/dist/browser/ConnectionTransport.js +17 -0
- package/dist/browser/ConsoleMessage.d.ts +55 -0
- package/dist/browser/ConsoleMessage.js +75 -0
- package/dist/browser/Coverage.d.ts +180 -0
- package/dist/browser/Coverage.js +371 -0
- package/dist/browser/DOMWorld.d.ts +50 -0
- package/dist/browser/DOMWorld.js +280 -0
- package/dist/browser/Debug.d.ts +19 -0
- package/dist/browser/Debug.js +42 -0
- package/dist/browser/DeviceDescriptors.d.ts +40 -0
- package/dist/browser/DeviceDescriptors.js +1407 -0
- package/dist/browser/EmulationManager.d.ts +7 -0
- package/dist/browser/EmulationManager.js +40 -0
- package/dist/browser/Errors.d.ts +25 -0
- package/dist/browser/Errors.js +35 -0
- package/dist/browser/EvalTypes.d.ts +27 -0
- package/dist/browser/EvalTypes.js +17 -0
- package/dist/browser/EventEmitter.d.ts +70 -0
- package/dist/browser/EventEmitter.js +102 -0
- package/dist/browser/ExecutionContext.d.ts +35 -0
- package/dist/browser/ExecutionContext.js +190 -0
- package/dist/browser/FileChooser.d.ts +56 -0
- package/dist/browser/FileChooser.js +86 -0
- package/dist/browser/FrameManager.d.ts +96 -0
- package/dist/browser/FrameManager.js +512 -0
- package/dist/browser/HTTPRequest.d.ts +42 -0
- package/dist/browser/HTTPRequest.js +82 -0
- package/dist/browser/HTTPResponse.d.ts +100 -0
- package/dist/browser/HTTPResponse.js +196 -0
- package/dist/browser/Input.d.ts +355 -0
- package/dist/browser/Input.js +592 -0
- package/dist/browser/JSHandle.d.ts +36 -0
- package/dist/browser/JSHandle.js +93 -0
- package/dist/browser/LaunchOptions.d.ts +117 -0
- package/dist/browser/LaunchOptions.js +17 -0
- package/dist/browser/Launcher.d.ts +9 -0
- package/dist/browser/Launcher.js +602 -0
- package/dist/browser/LifecycleWatcher.d.ts +29 -0
- package/dist/browser/LifecycleWatcher.js +193 -0
- package/dist/browser/NetworkConditions.d.ts +26 -0
- package/dist/browser/NetworkConditions.js +33 -0
- package/dist/browser/NetworkEventManager.d.ts +35 -0
- package/dist/browser/NetworkEventManager.js +128 -0
- package/dist/browser/NetworkManager.d.ts +36 -0
- package/dist/browser/NetworkManager.js +284 -0
- package/dist/browser/NodeWebSocketTransport.d.ts +11 -0
- package/dist/browser/NodeWebSocketTransport.js +90 -0
- package/dist/browser/PDFOptions.d.ts +165 -0
- package/dist/browser/PDFOptions.js +34 -0
- package/dist/browser/PipeTransport.d.ts +10 -0
- package/dist/browser/PipeTransport.js +86 -0
- package/dist/browser/Product.d.ts +16 -0
- package/dist/browser/Product.js +17 -0
- package/dist/browser/Puppeteer.d.ts +35 -0
- package/dist/browser/Puppeteer.js +17 -0
- package/dist/browser/PuppeteerNode.d.ts +92 -0
- package/dist/browser/PuppeteerNode.js +143 -0
- package/dist/browser/PuppeteerViewport.d.ts +5 -0
- package/dist/browser/PuppeteerViewport.js +2 -0
- package/dist/browser/QueryHandler.d.ts +64 -0
- package/dist/browser/QueryHandler.js +183 -0
- package/dist/browser/ScreenshotOptions.d.ts +14 -0
- package/dist/browser/ScreenshotOptions.js +2 -0
- package/dist/browser/SecurityDetails.d.ts +55 -0
- package/dist/browser/SecurityDetails.js +95 -0
- package/dist/browser/Target.d.ts +61 -0
- package/dist/browser/Target.js +146 -0
- package/dist/browser/TaskQueue.d.ts +20 -0
- package/dist/browser/TaskQueue.js +47 -0
- package/dist/browser/TimeoutSettings.d.ts +23 -0
- package/dist/browser/TimeoutSettings.js +62 -0
- package/dist/browser/Tracing.d.ts +45 -0
- package/dist/browser/Tracing.js +136 -0
- package/dist/browser/USKeyboardLayout.d.ts +39 -0
- package/dist/browser/USKeyboardLayout.js +406 -0
- package/dist/browser/WebWorker.d.ts +96 -0
- package/dist/browser/WebWorker.js +122 -0
- package/dist/browser/assert.d.ts +21 -0
- package/dist/browser/assert.js +29 -0
- package/dist/browser/compat.d.ts +2 -0
- package/dist/browser/compat.js +17 -0
- package/dist/browser/create-browser-fetcher.d.ts +17 -0
- package/dist/browser/create-browser-fetcher.js +140 -0
- package/dist/browser/dialog.d.ts +70 -0
- package/dist/browser/dialog.js +114 -0
- package/dist/browser/environment.d.ts +16 -0
- package/dist/browser/environment.js +19 -0
- package/dist/browser/fetch.d.ts +16 -0
- package/dist/browser/fetch.js +46 -0
- package/dist/browser/find-up.d.ts +4 -0
- package/dist/browser/find-up.js +85 -0
- package/dist/browser/get-download-destination.d.ts +1 -0
- package/dist/browser/get-download-destination.js +38 -0
- package/dist/browser/mitt/index.d.ts +22 -0
- package/dist/browser/mitt/index.js +49 -0
- package/dist/browser/node.d.ts +2 -0
- package/dist/browser/node.js +9 -0
- package/dist/browser/page.d.ts +78 -0
- package/dist/browser/page.js +277 -0
- package/dist/browser/pkg-dir.d.ts +3 -0
- package/dist/browser/pkg-dir.js +13 -0
- package/dist/browser/revisions.d.ts +21 -0
- package/dist/browser/revisions.js +22 -0
- package/dist/browser/util.d.ts +46 -0
- package/dist/browser/util.js +161 -0
- package/dist/extract-frame-from-video.d.ts +0 -4
- package/dist/extract-frame-from-video.js +2 -12
- package/dist/index.d.ts +1 -0
- package/dist/last-frame-from-video-cache.d.ts +0 -3
- package/dist/last-frame-from-video-cache.js +3 -5
- package/dist/provide-screenshot.d.ts +0 -1
- package/dist/puppeteer-screenshot.d.ts +0 -1
- package/dist/screenshot-dom-element.d.ts +0 -1
- package/dist/screenshot-task.d.ts +0 -1
- package/package.json +3 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2020 Google Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
declare type Revisions = Readonly<{
|
|
17
|
+
readonly chromium: string;
|
|
18
|
+
readonly firefox: string;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const PUPPETEER_REVISIONS: Revisions;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2020 Google Inc. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.PUPPETEER_REVISIONS = void 0;
|
|
19
|
+
exports.PUPPETEER_REVISIONS = {
|
|
20
|
+
chromium: '1002410',
|
|
21
|
+
firefox: 'latest',
|
|
22
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2017 Google Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/// <reference types="node" />
|
|
17
|
+
import { Protocol } from 'devtools-protocol';
|
|
18
|
+
import { CDPSession } from './Connection';
|
|
19
|
+
import { CommonEventEmitter } from './EventEmitter';
|
|
20
|
+
export declare function getExceptionMessage(exceptionDetails: Protocol.Runtime.ExceptionDetails): string;
|
|
21
|
+
export declare function valueFromRemoteObject(remoteObject: Protocol.Runtime.RemoteObject): any;
|
|
22
|
+
export declare function releaseObject(client: CDPSession, remoteObject: Protocol.Runtime.RemoteObject): Promise<void>;
|
|
23
|
+
export interface PuppeteerEventListener {
|
|
24
|
+
emitter: CommonEventEmitter;
|
|
25
|
+
eventName: string | symbol;
|
|
26
|
+
handler: (...args: any[]) => void;
|
|
27
|
+
}
|
|
28
|
+
export declare function addEventListener(emitter: CommonEventEmitter, eventName: string | symbol, handler: (...args: any[]) => void): PuppeteerEventListener;
|
|
29
|
+
export declare function removeEventListeners(listeners: Array<{
|
|
30
|
+
emitter: CommonEventEmitter;
|
|
31
|
+
eventName: string | symbol;
|
|
32
|
+
handler: (...args: any[]) => void;
|
|
33
|
+
}>): void;
|
|
34
|
+
export declare const isString: (obj: unknown) => obj is string;
|
|
35
|
+
export declare function evaluationString(fun: Function | string, ...args: unknown[]): string;
|
|
36
|
+
export declare function pageBindingDeliverResultString(name: string, seq: number, result: unknown): string;
|
|
37
|
+
export declare function pageBindingDeliverErrorString(name: string, seq: number, message: string, stack?: string): string;
|
|
38
|
+
export declare function pageBindingDeliverErrorValueString(name: string, seq: number, value: unknown): string;
|
|
39
|
+
export declare function waitWithTimeout<T>(promise: Promise<T>, taskName: string, timeout: number): Promise<T>;
|
|
40
|
+
interface ErrorLike extends Error {
|
|
41
|
+
name: string;
|
|
42
|
+
message: string;
|
|
43
|
+
}
|
|
44
|
+
export declare function isErrorLike(obj: unknown): obj is ErrorLike;
|
|
45
|
+
export declare function isErrnoException(obj: unknown): obj is NodeJS.ErrnoException;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2017 Google Inc. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.isErrnoException = exports.isErrorLike = exports.waitWithTimeout = exports.pageBindingDeliverErrorValueString = exports.pageBindingDeliverErrorString = exports.pageBindingDeliverResultString = exports.evaluationString = exports.isString = exports.removeEventListeners = exports.addEventListener = exports.releaseObject = exports.valueFromRemoteObject = exports.getExceptionMessage = void 0;
|
|
19
|
+
const assert_1 = require("./assert");
|
|
20
|
+
const Errors_1 = require("./Errors");
|
|
21
|
+
function getExceptionMessage(exceptionDetails) {
|
|
22
|
+
if (exceptionDetails.exception) {
|
|
23
|
+
return (exceptionDetails.exception.description || exceptionDetails.exception.value);
|
|
24
|
+
}
|
|
25
|
+
let message = exceptionDetails.text;
|
|
26
|
+
if (exceptionDetails.stackTrace) {
|
|
27
|
+
for (const callframe of exceptionDetails.stackTrace.callFrames) {
|
|
28
|
+
const location = callframe.url +
|
|
29
|
+
':' +
|
|
30
|
+
callframe.lineNumber +
|
|
31
|
+
':' +
|
|
32
|
+
callframe.columnNumber;
|
|
33
|
+
const functionName = callframe.functionName || '<anonymous>';
|
|
34
|
+
message += `\n at ${functionName} (${location})`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return message;
|
|
38
|
+
}
|
|
39
|
+
exports.getExceptionMessage = getExceptionMessage;
|
|
40
|
+
function valueFromRemoteObject(remoteObject) {
|
|
41
|
+
(0, assert_1.assert)(!remoteObject.objectId, 'Cannot extract value when objectId is given');
|
|
42
|
+
if (remoteObject.unserializableValue) {
|
|
43
|
+
if (remoteObject.type === 'bigint' && typeof BigInt !== 'undefined') {
|
|
44
|
+
return BigInt(remoteObject.unserializableValue.replace('n', ''));
|
|
45
|
+
}
|
|
46
|
+
switch (remoteObject.unserializableValue) {
|
|
47
|
+
case '-0':
|
|
48
|
+
return -0;
|
|
49
|
+
case 'NaN':
|
|
50
|
+
return NaN;
|
|
51
|
+
case 'Infinity':
|
|
52
|
+
return Infinity;
|
|
53
|
+
case '-Infinity':
|
|
54
|
+
return -Infinity;
|
|
55
|
+
default:
|
|
56
|
+
throw new Error('Unsupported unserializable value: ' +
|
|
57
|
+
remoteObject.unserializableValue);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return remoteObject.value;
|
|
61
|
+
}
|
|
62
|
+
exports.valueFromRemoteObject = valueFromRemoteObject;
|
|
63
|
+
async function releaseObject(client, remoteObject) {
|
|
64
|
+
if (!remoteObject.objectId) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
await client
|
|
68
|
+
.send('Runtime.releaseObject', { objectId: remoteObject.objectId })
|
|
69
|
+
.catch(() => {
|
|
70
|
+
// Exceptions might happen in case of a page been navigated or closed.
|
|
71
|
+
// Swallow these since they are harmless and we don't leak anything in this case.
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
exports.releaseObject = releaseObject;
|
|
75
|
+
function addEventListener(emitter, eventName, handler) {
|
|
76
|
+
emitter.on(eventName, handler);
|
|
77
|
+
return { emitter, eventName, handler };
|
|
78
|
+
}
|
|
79
|
+
exports.addEventListener = addEventListener;
|
|
80
|
+
function removeEventListeners(listeners) {
|
|
81
|
+
for (const listener of listeners) {
|
|
82
|
+
listener.emitter.removeListener(listener.eventName, listener.handler);
|
|
83
|
+
}
|
|
84
|
+
listeners.length = 0;
|
|
85
|
+
}
|
|
86
|
+
exports.removeEventListeners = removeEventListeners;
|
|
87
|
+
const isString = (obj) => {
|
|
88
|
+
return typeof obj === 'string' || obj instanceof String;
|
|
89
|
+
};
|
|
90
|
+
exports.isString = isString;
|
|
91
|
+
function evaluationString(fun, ...args) {
|
|
92
|
+
if ((0, exports.isString)(fun)) {
|
|
93
|
+
(0, assert_1.assert)(args.length === 0, 'Cannot evaluate a string with arguments');
|
|
94
|
+
return fun;
|
|
95
|
+
}
|
|
96
|
+
function serializeArgument(arg) {
|
|
97
|
+
if (Object.is(arg, undefined)) {
|
|
98
|
+
return 'undefined';
|
|
99
|
+
}
|
|
100
|
+
return JSON.stringify(arg);
|
|
101
|
+
}
|
|
102
|
+
return `(${fun})(${args.map(serializeArgument).join(',')})`;
|
|
103
|
+
}
|
|
104
|
+
exports.evaluationString = evaluationString;
|
|
105
|
+
function pageBindingDeliverResultString(name, seq, result) {
|
|
106
|
+
function deliverResult(_name, _seq, _result) {
|
|
107
|
+
window[_name].callbacks.get(_seq).resolve(_result);
|
|
108
|
+
window[_name].callbacks.delete(_seq);
|
|
109
|
+
}
|
|
110
|
+
return evaluationString(deliverResult, name, seq, result);
|
|
111
|
+
}
|
|
112
|
+
exports.pageBindingDeliverResultString = pageBindingDeliverResultString;
|
|
113
|
+
function pageBindingDeliverErrorString(name, seq, message, stack) {
|
|
114
|
+
function deliverError(_name, _seq, _message, _stack) {
|
|
115
|
+
const error = new Error(_message);
|
|
116
|
+
error.stack = _stack;
|
|
117
|
+
window[_name].callbacks.get(_seq).reject(error);
|
|
118
|
+
window[_name].callbacks.delete(_seq);
|
|
119
|
+
}
|
|
120
|
+
return evaluationString(deliverError, name, seq, message, stack);
|
|
121
|
+
}
|
|
122
|
+
exports.pageBindingDeliverErrorString = pageBindingDeliverErrorString;
|
|
123
|
+
function pageBindingDeliverErrorValueString(name, seq, value) {
|
|
124
|
+
function deliverErrorValue(_name, _seq, _value) {
|
|
125
|
+
window[_name].callbacks.get(_seq).reject(_value);
|
|
126
|
+
window[_name].callbacks.delete(_seq);
|
|
127
|
+
}
|
|
128
|
+
return evaluationString(deliverErrorValue, name, seq, value);
|
|
129
|
+
}
|
|
130
|
+
exports.pageBindingDeliverErrorValueString = pageBindingDeliverErrorValueString;
|
|
131
|
+
async function waitWithTimeout(promise, taskName, timeout) {
|
|
132
|
+
let reject;
|
|
133
|
+
const timeoutError = new Errors_1.TimeoutError(`waiting for ${taskName} failed: timeout ${timeout}ms exceeded`);
|
|
134
|
+
const timeoutPromise = new Promise((_res, rej) => {
|
|
135
|
+
reject = rej;
|
|
136
|
+
});
|
|
137
|
+
let timeoutTimer = null;
|
|
138
|
+
if (timeout) {
|
|
139
|
+
timeoutTimer = setTimeout(() => {
|
|
140
|
+
return reject(timeoutError);
|
|
141
|
+
}, timeout);
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
return await Promise.race([promise, timeoutPromise]);
|
|
145
|
+
}
|
|
146
|
+
finally {
|
|
147
|
+
if (timeoutTimer) {
|
|
148
|
+
clearTimeout(timeoutTimer);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
exports.waitWithTimeout = waitWithTimeout;
|
|
153
|
+
function isErrorLike(obj) {
|
|
154
|
+
return (typeof obj === 'object' && obj !== null && 'name' in obj && 'message' in obj);
|
|
155
|
+
}
|
|
156
|
+
exports.isErrorLike = isErrorLike;
|
|
157
|
+
function isErrnoException(obj) {
|
|
158
|
+
return (isErrorLike(obj) &&
|
|
159
|
+
('errno' in obj || 'code' in obj || 'path' in obj || 'syscall' in obj));
|
|
160
|
+
}
|
|
161
|
+
exports.isErrnoException = isErrnoException;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { FfmpegExecutable } from 'remotion';
|
|
3
|
-
import { Readable } from 'stream';
|
|
4
2
|
import { LastFrameOptions } from './last-frame-from-video-cache';
|
|
5
|
-
export declare function streamToString(stream: Readable): Promise<string>;
|
|
6
3
|
export declare const getLastFrameOfVideo: (options: LastFrameOptions) => Promise<Buffer>;
|
|
7
4
|
declare type Options = {
|
|
8
5
|
time: number;
|
|
@@ -10,6 +7,5 @@ declare type Options = {
|
|
|
10
7
|
ffmpegExecutable: FfmpegExecutable;
|
|
11
8
|
ffprobeExecutable: FfmpegExecutable;
|
|
12
9
|
};
|
|
13
|
-
export declare const extractFrameFromVideoFn: ({ time, src, ffmpegExecutable, ffprobeExecutable, }: Options) => Promise<Buffer>;
|
|
14
10
|
export declare const extractFrameFromVideo: (options: Options) => Promise<Buffer>;
|
|
15
11
|
export {};
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.extractFrameFromVideo = exports.
|
|
6
|
+
exports.extractFrameFromVideo = exports.getLastFrameOfVideo = void 0;
|
|
7
7
|
const execa_1 = __importDefault(require("execa"));
|
|
8
8
|
const remotion_1 = require("remotion");
|
|
9
9
|
const get_audio_channels_1 = require("./assets/get-audio-channels");
|
|
@@ -12,15 +12,6 @@ const frame_to_ffmpeg_timestamp_1 = require("./frame-to-ffmpeg-timestamp");
|
|
|
12
12
|
const is_beyond_last_frame_1 = require("./is-beyond-last-frame");
|
|
13
13
|
const last_frame_from_video_cache_1 = require("./last-frame-from-video-cache");
|
|
14
14
|
const p_limit_1 = require("./p-limit");
|
|
15
|
-
function streamToString(stream) {
|
|
16
|
-
const chunks = [];
|
|
17
|
-
return new Promise((resolve, reject) => {
|
|
18
|
-
stream.on('data', (chunk) => chunks.push(Buffer.from(chunk)));
|
|
19
|
-
stream.on('error', (err) => reject(err));
|
|
20
|
-
stream.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
exports.streamToString = streamToString;
|
|
24
15
|
const lastFrameLimit = (0, p_limit_1.pLimit)(1);
|
|
25
16
|
const mainLimit = (0, p_limit_1.pLimit)(5);
|
|
26
17
|
// Uses no seeking, therefore the whole video has to be decoded. This is a last resort and should only happen
|
|
@@ -197,10 +188,9 @@ const extractFrameFromVideoFn = async ({ time, src, ffmpegExecutable, ffprobeExe
|
|
|
197
188
|
}
|
|
198
189
|
return stdOut;
|
|
199
190
|
};
|
|
200
|
-
exports.extractFrameFromVideoFn = extractFrameFromVideoFn;
|
|
201
191
|
const extractFrameFromVideo = async (options) => {
|
|
202
192
|
const perf = remotion_1.Internals.perf.startPerfMeasure('extract-frame');
|
|
203
|
-
const res = await mainLimit(
|
|
193
|
+
const res = await mainLimit(extractFrameFromVideoFn, options);
|
|
204
194
|
remotion_1.Internals.perf.stopPerfMeasure(perf);
|
|
205
195
|
return res;
|
|
206
196
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { FfmpegExecutable } from 'remotion';
|
|
3
2
|
export declare type LastFrameOptions = {
|
|
4
3
|
ffmpegExecutable: FfmpegExecutable;
|
|
@@ -8,6 +7,4 @@ export declare type LastFrameOptions = {
|
|
|
8
7
|
};
|
|
9
8
|
export declare const setLastFrameInCache: (options: LastFrameOptions, data: Buffer) => void;
|
|
10
9
|
export declare const getLastFrameFromCache: (options: LastFrameOptions) => Buffer | null;
|
|
11
|
-
export declare const removedLastFrameFromCache: (key: string) => void;
|
|
12
|
-
export declare const ensureMaxSize: () => void;
|
|
13
10
|
export declare const clearLastFileCache: () => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// OffthreadVideo requires sometimes that the last frame of a video gets extracted, however, this can be slow. We allocate a cache for it but that can be garbage collected
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearLastFileCache = exports.
|
|
4
|
+
exports.clearLastFileCache = exports.getLastFrameFromCache = exports.setLastFrameInCache = void 0;
|
|
5
5
|
let map = {};
|
|
6
6
|
const MAX_CACHE_SIZE = 50 * 1024 * 1024; // 50MB
|
|
7
7
|
let bufferSize = 0;
|
|
@@ -15,7 +15,7 @@ const setLastFrameInCache = (options, data) => {
|
|
|
15
15
|
}
|
|
16
16
|
map[key] = { data, lastAccessed: Date.now() };
|
|
17
17
|
bufferSize += data.byteLength;
|
|
18
|
-
|
|
18
|
+
ensureMaxSize();
|
|
19
19
|
};
|
|
20
20
|
exports.setLastFrameInCache = setLastFrameInCache;
|
|
21
21
|
const getLastFrameFromCache = (options) => {
|
|
@@ -35,17 +35,15 @@ const removedLastFrameFromCache = (key) => {
|
|
|
35
35
|
bufferSize -= map[key].data.byteLength;
|
|
36
36
|
delete map[key];
|
|
37
37
|
};
|
|
38
|
-
exports.removedLastFrameFromCache = removedLastFrameFromCache;
|
|
39
38
|
const ensureMaxSize = () => {
|
|
40
39
|
// eslint-disable-next-line no-unmodified-loop-condition
|
|
41
40
|
while (bufferSize > MAX_CACHE_SIZE) {
|
|
42
41
|
const earliest = Object.entries(map).sort((a, b) => {
|
|
43
42
|
return a[1].lastAccessed - b[1].lastAccessed;
|
|
44
43
|
})[0];
|
|
45
|
-
|
|
44
|
+
removedLastFrameFromCache(earliest[0]);
|
|
46
45
|
}
|
|
47
46
|
};
|
|
48
|
-
exports.ensureMaxSize = ensureMaxSize;
|
|
49
47
|
const clearLastFileCache = () => {
|
|
50
48
|
map = {};
|
|
51
49
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.21",
|
|
4
4
|
"description": "Renderer for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"execa": "5.1.1",
|
|
24
24
|
"mime-types": "2.1.35",
|
|
25
25
|
"puppeteer-core": "13.5.1",
|
|
26
|
-
"remotion": "3.0.
|
|
26
|
+
"remotion": "3.0.21",
|
|
27
27
|
"source-map": "^0.8.0-beta.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "1a31b6d28d7b1cf84d6c84f6ea2d3e1eb1e65bda"
|
|
63
63
|
}
|