Comparing version 1.5.0 to 1.6.0-alpha.0985ca71
@@ -5,2 +5,3 @@ import { Browser } from './browser'; | ||
import { Concurrency } from './concurrency'; | ||
import { FrameRange } from './frame-range'; | ||
import { ImageFormat } from './image-format'; | ||
@@ -17,2 +18,7 @@ import { WebpackConfiguration, WebpackOverrideFn } from './override-webpack'; | ||
readonly overrideWebpackConfig: (fn: WebpackOverrideFn) => void; | ||
/** | ||
* Whether Webpack bundles should be cached to make | ||
* subsequent renders faster. Default: true | ||
*/ | ||
readonly setCachingEnabled: (flag: boolean) => void; | ||
}; | ||
@@ -43,2 +49,9 @@ readonly Puppeteer: { | ||
readonly setImageFormat: (format: "png" | "jpeg") => void; | ||
/** | ||
* Render only a subset of a video. | ||
* Pass in a tuple [20, 30] to only render frames 20-30 into a video. | ||
* Pass in a single number `20` to only render a single frame as an image. | ||
* The frame count starts at 0. | ||
*/ | ||
readonly setFrameRange: (newFrameRange: number | [number, number] | null) => void; | ||
}; | ||
@@ -79,3 +92,3 @@ readonly Output: { | ||
}; | ||
export type { PixelFormat, Concurrency, WebpackConfiguration, WebpackOverrideFn, BrowserExecutable, ImageFormat, Codec, Browser, }; | ||
export type { PixelFormat, Concurrency, WebpackConfiguration, WebpackOverrideFn, BrowserExecutable, ImageFormat, Codec, Browser, FrameRange, }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -8,2 +8,3 @@ "use strict"; | ||
const crf_1 = require("./crf"); | ||
const frame_range_1 = require("./frame-range"); | ||
const image_format_1 = require("./image-format"); | ||
@@ -15,2 +16,3 @@ const image_sequence_1 = require("./image-sequence"); | ||
const quality_1 = require("./quality"); | ||
const webpack_caching_1 = require("./webpack-caching"); | ||
exports.Config = { | ||
@@ -24,2 +26,7 @@ Bundling: { | ||
overrideWebpackConfig: override_webpack_1.overrideWebpackConfig, | ||
/** | ||
* Whether Webpack bundles should be cached to make | ||
* subsequent renders faster. Default: true | ||
*/ | ||
setCachingEnabled: webpack_caching_1.setWebpackCaching, | ||
}, | ||
@@ -50,2 +57,9 @@ Puppeteer: { | ||
setImageFormat: image_format_1.setImageFormat, | ||
/** | ||
* Render only a subset of a video. | ||
* Pass in a tuple [20, 30] to only render frames 20-30 into a video. | ||
* Pass in a single number `20` to only render a single frame as an image. | ||
* The frame count starts at 0. | ||
*/ | ||
setFrameRange: frame_range_1.setFrameRange, | ||
}, | ||
@@ -52,0 +66,0 @@ Output: { |
@@ -19,2 +19,3 @@ /// <reference types="react" /> | ||
getConcurrency: () => number | null; | ||
getRange: () => number | [number, number] | null; | ||
getShouldOverwrite: () => boolean; | ||
@@ -34,2 +35,3 @@ getOutputCodecOrUndefined: () => import("./config/codec").CodecOrUndefined; | ||
FEATURE_FLAG_FIREFOX_SUPPORT: boolean; | ||
DEFAULT_WEBPACK_CACHE_ENABLED: boolean; | ||
getBrowser: () => "chrome" | "firefox" | null; | ||
@@ -39,7 +41,10 @@ DEFAULT_BROWSER: import("./config/browser").Browser; | ||
getActualCrf: (codec: "h264" | "h265" | "vp8" | "vp9") => number; | ||
setFrameRangeFromCli: (newFrameRange: string | number) => void; | ||
getUserPreferredImageFormat: () => "png" | "jpeg" | undefined; | ||
validateSelectedPixelFormatAndImageFormatCombination: (pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le", imageFormat: "png" | "jpeg") => void; | ||
validateSelectedPixelFormatAndCodecCombination: (pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le", codec: "h264" | "h265" | "vp8" | "vp9") => void; | ||
validateFrameRange: (frameRange: number | [number, number] | null) => void; | ||
getWebpackCaching: () => boolean; | ||
}; | ||
export type { TComposition, Timeline, TCompMetadata, TSequence, WebpackOverrideFn, }; | ||
//# sourceMappingURL=internals.d.ts.map |
@@ -29,2 +29,3 @@ "use strict"; | ||
const crf_1 = require("./config/crf"); | ||
const frame_range_1 = require("./config/frame-range"); | ||
const image_format_1 = require("./config/image-format"); | ||
@@ -36,2 +37,3 @@ const image_sequence_1 = require("./config/image-sequence"); | ||
const quality_1 = require("./config/quality"); | ||
const webpack_caching_1 = require("./config/webpack-caching"); | ||
const perf = __importStar(require("./perf")); | ||
@@ -58,2 +60,3 @@ const register_root_1 = require("./register-root"); | ||
getConcurrency: concurrency_1.getConcurrency, | ||
getRange: frame_range_1.getRange, | ||
getShouldOverwrite: overwrite_1.getShouldOverwrite, | ||
@@ -69,2 +72,3 @@ getOutputCodecOrUndefined: codec_1.getOutputCodecOrUndefined, | ||
FEATURE_FLAG_FIREFOX_SUPPORT: browser_1.FEATURE_FLAG_FIREFOX_SUPPORT, | ||
DEFAULT_WEBPACK_CACHE_ENABLED: webpack_caching_1.DEFAULT_WEBPACK_CACHE_ENABLED, | ||
getBrowser: browser_1.getBrowser, | ||
@@ -74,6 +78,9 @@ DEFAULT_BROWSER: browser_1.DEFAULT_BROWSER, | ||
getActualCrf: crf_1.getActualCrf, | ||
setFrameRangeFromCli: frame_range_1.setFrameRangeFromCli, | ||
getUserPreferredImageFormat: image_format_1.getUserPreferredImageFormat, | ||
validateSelectedPixelFormatAndImageFormatCombination: image_format_1.validateSelectedPixelFormatAndImageFormatCombination, | ||
validateSelectedPixelFormatAndCodecCombination: pixel_format_1.validateSelectedPixelFormatAndCodecCombination, | ||
validateFrameRange: frame_range_1.validateFrameRange, | ||
getWebpackCaching: webpack_caching_1.getWebpackCaching, | ||
}; | ||
//# sourceMappingURL=internals.js.map |
declare type ExtrapolateType = 'extend' | 'identity' | 'clamp'; | ||
export declare function interpolate(input: number, inputRange: [number, number], outputRange: [number, number], options?: { | ||
export declare function interpolate(input: number, inputRange: number[], outputRange: number[], options?: { | ||
easing?: (input: number) => number; | ||
@@ -4,0 +4,0 @@ extrapolateLeft?: ExtrapolateType; |
@@ -5,7 +5,4 @@ "use strict"; | ||
exports.interpolate = void 0; | ||
function interpolate(input, inputRange, outputRange, options) { | ||
var _a, _b, _c; | ||
const extrapolateLeft = (_a = options === null || options === void 0 ? void 0 : options.extrapolateLeft) !== null && _a !== void 0 ? _a : 'extend'; | ||
const extrapolateRight = (_b = options === null || options === void 0 ? void 0 : options.extrapolateRight) !== null && _b !== void 0 ? _b : 'extend'; | ||
const easing = (_c = options === null || options === void 0 ? void 0 : options.easing) !== null && _c !== void 0 ? _c : ((num) => num); | ||
function interpolateFunction(input, inputRange, outputRange, options) { | ||
const { extrapolateLeft, extrapolateRight, easing } = options; | ||
let result = input; | ||
@@ -69,3 +66,74 @@ const [inputMin, inputMax] = inputRange; | ||
} | ||
function findRange(input, inputRange) { | ||
let i; | ||
for (i = 1; i < inputRange.length - 1; ++i) { | ||
if (inputRange[i] >= input) { | ||
break; | ||
} | ||
} | ||
return i - 1; | ||
} | ||
function checkValidInputRange(arr) { | ||
if (arr.length < 2) { | ||
throw new Error('inputRange must have at least 2 elements'); | ||
} | ||
for (let i = 1; i < arr.length; ++i) { | ||
if (!(arr[i] >= arr[i - 1])) { | ||
throw new Error(`inputRange must be monotonically non-decreasing but got [${arr.join(',')}]`); | ||
} | ||
} | ||
} | ||
function checkInfiniteRange(name, arr) { | ||
if (arr.length < 2) { | ||
throw new Error(name + ' must have at least 2 elements'); | ||
} | ||
if (!(arr.length !== 2 || arr[0] !== -Infinity || arr[1] !== Infinity)) { | ||
throw new Error(`${name} must contain only finite numbers, but got [${arr.join(',')}]`); | ||
} | ||
for (const index in arr) { | ||
if (typeof arr[index] !== 'number') { | ||
throw new Error(`${name} must contain only numbers`); | ||
} | ||
if (arr[index] === -Infinity || arr[index] === Infinity) { | ||
throw new Error(`${name} must contain only finite numbers, but got [${arr.join(',')}]`); | ||
} | ||
} | ||
} | ||
function interpolate(input, inputRange, outputRange, options) { | ||
var _a; | ||
if (typeof input === 'undefined' || | ||
typeof inputRange === 'undefined' || | ||
typeof outputRange === 'undefined') { | ||
throw new Error('input or inputRange or outputRange can not be undefined'); | ||
} | ||
if (inputRange.length !== outputRange.length) { | ||
throw new Error('inputRange (' + | ||
inputRange.length + | ||
') and outputRange (' + | ||
outputRange.length + | ||
') must have the same length'); | ||
} | ||
checkInfiniteRange('inputRange', inputRange); | ||
checkValidInputRange(inputRange); | ||
checkInfiniteRange('outputRange', outputRange); | ||
const easing = (_a = options === null || options === void 0 ? void 0 : options.easing) !== null && _a !== void 0 ? _a : ((num) => num); | ||
let extrapolateLeft = 'extend'; | ||
if ((options === null || options === void 0 ? void 0 : options.extrapolateLeft) !== undefined) { | ||
extrapolateLeft = options.extrapolateLeft; | ||
} | ||
let extrapolateRight = 'extend'; | ||
if ((options === null || options === void 0 ? void 0 : options.extrapolateRight) !== undefined) { | ||
extrapolateRight = options.extrapolateRight; | ||
} | ||
if (typeof input !== 'number') { | ||
throw new TypeError('Cannot interpolation an input which is not a number'); | ||
} | ||
const range = findRange(input, inputRange); | ||
return interpolateFunction(input, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], { | ||
easing, | ||
extrapolateLeft, | ||
extrapolateRight, | ||
}); | ||
} | ||
exports.interpolate = interpolate; | ||
//# sourceMappingURL=interpolate.js.map |
@@ -30,5 +30,10 @@ "use strict"; | ||
} | ||
if (!playing || currentFrame === 0) { | ||
if (!playing) { | ||
videoRef.current.currentTime = currentFrame / (1000 / videoConfig.fps); | ||
return; | ||
} | ||
if (videoRef.current.paused) { | ||
videoRef.current.currentTime = currentFrame / (1000 / videoConfig.fps); | ||
videoRef.current.play(); | ||
} | ||
}, [currentFrame, playing, videoConfig]); | ||
@@ -35,0 +40,0 @@ return jsx_runtime_1.jsx("video", Object.assign({ ref: videoRef, muted: true }, props), void 0); |
{ | ||
"name": "remotion", | ||
"version": "1.5.0", | ||
"version": "1.6.0-alpha.0985ca71", | ||
"description": "Render videos in React", | ||
@@ -9,2 +9,3 @@ "main": "dist/index.js", | ||
"build": "tsc -d", | ||
"watch": "tsc -w", | ||
"prerelease": "cp ../../README.md ." | ||
@@ -11,0 +12,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
219809
246
2681
2