@remotion/renderer 3.2.44 → 3.3.0
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/download-and-map-assets-to-file.js +7 -7
- package/dist/assets/get-audio-channels.d.ts +1 -1
- package/dist/assets/get-audio-channels.js +5 -4
- package/dist/assets/get-video-stream-duration.d.ts +1 -1
- package/dist/assets/get-video-stream-duration.js +5 -4
- package/dist/browser/Browser.d.ts +4 -2
- package/dist/browser/Browser.js +16 -12
- package/dist/browser/BrowserFetcher.d.ts +1 -0
- package/dist/browser/BrowserFetcher.js +11 -10
- package/dist/browser/BrowserPage.d.ts +8 -2
- package/dist/browser/BrowserPage.js +7 -10
- package/dist/browser/Connection.js +1 -1
- package/dist/browser/DOMWorld.d.ts +2 -1
- package/dist/browser/DOMWorld.js +8 -1
- package/dist/browser/FrameManager.d.ts +0 -2
- package/dist/browser/FrameManager.js +0 -3
- package/dist/browser/Launcher.d.ts +7 -1
- package/dist/browser/Launcher.js +3 -5
- package/dist/browser/NodeWebSocketTransport.js +1 -1
- package/dist/browser/PuppeteerNode.js +2 -6
- package/dist/combine-videos.d.ts +7 -2
- package/dist/combine-videos.js +4 -2
- package/dist/convert-to-pcm.d.ts +2 -1
- package/dist/convert-to-pcm.js +3 -2
- package/dist/create-silent-audio.d.ts +2 -1
- package/dist/create-silent-audio.js +3 -2
- package/dist/cycle-browser-tabs.d.ts +2 -5
- package/dist/cycle-browser-tabs.js +5 -5
- package/dist/ensure-ffmpeg.d.ts +10 -0
- package/dist/ensure-ffmpeg.js +50 -0
- package/dist/ensure-presentation-timestamp.d.ts +8 -1
- package/dist/ensure-presentation-timestamp.js +14 -5
- package/dist/extract-frame-from-video.d.ts +1 -1
- package/dist/extract-frame-from-video.js +22 -9
- package/dist/ffmpeg-flags.d.ts +16 -1
- package/dist/ffmpeg-flags.js +168 -7
- package/dist/get-browser-instance.js +1 -1
- package/dist/get-compositions.js +10 -6
- package/dist/get-extension-from-codec.d.ts +1 -1
- package/dist/get-video-info.d.ts +1 -1
- package/dist/get-video-info.js +5 -4
- package/dist/guess-extension-for-media.d.ts +5 -1
- package/dist/guess-extension-for-media.js +3 -2
- package/dist/index.d.ts +10 -4
- package/dist/index.js +7 -1
- package/dist/last-frame-from-video-cache.d.ts +1 -1
- package/dist/merge-audio-track.d.ts +1 -0
- package/dist/merge-audio-track.js +7 -2
- package/dist/offthread-video-server.d.ts +2 -1
- package/dist/offthread-video-server.js +2 -1
- package/dist/open-browser.js +1 -1
- package/dist/prepare-server.d.ts +2 -1
- package/dist/prepare-server.js +3 -1
- package/dist/preprocess-audio-track.d.ts +1 -0
- package/dist/preprocess-audio-track.js +4 -3
- package/dist/prespawn-ffmpeg.d.ts +1 -1
- package/dist/prespawn-ffmpeg.js +4 -3
- package/dist/provide-screenshot.d.ts +0 -1
- package/dist/puppeteer-screenshot.d.ts +0 -1
- package/dist/puppeteer-screenshot.js +1 -1
- package/dist/render-frames.js +43 -28
- package/dist/render-media.js +4 -2
- package/dist/render-still.js +3 -1
- package/dist/replace-browser.d.ts +1 -1
- package/dist/replace-browser.js +3 -2
- package/dist/screenshot-dom-element.d.ts +0 -1
- package/dist/screenshot-task.d.ts +1 -2
- package/dist/screenshot-task.js +3 -3
- package/dist/seek-to-frame.d.ts +1 -0
- package/dist/seek-to-frame.js +24 -3
- package/dist/serve-static.d.ts +1 -0
- package/dist/serve-static.js +1 -0
- package/dist/stitch-frames-to-video.d.ts +7 -0
- package/dist/stitch-frames-to-video.js +27 -20
- package/dist/validate-ffmpeg.d.ts +4 -2
- package/dist/validate-ffmpeg.js +35 -46
- package/package.json +3 -3
|
@@ -141,13 +141,6 @@ const downloadAsset = async ({ src, onDownload, downloadMap, }) => {
|
|
|
141
141
|
downloadMap.isDownloadingMap[src][downloadDir] = true;
|
|
142
142
|
const onProgress = onDownload(src);
|
|
143
143
|
if (src.startsWith('data:')) {
|
|
144
|
-
const output = (0, exports.getSanitizedFilenameForAssetUrl)({
|
|
145
|
-
contentDisposition: null,
|
|
146
|
-
downloadDir,
|
|
147
|
-
src,
|
|
148
|
-
contentType: null,
|
|
149
|
-
});
|
|
150
|
-
(0, ensure_output_directory_1.ensureOutputDirectory)(output);
|
|
151
144
|
const [assetDetails, assetData] = src.substring('data:'.length).split(',');
|
|
152
145
|
if (!assetDetails.includes(';')) {
|
|
153
146
|
const errMessage = [
|
|
@@ -161,6 +154,13 @@ const downloadAsset = async ({ src, onDownload, downloadMap, }) => {
|
|
|
161
154
|
const [mimeType, encoding] = assetDetails.split(';');
|
|
162
155
|
validateMimeType(mimeType, src);
|
|
163
156
|
validateBufferEncoding(encoding, src);
|
|
157
|
+
const output = (0, exports.getSanitizedFilenameForAssetUrl)({
|
|
158
|
+
contentDisposition: null,
|
|
159
|
+
downloadDir,
|
|
160
|
+
src,
|
|
161
|
+
contentType: mimeType,
|
|
162
|
+
});
|
|
163
|
+
(0, ensure_output_directory_1.ensureOutputDirectory)(output);
|
|
164
164
|
const buff = Buffer.from(assetData, encoding);
|
|
165
165
|
await fs_1.default.promises.writeFile(output, buff);
|
|
166
166
|
notifyAssetIsDownloaded({ src, downloadMap, downloadDir, to: output });
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { FfmpegExecutable } from '../ffmpeg-executable';
|
|
2
2
|
import type { AudioChannelsAndDurationResultCache, DownloadMap } from './download-map';
|
|
3
|
-
export declare const getAudioChannelsAndDuration: (downloadMap: DownloadMap, src: string, ffprobeExecutable: FfmpegExecutable) => Promise<AudioChannelsAndDurationResultCache>;
|
|
3
|
+
export declare const getAudioChannelsAndDuration: (downloadMap: DownloadMap, src: string, ffprobeExecutable: FfmpegExecutable, remotionRoot: string) => Promise<AudioChannelsAndDurationResultCache>;
|
|
@@ -5,9 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getAudioChannelsAndDuration = void 0;
|
|
7
7
|
const execa_1 = __importDefault(require("execa"));
|
|
8
|
+
const ffmpeg_flags_1 = require("../ffmpeg-flags");
|
|
8
9
|
const p_limit_1 = require("../p-limit");
|
|
9
10
|
const limit = (0, p_limit_1.pLimit)(1);
|
|
10
|
-
async function getAudioChannelsAndDurationUnlimited(downloadMap, src, ffprobeExecutable) {
|
|
11
|
+
async function getAudioChannelsAndDurationUnlimited(downloadMap, src, ffprobeExecutable, remotionRoot) {
|
|
11
12
|
if (downloadMap.durationOfAssetCache[src]) {
|
|
12
13
|
return downloadMap.durationOfAssetCache[src];
|
|
13
14
|
}
|
|
@@ -19,7 +20,7 @@ async function getAudioChannelsAndDurationUnlimited(downloadMap, src, ffprobeExe
|
|
|
19
20
|
]
|
|
20
21
|
.reduce((acc, val) => acc.concat(val), [])
|
|
21
22
|
.filter(Boolean);
|
|
22
|
-
const task = await (0, execa_1.default)(
|
|
23
|
+
const task = await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffprobeExecutable, remotionRoot, 'ffprobe'), args);
|
|
23
24
|
const channels = task.stdout.match(/channels=([0-9]+)/);
|
|
24
25
|
const duration = task.stdout.match(/duration=([0-9.]+)/);
|
|
25
26
|
const result = {
|
|
@@ -29,7 +30,7 @@ async function getAudioChannelsAndDurationUnlimited(downloadMap, src, ffprobeExe
|
|
|
29
30
|
downloadMap.durationOfAssetCache[src] = result;
|
|
30
31
|
return result;
|
|
31
32
|
}
|
|
32
|
-
const getAudioChannelsAndDuration = (downloadMap, src, ffprobeExecutable) => {
|
|
33
|
-
return limit(() => getAudioChannelsAndDurationUnlimited(downloadMap, src, ffprobeExecutable));
|
|
33
|
+
const getAudioChannelsAndDuration = (downloadMap, src, ffprobeExecutable, remotionRoot) => {
|
|
34
|
+
return limit(() => getAudioChannelsAndDurationUnlimited(downloadMap, src, ffprobeExecutable, remotionRoot));
|
|
34
35
|
};
|
|
35
36
|
exports.getAudioChannelsAndDuration = getAudioChannelsAndDuration;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { FfmpegExecutable } from '../ffmpeg-executable';
|
|
2
2
|
import type { DownloadMap, VideoDurationResult } from './download-map';
|
|
3
3
|
export declare const parseVideoStreamDuration: (stdout: string) => VideoDurationResult;
|
|
4
|
-
export declare const getVideoStreamDuration: (downloadMap: DownloadMap, src: string, ffprobeExecutable: FfmpegExecutable) => Promise<VideoDurationResult>;
|
|
4
|
+
export declare const getVideoStreamDuration: (downloadMap: DownloadMap, src: string, ffprobeExecutable: FfmpegExecutable, remotionRoot: string) => Promise<VideoDurationResult>;
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getVideoStreamDuration = exports.parseVideoStreamDuration = void 0;
|
|
7
7
|
const execa_1 = __importDefault(require("execa"));
|
|
8
|
+
const ffmpeg_flags_1 = require("../ffmpeg-flags");
|
|
8
9
|
const p_limit_1 = require("../p-limit");
|
|
9
10
|
const limit = (0, p_limit_1.pLimit)(1);
|
|
10
11
|
const parseAlternativeDuration = (stdout) => {
|
|
@@ -38,7 +39,7 @@ const parseVideoStreamDuration = (stdout) => {
|
|
|
38
39
|
return result;
|
|
39
40
|
};
|
|
40
41
|
exports.parseVideoStreamDuration = parseVideoStreamDuration;
|
|
41
|
-
async function getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable) {
|
|
42
|
+
async function getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable, remotionRoot) {
|
|
42
43
|
if (downloadMap.videoDurationResultCache[src]) {
|
|
43
44
|
return downloadMap.videoDurationResultCache[src];
|
|
44
45
|
}
|
|
@@ -50,10 +51,10 @@ async function getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutab
|
|
|
50
51
|
]
|
|
51
52
|
.reduce((acc, val) => acc.concat(val), [])
|
|
52
53
|
.filter(Boolean);
|
|
53
|
-
const task = await (0, execa_1.default)(
|
|
54
|
+
const task = await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffprobeExecutable, remotionRoot, 'ffprobe'), args);
|
|
54
55
|
return (0, exports.parseVideoStreamDuration)(task.stdout);
|
|
55
56
|
}
|
|
56
|
-
const getVideoStreamDuration = (downloadMap, src, ffprobeExecutable) => {
|
|
57
|
-
return limit(() => getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable));
|
|
57
|
+
const getVideoStreamDuration = (downloadMap, src, ffprobeExecutable, remotionRoot) => {
|
|
58
|
+
return limit(() => getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable, remotionRoot));
|
|
58
59
|
};
|
|
59
60
|
exports.getVideoStreamDuration = getVideoStreamDuration;
|
|
@@ -25,7 +25,8 @@ interface WaitForTargetOptions {
|
|
|
25
25
|
export declare const enum BrowserEmittedEvents {
|
|
26
26
|
TargetChanged = "targetchanged",
|
|
27
27
|
TargetCreated = "targetcreated",
|
|
28
|
-
Closed = "closed"
|
|
28
|
+
Closed = "closed",
|
|
29
|
+
ClosedSilent = "closed-silent"
|
|
29
30
|
}
|
|
30
31
|
export declare class Browser extends EventEmitter {
|
|
31
32
|
#private;
|
|
@@ -35,6 +36,7 @@ export declare class Browser extends EventEmitter {
|
|
|
35
36
|
defaultViewport: Viewport;
|
|
36
37
|
closeCallback?: BrowserCloseCallback;
|
|
37
38
|
}): Promise<Browser>;
|
|
39
|
+
connection: Connection;
|
|
38
40
|
get _targets(): Map<string, Target>;
|
|
39
41
|
constructor(connection: Connection, contextIds: string[], defaultViewport: Viewport, closeCallback?: BrowserCloseCallback);
|
|
40
42
|
browserContexts(): BrowserContext[];
|
|
@@ -43,7 +45,7 @@ export declare class Browser extends EventEmitter {
|
|
|
43
45
|
targets(): Target[];
|
|
44
46
|
waitForTarget(predicate: (x: Target) => boolean | Promise<boolean>, options?: WaitForTargetOptions): Promise<Target>;
|
|
45
47
|
pages(): Promise<Page[]>;
|
|
46
|
-
close(): Promise<void>;
|
|
48
|
+
close(silent: boolean): Promise<void>;
|
|
47
49
|
disconnect(): void;
|
|
48
50
|
}
|
|
49
51
|
export declare class BrowserContext extends EventEmitter {
|
package/dist/browser/Browser.js
CHANGED
|
@@ -25,7 +25,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
25
25
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
26
26
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
27
27
|
};
|
|
28
|
-
var _Browser_instances, _Browser_defaultViewport,
|
|
28
|
+
var _Browser_instances, _Browser_defaultViewport, _Browser_closeCallback, _Browser_defaultContext, _Browser_contexts, _Browser_targets, _Browser_targetCreated, _Browser_targetDestroyed, _Browser_targetInfoChanged, _BrowserContext_browser, _BrowserContext_id;
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.BrowserContext = exports.Browser = void 0;
|
|
31
31
|
const assert_1 = require("./assert");
|
|
@@ -38,13 +38,12 @@ class Browser extends EventEmitter_1.EventEmitter {
|
|
|
38
38
|
super();
|
|
39
39
|
_Browser_instances.add(this);
|
|
40
40
|
_Browser_defaultViewport.set(this, void 0);
|
|
41
|
-
_Browser_connection.set(this, void 0);
|
|
42
41
|
_Browser_closeCallback.set(this, void 0);
|
|
43
42
|
_Browser_defaultContext.set(this, void 0);
|
|
44
43
|
_Browser_contexts.set(this, void 0);
|
|
45
44
|
_Browser_targets.set(this, void 0);
|
|
46
45
|
__classPrivateFieldSet(this, _Browser_defaultViewport, defaultViewport, "f");
|
|
47
|
-
|
|
46
|
+
this.connection = connection;
|
|
48
47
|
__classPrivateFieldSet(this, _Browser_closeCallback, closeCallback ||
|
|
49
48
|
function () {
|
|
50
49
|
return undefined;
|
|
@@ -55,9 +54,9 @@ class Browser extends EventEmitter_1.EventEmitter {
|
|
|
55
54
|
__classPrivateFieldGet(this, _Browser_contexts, "f").set(contextId, new BrowserContext(this, contextId));
|
|
56
55
|
}
|
|
57
56
|
__classPrivateFieldSet(this, _Browser_targets, new Map(), "f");
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
this.connection.on('Target.targetCreated', __classPrivateFieldGet(this, _Browser_instances, "m", _Browser_targetCreated).bind(this));
|
|
58
|
+
this.connection.on('Target.targetDestroyed', __classPrivateFieldGet(this, _Browser_instances, "m", _Browser_targetDestroyed).bind(this));
|
|
59
|
+
this.connection.on('Target.targetInfoChanged', __classPrivateFieldGet(this, _Browser_instances, "m", _Browser_targetInfoChanged).bind(this));
|
|
61
60
|
}
|
|
62
61
|
static async _create({ connection, contextIds, defaultViewport, closeCallback, }) {
|
|
63
62
|
const browser = new Browser(connection, contextIds, defaultViewport, closeCallback);
|
|
@@ -74,7 +73,7 @@ class Browser extends EventEmitter_1.EventEmitter {
|
|
|
74
73
|
return __classPrivateFieldGet(this, _Browser_defaultContext, "f").newPage();
|
|
75
74
|
}
|
|
76
75
|
async _createPageInContext(contextId) {
|
|
77
|
-
const { targetId } = await
|
|
76
|
+
const { targetId } = await this.connection.send('Target.createTarget', {
|
|
78
77
|
url: 'about:blank',
|
|
79
78
|
browserContextId: contextId || undefined,
|
|
80
79
|
});
|
|
@@ -133,17 +132,22 @@ class Browser extends EventEmitter_1.EventEmitter {
|
|
|
133
132
|
return acc.concat(x);
|
|
134
133
|
}, []);
|
|
135
134
|
}
|
|
136
|
-
async close() {
|
|
135
|
+
async close(silent) {
|
|
137
136
|
await __classPrivateFieldGet(this, _Browser_closeCallback, "f").call(null);
|
|
137
|
+
(await this.pages()).forEach((page) => {
|
|
138
|
+
console.log('disposing', page.id);
|
|
139
|
+
page.emit("disposed" /* PageEmittedEvents.Disposed */);
|
|
140
|
+
page.closed = true;
|
|
141
|
+
});
|
|
138
142
|
this.disconnect();
|
|
139
|
-
this.emit("closed" /* BrowserEmittedEvents.Closed */);
|
|
143
|
+
this.emit(silent ? "closed-silent" /* BrowserEmittedEvents.ClosedSilent */ : "closed" /* BrowserEmittedEvents.Closed */);
|
|
140
144
|
}
|
|
141
145
|
disconnect() {
|
|
142
|
-
|
|
146
|
+
this.connection.dispose();
|
|
143
147
|
}
|
|
144
148
|
}
|
|
145
149
|
exports.Browser = Browser;
|
|
146
|
-
_Browser_defaultViewport = new WeakMap(),
|
|
150
|
+
_Browser_defaultViewport = new WeakMap(), _Browser_closeCallback = new WeakMap(), _Browser_defaultContext = new WeakMap(), _Browser_contexts = new WeakMap(), _Browser_targets = new WeakMap(), _Browser_instances = new WeakSet(), _Browser_targetCreated = async function _Browser_targetCreated(event) {
|
|
147
151
|
var _a;
|
|
148
152
|
const { targetInfo } = event;
|
|
149
153
|
const { browserContextId } = targetInfo;
|
|
@@ -154,7 +158,7 @@ _Browser_defaultViewport = new WeakMap(), _Browser_connection = new WeakMap(), _
|
|
|
154
158
|
throw new Error('Missing browser context');
|
|
155
159
|
}
|
|
156
160
|
const target = new Target_1.Target(targetInfo, context, () => {
|
|
157
|
-
return
|
|
161
|
+
return this.connection.createSession(targetInfo);
|
|
158
162
|
}, (_a = __classPrivateFieldGet(this, _Browser_defaultViewport, "f")) !== null && _a !== void 0 ? _a : null);
|
|
159
163
|
(0, assert_1.assert)(!__classPrivateFieldGet(this, _Browser_targets, "f").has(event.targetInfo.targetId), 'Target should not exist before targetCreated');
|
|
160
164
|
__classPrivateFieldGet(this, _Browser_targets, "f").set(event.targetInfo.targetId, target);
|
|
@@ -86,4 +86,5 @@ export declare class BrowserFetcher {
|
|
|
86
86
|
*/
|
|
87
87
|
revisionInfo(revision: string): BrowserFetcherRevisionInfo;
|
|
88
88
|
}
|
|
89
|
+
export declare function _downloadFile(url: string, destinationPath: string, progressCallback: (x: number, y: number) => void): Promise<number>;
|
|
89
90
|
export {};
|
|
@@ -53,7 +53,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
53
53
|
};
|
|
54
54
|
var _BrowserFetcher_instances, _BrowserFetcher_product, _BrowserFetcher_downloadsFolder, _BrowserFetcher_downloadHost, _BrowserFetcher_platform, _BrowserFetcher_getFolderPath;
|
|
55
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
56
|
-
exports.BrowserFetcher = void 0;
|
|
56
|
+
exports._downloadFile = exports.BrowserFetcher = void 0;
|
|
57
57
|
const childProcess = __importStar(require("child_process"));
|
|
58
58
|
const fs = __importStar(require("fs"));
|
|
59
59
|
const http = __importStar(require("http"));
|
|
@@ -388,6 +388,13 @@ function _downloadFile(url, destinationPath, progressCallback) {
|
|
|
388
388
|
let downloadedBytes = 0;
|
|
389
389
|
let totalBytes = 0;
|
|
390
390
|
let lastProgress = Date.now();
|
|
391
|
+
function onData(chunk) {
|
|
392
|
+
downloadedBytes += chunk.length;
|
|
393
|
+
if (Date.now() - lastProgress > 1000) {
|
|
394
|
+
progressCallback(downloadedBytes, totalBytes);
|
|
395
|
+
lastProgress = Date.now();
|
|
396
|
+
}
|
|
397
|
+
}
|
|
391
398
|
const request = httpRequest(url, 'GET', (response) => {
|
|
392
399
|
if (response.statusCode !== 200) {
|
|
393
400
|
const error = new Error(`Download failed: server returned code ${response.statusCode}. URL: ${url}`);
|
|
@@ -397,8 +404,8 @@ function _downloadFile(url, destinationPath, progressCallback) {
|
|
|
397
404
|
return;
|
|
398
405
|
}
|
|
399
406
|
const file = fs.createWriteStream(destinationPath);
|
|
400
|
-
file.on('
|
|
401
|
-
return fulfill();
|
|
407
|
+
file.on('close', () => {
|
|
408
|
+
return fulfill(totalBytes);
|
|
402
409
|
});
|
|
403
410
|
file.on('error', (error) => {
|
|
404
411
|
return reject(error);
|
|
@@ -411,14 +418,8 @@ function _downloadFile(url, destinationPath, progressCallback) {
|
|
|
411
418
|
return reject(error);
|
|
412
419
|
});
|
|
413
420
|
return promise;
|
|
414
|
-
function onData(chunk) {
|
|
415
|
-
downloadedBytes += chunk.length;
|
|
416
|
-
if (Date.now() - lastProgress > 1000) {
|
|
417
|
-
progressCallback(downloadedBytes, totalBytes);
|
|
418
|
-
lastProgress = Date.now();
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
421
|
}
|
|
422
|
+
exports._downloadFile = _downloadFile;
|
|
422
423
|
function install(archivePath, folderPath) {
|
|
423
424
|
if (archivePath.endsWith('.zip')) {
|
|
424
425
|
return (0, extract_zip_1.default)(archivePath, { dir: folderPath });
|
|
@@ -27,13 +27,21 @@ import { TaskQueue } from './TaskQueue';
|
|
|
27
27
|
interface WaitForOptions {
|
|
28
28
|
timeout?: number;
|
|
29
29
|
}
|
|
30
|
+
export declare const enum PageEmittedEvents {
|
|
31
|
+
Console = "console",
|
|
32
|
+
Error = "error",
|
|
33
|
+
Disposed = "disposed"
|
|
34
|
+
}
|
|
30
35
|
interface PageEventObject {
|
|
31
36
|
console: ConsoleMessage;
|
|
32
37
|
error: Error;
|
|
38
|
+
disposed: undefined;
|
|
33
39
|
}
|
|
34
40
|
export declare class Page extends EventEmitter {
|
|
35
41
|
#private;
|
|
42
|
+
id: string;
|
|
36
43
|
static _create(client: CDPSession, target: Target, defaultViewport: Viewport, browser: Browser): Promise<Page>;
|
|
44
|
+
closed: boolean;
|
|
37
45
|
browser: Browser;
|
|
38
46
|
screenshotTaskQueue: TaskQueue;
|
|
39
47
|
constructor(client: CDPSession, target: Target, browser: Browser);
|
|
@@ -68,7 +76,5 @@ export declare class Page extends EventEmitter {
|
|
|
68
76
|
close(options?: {
|
|
69
77
|
runBeforeUnload?: boolean;
|
|
70
78
|
}): Promise<void>;
|
|
71
|
-
isClosed(): boolean;
|
|
72
|
-
waitForFunction(browser: Browser, pageFunction: Function | string, ...args: SerializableOrJSHandle[]): Promise<JSHandle>;
|
|
73
79
|
}
|
|
74
80
|
export {};
|
|
@@ -25,7 +25,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
25
25
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
26
26
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
27
27
|
};
|
|
28
|
-
var _Page_instances,
|
|
28
|
+
var _Page_instances, _Page_client, _Page_target, _Page_timeoutSettings, _Page_frameManager, _Page_pageBindings, _Page_initialize, _Page_onTargetCrashed, _Page_onLogEntryAdded, _Page_onConsoleAPI, _Page_onBindingCalled, _Page_addConsoleMessage;
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.Page = void 0;
|
|
31
31
|
const assert_1 = require("./assert");
|
|
@@ -40,7 +40,7 @@ class Page extends EventEmitter_1.EventEmitter {
|
|
|
40
40
|
constructor(client, target, browser) {
|
|
41
41
|
super();
|
|
42
42
|
_Page_instances.add(this);
|
|
43
|
-
|
|
43
|
+
this.closed = false;
|
|
44
44
|
_Page_client.set(this, void 0);
|
|
45
45
|
_Page_target.set(this, void 0);
|
|
46
46
|
_Page_timeoutSettings.set(this, new TimeoutSettings_1.TimeoutSettings());
|
|
@@ -51,6 +51,7 @@ class Page extends EventEmitter_1.EventEmitter {
|
|
|
51
51
|
__classPrivateFieldSet(this, _Page_frameManager, new FrameManager_1.FrameManager(client, this, __classPrivateFieldGet(this, _Page_timeoutSettings, "f")), "f");
|
|
52
52
|
this.screenshotTaskQueue = new TaskQueue_1.TaskQueue();
|
|
53
53
|
this.browser = browser;
|
|
54
|
+
this.id = String(Math.random());
|
|
54
55
|
client.on('Target.attachedToTarget', (event) => {
|
|
55
56
|
switch (event.targetInfo.type) {
|
|
56
57
|
case 'iframe':
|
|
@@ -166,7 +167,9 @@ class Page extends EventEmitter_1.EventEmitter {
|
|
|
166
167
|
}
|
|
167
168
|
async close(options = { runBeforeUnload: undefined }) {
|
|
168
169
|
const connection = __classPrivateFieldGet(this, _Page_client, "f").connection();
|
|
169
|
-
|
|
170
|
+
if (!connection) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
170
173
|
const runBeforeUnload = Boolean(options.runBeforeUnload);
|
|
171
174
|
if (runBeforeUnload) {
|
|
172
175
|
await __classPrivateFieldGet(this, _Page_client, "f").send('Page.close');
|
|
@@ -178,15 +181,9 @@ class Page extends EventEmitter_1.EventEmitter {
|
|
|
178
181
|
await __classPrivateFieldGet(this, _Page_target, "f")._isClosedPromise;
|
|
179
182
|
}
|
|
180
183
|
}
|
|
181
|
-
isClosed() {
|
|
182
|
-
return __classPrivateFieldGet(this, _Page_closed, "f");
|
|
183
|
-
}
|
|
184
|
-
waitForFunction(browser, pageFunction, ...args) {
|
|
185
|
-
return this.mainFrame().waitForFunction(browser, pageFunction, ...args);
|
|
186
|
-
}
|
|
187
184
|
}
|
|
188
185
|
exports.Page = Page;
|
|
189
|
-
|
|
186
|
+
_Page_client = new WeakMap(), _Page_target = new WeakMap(), _Page_timeoutSettings = new WeakMap(), _Page_frameManager = new WeakMap(), _Page_pageBindings = new WeakMap(), _Page_instances = new WeakSet(), _Page_initialize = async function _Page_initialize() {
|
|
190
187
|
await Promise.all([
|
|
191
188
|
__classPrivateFieldGet(this, _Page_frameManager, "f").initialize(),
|
|
192
189
|
__classPrivateFieldGet(this, _Page_client, "f").send('Target.setAutoAttach', {
|
|
@@ -215,11 +215,11 @@ class CDPSession extends EventEmitter_1.EventEmitter {
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
_onClosed() {
|
|
218
|
+
__classPrivateFieldSet(this, _CDPSession_connection, undefined, "f");
|
|
218
219
|
for (const callback of __classPrivateFieldGet(this, _CDPSession_callbacks, "f").values()) {
|
|
219
220
|
callback.reject(rewriteError(callback.error, `Protocol error (${callback.method}): Target closed. https://www.remotion.dev/docs/target-closed`));
|
|
220
221
|
}
|
|
221
222
|
__classPrivateFieldGet(this, _CDPSession_callbacks, "f").clear();
|
|
222
|
-
__classPrivateFieldSet(this, _CDPSession_connection, undefined, "f");
|
|
223
223
|
this.emit(exports.CDPSessionEmittedEvents.Disconnected);
|
|
224
224
|
}
|
|
225
225
|
id() {
|
|
@@ -46,7 +46,8 @@ declare class WaitTask {
|
|
|
46
46
|
promise: Promise<JSHandle>;
|
|
47
47
|
constructor(options: WaitTaskOptions);
|
|
48
48
|
onBrowserClose: () => void;
|
|
49
|
-
|
|
49
|
+
onBrowserCloseSilent: () => void;
|
|
50
|
+
terminate(error: Error | null): void;
|
|
50
51
|
rerun(): Promise<void>;
|
|
51
52
|
}
|
|
52
53
|
export {};
|
package/dist/browser/DOMWorld.js
CHANGED
|
@@ -131,6 +131,9 @@ class WaitTask {
|
|
|
131
131
|
this.onBrowserClose = () => {
|
|
132
132
|
return this.terminate(new Error('Browser was closed'));
|
|
133
133
|
};
|
|
134
|
+
this.onBrowserCloseSilent = () => {
|
|
135
|
+
return this.terminate(null);
|
|
136
|
+
};
|
|
134
137
|
function getPredicateBody(predicateBody) {
|
|
135
138
|
if ((0, util_1.isString)(predicateBody)) {
|
|
136
139
|
return `return (${predicateBody});`;
|
|
@@ -157,11 +160,14 @@ class WaitTask {
|
|
|
157
160
|
}
|
|
158
161
|
__classPrivateFieldSet(this, _WaitTask_browser, options.browser, "f");
|
|
159
162
|
__classPrivateFieldGet(this, _WaitTask_browser, "f").on("closed" /* BrowserEmittedEvents.Closed */, this.onBrowserClose);
|
|
163
|
+
__classPrivateFieldGet(this, _WaitTask_browser, "f").on("closed-silent" /* BrowserEmittedEvents.ClosedSilent */, this.onBrowserCloseSilent);
|
|
160
164
|
this.rerun();
|
|
161
165
|
}
|
|
162
166
|
terminate(error) {
|
|
163
167
|
__classPrivateFieldSet(this, _WaitTask_terminated, true, "f");
|
|
164
|
-
|
|
168
|
+
if (error) {
|
|
169
|
+
__classPrivateFieldGet(this, _WaitTask_reject, "f").call(this, error);
|
|
170
|
+
}
|
|
165
171
|
__classPrivateFieldGet(this, _WaitTask_instances, "m", _WaitTask_cleanup).call(this);
|
|
166
172
|
}
|
|
167
173
|
async rerun() {
|
|
@@ -242,6 +248,7 @@ _WaitTask_domWorld = new WeakMap(), _WaitTask_timeout = new WeakMap(), _WaitTask
|
|
|
242
248
|
clearTimeout(__classPrivateFieldGet(this, _WaitTask_timeoutTimer, "f"));
|
|
243
249
|
}
|
|
244
250
|
__classPrivateFieldGet(this, _WaitTask_browser, "f").off("closed" /* BrowserEmittedEvents.Closed */, this.onBrowserClose);
|
|
251
|
+
__classPrivateFieldGet(this, _WaitTask_browser, "f").off("closed-silent" /* BrowserEmittedEvents.ClosedSilent */, this.onBrowserCloseSilent);
|
|
245
252
|
__classPrivateFieldGet(this, _WaitTask_domWorld, "f")._waitTasks.delete(this);
|
|
246
253
|
};
|
|
247
254
|
function waitForPredicatePageFunction(predicateBody, timeout, ...args) {
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { Browser } from './Browser';
|
|
17
16
|
import type { Page } from './BrowserPage';
|
|
18
17
|
import type { CDPSession } from './Connection';
|
|
19
18
|
import type { Frame as TFrame } from './devtools-types';
|
|
@@ -83,7 +82,6 @@ export declare class Frame {
|
|
|
83
82
|
evaluate<T extends EvaluateFn>(pageFunction: T, ...args: SerializableOrJSHandle[]): Promise<UnwrapPromiseLike<EvaluateFnReturnType<T>>>;
|
|
84
83
|
url(): string;
|
|
85
84
|
childFrames(): Frame[];
|
|
86
|
-
waitForFunction(browser: Browser, pageFunction: Function | string, ...args: SerializableOrJSHandle[]): Promise<JSHandle>;
|
|
87
85
|
_navigated(framePayload: TFrame): void;
|
|
88
86
|
_navigatedWithinDocument(url: string): void;
|
|
89
87
|
_onLifecycleEvent(loaderId: string, name: string): void;
|
|
@@ -460,9 +460,6 @@ class Frame {
|
|
|
460
460
|
childFrames() {
|
|
461
461
|
return Array.from(this._childFrames);
|
|
462
462
|
}
|
|
463
|
-
waitForFunction(browser, pageFunction, ...args) {
|
|
464
|
-
return this._mainWorld.waitForFunction(browser, pageFunction, ...args);
|
|
465
|
-
}
|
|
466
463
|
_navigated(framePayload) {
|
|
467
464
|
this._name = framePayload.name;
|
|
468
465
|
__classPrivateFieldSet(this, _Frame_url, `${framePayload.url}${framePayload.urlFragment || ''}`, "f");
|
|
@@ -6,4 +6,10 @@ export interface ProductLauncher {
|
|
|
6
6
|
executablePath: (path?: any) => string;
|
|
7
7
|
product: Product;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export declare class ChromeLauncher implements ProductLauncher {
|
|
10
|
+
_preferredRevision: string;
|
|
11
|
+
constructor(preferredRevision: string);
|
|
12
|
+
launch(options: PuppeteerNodeLaunchOptions): Promise<Browser>;
|
|
13
|
+
executablePath(): string;
|
|
14
|
+
get product(): Product;
|
|
15
|
+
}
|
package/dist/browser/Launcher.js
CHANGED
|
@@ -23,6 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ChromeLauncher = void 0;
|
|
26
27
|
/**
|
|
27
28
|
* Copyright 2017 Google Inc. All rights reserved.
|
|
28
29
|
*
|
|
@@ -112,7 +113,7 @@ class ChromeLauncher {
|
|
|
112
113
|
}, { timeout });
|
|
113
114
|
}
|
|
114
115
|
catch (error) {
|
|
115
|
-
await browser.close();
|
|
116
|
+
await browser.close(false);
|
|
116
117
|
throw error;
|
|
117
118
|
}
|
|
118
119
|
return browser;
|
|
@@ -125,6 +126,7 @@ class ChromeLauncher {
|
|
|
125
126
|
return 'chrome';
|
|
126
127
|
}
|
|
127
128
|
}
|
|
129
|
+
exports.ChromeLauncher = ChromeLauncher;
|
|
128
130
|
function resolveExecutablePath(launcher) {
|
|
129
131
|
const { product, _preferredRevision } = launcher;
|
|
130
132
|
const browserFetcher = new BrowserFetcher_1.BrowserFetcher({
|
|
@@ -140,7 +142,3 @@ function resolveExecutablePath(launcher) {
|
|
|
140
142
|
: `Could not find expected browser (${product}) locally. ${product === 'chrome' ? chromeHelp : firefoxHelp}`;
|
|
141
143
|
return { executablePath: revisionInfo.executablePath, missingText };
|
|
142
144
|
}
|
|
143
|
-
function Launcher(preferredRevision) {
|
|
144
|
-
return new ChromeLauncher(preferredRevision);
|
|
145
|
-
}
|
|
146
|
-
exports.default = Launcher;
|
|
@@ -25,14 +25,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
25
25
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
26
26
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
27
27
|
};
|
|
28
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
-
};
|
|
31
28
|
var _PuppeteerNode_lazyLauncher, _PuppeteerNode_productName;
|
|
32
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
30
|
exports.PuppeteerNode = void 0;
|
|
34
31
|
const BrowserFetcher_1 = require("./BrowserFetcher");
|
|
35
|
-
const Launcher_1 =
|
|
32
|
+
const Launcher_1 = require("./Launcher");
|
|
36
33
|
const revisions_1 = require("./revisions");
|
|
37
34
|
class PuppeteerNode {
|
|
38
35
|
constructor(settings) {
|
|
@@ -62,8 +59,7 @@ class PuppeteerNode {
|
|
|
62
59
|
default:
|
|
63
60
|
this._preferredRevision = revisions_1.PUPPETEER_REVISIONS.chromium;
|
|
64
61
|
}
|
|
65
|
-
|
|
66
|
-
__classPrivateFieldSet(this, _PuppeteerNode_lazyLauncher, (0, Launcher_1.default)(this._preferredRevision), "f");
|
|
62
|
+
__classPrivateFieldSet(this, _PuppeteerNode_lazyLauncher, new Launcher_1.ChromeLauncher(this._preferredRevision), "f");
|
|
67
63
|
}
|
|
68
64
|
return __classPrivateFieldGet(this, _PuppeteerNode_lazyLauncher, "f");
|
|
69
65
|
}
|
package/dist/combine-videos.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Codec } from './codec';
|
|
2
|
-
|
|
2
|
+
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
3
|
+
declare type Options = {
|
|
3
4
|
files: string[];
|
|
4
5
|
filelistDir: string;
|
|
5
6
|
output: string;
|
|
@@ -8,4 +9,8 @@ export declare const combineVideos: ({ files, filelistDir, output, onProgress, n
|
|
|
8
9
|
codec: Codec;
|
|
9
10
|
fps: number;
|
|
10
11
|
numberOfGifLoops: number | null;
|
|
11
|
-
|
|
12
|
+
remotionRoot: string;
|
|
13
|
+
ffmpegExecutable: FfmpegExecutable;
|
|
14
|
+
};
|
|
15
|
+
export declare const combineVideos: (options: Options) => Promise<void>;
|
|
16
|
+
export {};
|
package/dist/combine-videos.js
CHANGED
|
@@ -8,17 +8,19 @@ exports.combineVideos = void 0;
|
|
|
8
8
|
const execa_1 = __importDefault(require("execa"));
|
|
9
9
|
const fs_1 = require("fs");
|
|
10
10
|
const path_1 = require("path");
|
|
11
|
+
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
11
12
|
const get_audio_codec_name_1 = require("./get-audio-codec-name");
|
|
12
13
|
const is_audio_codec_1 = require("./is-audio-codec");
|
|
13
14
|
const parse_ffmpeg_progress_1 = require("./parse-ffmpeg-progress");
|
|
14
15
|
const truthy_1 = require("./truthy");
|
|
15
|
-
const combineVideos = async (
|
|
16
|
+
const combineVideos = async (options) => {
|
|
16
17
|
var _a;
|
|
18
|
+
const { files, filelistDir, output, onProgress, numberOfFrames, codec, fps, numberOfGifLoops, ffmpegExecutable, remotionRoot, } = options;
|
|
17
19
|
const fileList = files.map((p) => `file '${p}'`).join('\n');
|
|
18
20
|
const fileListTxt = (0, path_1.join)(filelistDir, 'files.txt');
|
|
19
21
|
(0, fs_1.writeFileSync)(fileListTxt, fileList);
|
|
20
22
|
try {
|
|
21
|
-
const task = (0, execa_1.default)('ffmpeg', [
|
|
23
|
+
const task = (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffmpegExecutable, remotionRoot, 'ffmpeg'), [
|
|
22
24
|
(0, is_audio_codec_1.isAudioCodec)(codec) ? null : '-r',
|
|
23
25
|
(0, is_audio_codec_1.isAudioCodec)(codec) ? null : String(fps),
|
|
24
26
|
'-f',
|
package/dist/convert-to-pcm.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
2
|
-
export declare const convertToPcm: ({ ffmpegExecutable, input, outName, }: {
|
|
2
|
+
export declare const convertToPcm: ({ ffmpegExecutable, input, outName, remotionRoot, }: {
|
|
3
3
|
ffmpegExecutable: FfmpegExecutable;
|
|
4
4
|
input: string;
|
|
5
5
|
outName: string;
|
|
6
|
+
remotionRoot: string;
|
|
6
7
|
}) => Promise<void>;
|
package/dist/convert-to-pcm.js
CHANGED
|
@@ -5,9 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.convertToPcm = void 0;
|
|
7
7
|
const execa_1 = __importDefault(require("execa"));
|
|
8
|
+
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
8
9
|
const sample_rate_1 = require("./sample-rate");
|
|
9
|
-
const convertToPcm = async ({ ffmpegExecutable, input, outName, }) => {
|
|
10
|
-
await (0, execa_1.default)(
|
|
10
|
+
const convertToPcm = async ({ ffmpegExecutable, input, outName, remotionRoot, }) => {
|
|
11
|
+
await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffmpegExecutable, remotionRoot, 'ffmpeg'), [
|
|
11
12
|
'-i',
|
|
12
13
|
input,
|
|
13
14
|
'-c:a',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
2
|
-
export declare const createSilentAudio: ({ ffmpegExecutable, numberOfSeconds, outName, }: {
|
|
2
|
+
export declare const createSilentAudio: ({ ffmpegExecutable, numberOfSeconds, outName, remotionRoot, }: {
|
|
3
3
|
ffmpegExecutable: FfmpegExecutable;
|
|
4
4
|
numberOfSeconds: number;
|
|
5
5
|
outName: string;
|
|
6
|
+
remotionRoot: string;
|
|
6
7
|
}) => Promise<void>;
|
|
@@ -5,9 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createSilentAudio = void 0;
|
|
7
7
|
const execa_1 = __importDefault(require("execa"));
|
|
8
|
+
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
8
9
|
const sample_rate_1 = require("./sample-rate");
|
|
9
|
-
const createSilentAudio = async ({ ffmpegExecutable, numberOfSeconds, outName, }) => {
|
|
10
|
-
await (0, execa_1.default)(
|
|
10
|
+
const createSilentAudio = async ({ ffmpegExecutable, numberOfSeconds, outName, remotionRoot, }) => {
|
|
11
|
+
await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffmpegExecutable, remotionRoot, 'ffmpeg'), [
|
|
11
12
|
'-f',
|
|
12
13
|
'lavfi',
|
|
13
14
|
'-i',
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare
|
|
3
|
-
declare type Browser = Await<ReturnType<typeof openBrowser>>;
|
|
4
|
-
export declare const cycleBrowserTabs: (puppeteerInstance: Browser, concurrency: number) => {
|
|
1
|
+
import type { BrowserReplacer } from './replace-browser';
|
|
2
|
+
export declare const cycleBrowserTabs: (puppeteerInstance: BrowserReplacer, concurrency: number) => {
|
|
5
3
|
stopCycling: () => void;
|
|
6
4
|
};
|
|
7
|
-
export {};
|